Changeset 1020

Show
Ignore:
Timestamp:
10/02/08 16:14:12 (3 months ago)
Author:
takkaria
Message:
  • Update changelog.
  • Move some functions from obj-util.c to the more appropriate generate.c.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/changes.txt

    r1012 r1020  
    6666 * Make monster XP and native depth always known, even without 
    6767   kills.  (#596) 
    68  * Rejig social status a bit. 
     68 * Rejig social status a bit -- it rises with level from a certain baseline. 
     69 * Display various skills numerically on the character sheet, rather than 
     70   with text.  This is like Eddie's patch, but a bit more polished. 
     71 
    6972 
    7073Gameplay changes 
  • trunk/src/externs.h

    r1014 r1020  
    349349 
    350350/* generate.c */ 
     351void place_object(int y, int x, int level, bool good, bool great); 
     352void place_gold(int y, int x, int level); 
     353void place_secret_door(int y, int x); 
     354void place_closed_door(int y, int x); 
     355void place_random_door(int y, int x); 
    351356extern void generate_cave(void); 
    352357 
  • trunk/src/generate.c

    r988 r1020  
    1717 */ 
    1818#include "angband.h" 
     19#include "object/tvalsval.h" 
    1920 
    2021 
     
    428429        } 
    429430} 
     431 
     432/* 
     433 * Attempt to place an object (normal or good/great) at the given location. 
     434 */ 
     435void place_object(int y, int x, int level, bool good, bool great) 
     436{ 
     437        object_type *i_ptr; 
     438        object_type object_type_body; 
     439 
     440        /* Paranoia */ 
     441        if (!in_bounds(y, x)) return; 
     442 
     443        /* Hack -- clean floor space */ 
     444        if (!cave_clean_bold(y, x)) return; 
     445 
     446        /* Get local object */ 
     447        i_ptr = &object_type_body; 
     448 
     449        /* Wipe the object */ 
     450        object_wipe(i_ptr); 
     451 
     452        /* Make an object (if possible) */ 
     453        if (make_object(i_ptr, level, good, great)) 
     454        { 
     455                i_ptr->origin = ORIGIN_FLOOR; 
     456                i_ptr->origin_depth = p_ptr->depth; 
     457 
     458                /* Give it to the floor */ 
     459                if (!floor_carry(y, x, i_ptr)) 
     460                { 
     461                        /* Hack -- Preserve artifacts */ 
     462                        a_info[i_ptr->name1].cur_num = 0; 
     463                } 
     464        } 
     465} 
     466 
     467 
     468/* 
     469 * Places a treasure (Gold or Gems) at given location 
     470 */ 
     471void place_gold(int y, int x, int level) 
     472{ 
     473        object_type *i_ptr; 
     474        object_type object_type_body; 
     475 
     476        /* Paranoia */ 
     477        if (!in_bounds(y, x)) return; 
     478 
     479        /* Require clean floor space */ 
     480        if (!cave_clean_bold(y, x)) return; 
     481 
     482        /* Get local object */ 
     483        i_ptr = &object_type_body; 
     484 
     485        /* Wipe the object */ 
     486        object_wipe(i_ptr); 
     487 
     488        /* Make some gold */ 
     489        make_gold(i_ptr, level, SV_GOLD_ANY); 
     490 
     491        /* Give it to the floor */ 
     492        (void)floor_carry(y, x, i_ptr); 
     493} 
     494 
     495 
     496 
     497 
     498/* 
     499 * Place a secret door at the given location 
     500 */ 
     501void place_secret_door(int y, int x) 
     502{ 
     503        /* Create secret door */ 
     504        cave_set_feat(y, x, FEAT_SECRET); 
     505} 
     506 
     507 
     508/* 
     509 * Place a random type of closed door at the given location. 
     510 */ 
     511void place_closed_door(int y, int x) 
     512{ 
     513        int tmp; 
     514 
     515        /* Choose an object */ 
     516        tmp = randint0(400); 
     517 
     518        /* Closed doors (300/400) */ 
     519        if (tmp < 300) 
     520        { 
     521                /* Create closed door */ 
     522                cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00); 
     523        } 
     524 
     525        /* Locked doors (99/400) */ 
     526        else if (tmp < 399) 
     527        { 
     528                /* Create locked door */ 
     529                cave_set_feat(y, x, FEAT_DOOR_HEAD + randint1(7)); 
     530        } 
     531 
     532        /* Stuck doors (1/400) */ 
     533        else 
     534        { 
     535                /* Create jammed door */ 
     536                cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x08 + randint0(8)); 
     537        } 
     538} 
     539 
     540 
     541/* 
     542 * Place a random type of door at the given location. 
     543 */ 
     544void place_random_door(int y, int x) 
     545{ 
     546        int tmp; 
     547 
     548        /* Choose an object */ 
     549        tmp = randint0(1000); 
     550 
     551        /* Open doors (300/1000) */ 
     552        if (tmp < 300) 
     553        { 
     554                /* Create open door */ 
     555                cave_set_feat(y, x, FEAT_OPEN); 
     556        } 
     557 
     558        /* Broken doors (100/1000) */ 
     559        else if (tmp < 400) 
     560        { 
     561                /* Create broken door */ 
     562                cave_set_feat(y, x, FEAT_BROKEN); 
     563        } 
     564 
     565        /* Secret doors (200/1000) */ 
     566        else if (tmp < 600) 
     567        { 
     568                /* Create secret door */ 
     569                cave_set_feat(y, x, FEAT_SECRET); 
     570        } 
     571 
     572        /* Closed, locked, or stuck doors (400/1000) */ 
     573        else 
     574        { 
     575                /* Create closed door */ 
     576                place_closed_door(y, x); 
     577        } 
     578} 
     579 
     580 
     581 
     582 
    430583 
    431584 
  • trunk/src/object/obj-util.c

    r999 r1020  
    23602360                /* Drop the object */ 
    23612361                drop_near(i_ptr, -1, y1, x1); 
    2362         } 
    2363 } 
    2364  
    2365  
    2366 /* 
    2367  * Attempt to place an object (normal or good/great) at the given location. 
    2368  */ 
    2369 void place_object(int y, int x, int level, bool good, bool great) 
    2370 { 
    2371         object_type *i_ptr; 
    2372         object_type object_type_body; 
    2373  
    2374         /* Paranoia */ 
    2375         if (!in_bounds(y, x)) return; 
    2376  
    2377         /* Hack -- clean floor space */ 
    2378         if (!cave_clean_bold(y, x)) return; 
    2379  
    2380         /* Get local object */ 
    2381         i_ptr = &object_type_body; 
    2382  
    2383         /* Wipe the object */ 
    2384         object_wipe(i_ptr); 
    2385  
    2386         /* Make an object (if possible) */ 
    2387         if (make_object(i_ptr, level, good, great)) 
    2388         { 
    2389                 i_ptr->origin = ORIGIN_FLOOR; 
    2390                 i_ptr->origin_depth = p_ptr->depth; 
    2391  
    2392                 /* Give it to the floor */ 
    2393                 if (!floor_carry(y, x, i_ptr)) 
    2394                 { 
    2395                         /* Hack -- Preserve artifacts */ 
    2396                         a_info[i_ptr->name1].cur_num = 0; 
    2397                 } 
    2398         } 
    2399 } 
    2400  
    2401  
    2402 /* 
    2403  * Places a treasure (Gold or Gems) at given location 
    2404  */ 
    2405 void place_gold(int y, int x, int level) 
    2406 { 
    2407         object_type *i_ptr; 
    2408         object_type object_type_body; 
    2409  
    2410         /* Paranoia */ 
    2411         if (!in_bounds(y, x)) return; 
    2412  
    2413         /* Require clean floor space */ 
    2414         if (!cave_clean_bold(y, x)) return; 
    2415  
    2416         /* Get local object */ 
    2417         i_ptr = &object_type_body; 
    2418  
    2419         /* Wipe the object */ 
    2420         object_wipe(i_ptr); 
    2421  
    2422         /* Make some gold */ 
    2423         make_gold(i_ptr, level, SV_GOLD_ANY); 
    2424  
    2425         /* Give it to the floor */ 
    2426         (void)floor_carry(y, x, i_ptr); 
    2427 } 
    2428  
    2429  
    2430  
    2431  
    2432 /* 
    2433  * Place a secret door at the given location 
    2434  */ 
    2435 void place_secret_door(int y, int x) 
    2436 { 
    2437         /* Create secret door */ 
    2438         cave_set_feat(y, x, FEAT_SECRET); 
    2439 } 
    2440  
    2441  
    2442 /* 
    2443  * Place a random type of closed door at the given location. 
    2444  */ 
    2445 void place_closed_door(int y, int x) 
    2446 { 
    2447         int tmp; 
    2448  
    2449         /* Choose an object */ 
    2450         tmp = randint0(400); 
    2451  
    2452         /* Closed doors (300/400) */ 
    2453         if (tmp < 300) 
    2454         { 
    2455                 /* Create closed door */ 
    2456                 cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00); 
    2457         } 
    2458  
    2459         /* Locked doors (99/400) */ 
    2460         else if (tmp < 399) 
    2461         { 
    2462                 /* Create locked door */ 
    2463                 cave_set_feat(y, x, FEAT_DOOR_HEAD + randint1(7)); 
    2464         } 
    2465  
    2466         /* Stuck doors (1/400) */ 
    2467         else 
    2468         { 
    2469                 /* Create jammed door */ 
    2470                 cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x08 + randint0(8)); 
    2471         } 
    2472 } 
    2473  
    2474  
    2475 /* 
    2476  * Place a random type of door at the given location. 
    2477  */ 
    2478 void place_random_door(int y, int x) 
    2479 { 
    2480         int tmp; 
    2481  
    2482         /* Choose an object */ 
    2483         tmp = randint0(1000); 
    2484  
    2485         /* Open doors (300/1000) */ 
    2486         if (tmp < 300) 
    2487         { 
    2488                 /* Create open door */ 
    2489                 cave_set_feat(y, x, FEAT_OPEN); 
    2490         } 
    2491  
    2492         /* Broken doors (100/1000) */ 
    2493         else if (tmp < 400) 
    2494         { 
    2495                 /* Create broken door */ 
    2496                 cave_set_feat(y, x, FEAT_BROKEN); 
    2497         } 
    2498  
    2499         /* Secret doors (200/1000) */ 
    2500         else if (tmp < 600) 
    2501         { 
    2502                 /* Create secret door */ 
    2503                 cave_set_feat(y, x, FEAT_SECRET); 
    2504         } 
    2505  
    2506         /* Closed, locked, or stuck doors (400/1000) */ 
    2507         else 
    2508         { 
    2509                 /* Create closed door */ 
    2510                 place_closed_door(y, x); 
    25112362        } 
    25122363} 
  • trunk/src/object/object.h

    r1001 r1020  
    115115void drop_near(object_type *j_ptr, int chance, int y, int x); 
    116116void acquirement(int y1, int x1, int level, int num, bool great); 
    117 void place_object(int y, int x, int level, bool good, bool great); 
    118 void place_gold(int y, int x, int level); 
    119 void place_secret_door(int y, int x); 
    120 void place_closed_door(int y, int x); 
    121 void place_random_door(int y, int x); 
    122117void inven_item_charges(int item); 
    123118void inven_item_describe(int item);