Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 861 lines (726 sloc) 16.231 kb
95189b30 »
2007-07-29 Import
1 #include "wl_def.h"
2
3 /*
4 =============================================================================
5
6 STATICS
7
8 =============================================================================
9 */
10
11
12 statobj_t statobjlist[MAXSTATS], *laststatobj;
13
14 struct
15 {
06a2b2e6 »
2007-08-19 Shrink statobjinfo.
16 myshort picnum:10;
17 stat_t type:6;
95189b30 »
2007-07-29 Import
18 } static const statinfo[] =
19 {
20 {SPR_STAT_0}, // puddle spr1v
21 {SPR_STAT_1,block}, // Green Barrel "
22 {SPR_STAT_2,block}, // Table/chairs "
23 {SPR_STAT_3,block}, // Floor lamp "
24 {SPR_STAT_4}, // Chandelier "
25 {SPR_STAT_5,block}, // Hanged man "
26 {SPR_STAT_6,bo_alpo}, // Bad food "
27 {SPR_STAT_7,block}, // Red pillar "
28 {SPR_STAT_8,block}, // Tree spr2v
29 {SPR_STAT_9}, // Skeleton flat "
30 {SPR_STAT_10,block}, // Sink " (SOD:gibs)
31 {SPR_STAT_11,block}, // Potted plant "
32 {SPR_STAT_12,block}, // Urn "
33 {SPR_STAT_13,block}, // Bare table "
34 {SPR_STAT_14}, // Ceiling light "
35
36 #ifndef SPEAR
37 {SPR_STAT_15}, // Kitchen stuff "
38 #else
39 {SPR_STAT_15,block}, // Gibs!
40 #endif
41
42 {SPR_STAT_16,block}, // suit of armor spr3v
43 {SPR_STAT_17,block}, // Hanging cage "
44 {SPR_STAT_18,block}, // SkeletoninCage "
45 {SPR_STAT_19}, // Skeleton relax "
46 {SPR_STAT_20,bo_key1}, // Key 1 "
47 {SPR_STAT_21,bo_key2}, // Key 2 "
48 {SPR_STAT_22,block}, // stuff (SOD:gibs)
49 {SPR_STAT_23}, // stuff
50 {SPR_STAT_24,bo_food}, // Good food spr4v
51 {SPR_STAT_25,bo_firstaid}, // First aid "
52 {SPR_STAT_26,bo_clip}, // Clip "
53 {SPR_STAT_27,bo_machinegun}, // Machine gun "
54 {SPR_STAT_28,bo_chaingun}, // Gatling gun "
55 {SPR_STAT_29,bo_cross}, // Cross "
56 {SPR_STAT_30,bo_chalice}, // Chalice "
57 {SPR_STAT_31,bo_bible}, // Bible "
58 {SPR_STAT_32,bo_crown}, // crown spr5v
59 {SPR_STAT_33,bo_fullheal}, // one up "
60 {SPR_STAT_34,bo_gibs}, // gibs "
61 {SPR_STAT_35,block}, // barrel "
62 {SPR_STAT_36,block}, // well "
63 {SPR_STAT_37,block}, // Empty well "
64 {SPR_STAT_38,bo_gibs}, // Gibs 2 "
65 {SPR_STAT_39,block}, // flag "
66
67 #ifndef SPEAR
68 {SPR_STAT_40,block}, // Call Apogee spr7v
69 #else
70 {SPR_STAT_40}, // Red light
71 #endif
72
73 {SPR_STAT_41}, // junk "
74 {SPR_STAT_42}, // junk "
75 {SPR_STAT_43}, // junk "
76
77 #ifndef SPEAR
78 {SPR_STAT_44}, // pots "
79 #else
80 {SPR_STAT_44,block}, // Gibs!
81 #endif
82
83 {SPR_STAT_45,block}, // stove " (SOD:gibs)
84 {SPR_STAT_46,block}, // spears " (SOD:gibs)
85 {SPR_STAT_47}, // vines "
86
87 #ifdef SPEAR
88 {SPR_STAT_48,block}, // marble pillar
89 {SPR_STAT_49,bo_25clip}, // bonus 25 clip
90 {SPR_STAT_50,block}, // truck
91 {SPR_STAT_51,bo_spear}, // SPEAR OF DESTINY!
92 #endif
93
94 {SPR_STAT_26,bo_clip2}, // Clip "
95 {-1} // terminator
96 };
97
98 /*
99 ===============
100 =
101 = InitStaticList
102 =
103 ===============
104 */
105
106 void InitStaticList()
107 {
108 laststatobj = &statobjlist[0];
109 }
110
111 /*
112 ===============
113 =
114 = SpawnStatic
115 =
116 ===============
117 */
118
0933d390 »
2007-07-29 Reduce object memory use.
119 void SpawnStatic(myint tilex, myint tiley, myint type)
95189b30 »
2007-07-29 Import
120 {
121 laststatobj->shapenum = statinfo[type].picnum;
122 laststatobj->tilex = tilex;
123 laststatobj->tiley = tiley;
124
125 switch (statinfo[type].type)
126 {
127 case block:
0a247d1f »
2007-08-02 Shrink actorat array.
128 set_wall_at(tilex, tiley, 1); // consider it a blocking tile
95189b30 »
2007-07-29 Import
129 case dressing:
03e94537 »
2007-07-30 Reduce object state size.
130 laststatobj->is_bonus = 0;
95189b30 »
2007-07-29 Import
131 break;
132
133 case bo_cross:
134 case bo_chalice:
135 case bo_bible:
136 case bo_crown:
137 case bo_fullheal:
282d8012 »
2007-08-19 Disable more stats code.
138 #ifdef ENABLE_STATS
95189b30 »
2007-07-29 Import
139 if (!loadedgame)
140 gamestate.treasuretotal++;
282d8012 »
2007-08-19 Disable more stats code.
141 #endif
95189b30 »
2007-07-29 Import
142
143 case bo_firstaid:
144 case bo_key1:
145 case bo_key2:
146 case bo_key3:
147 case bo_key4:
148 case bo_clip:
149 case bo_25clip:
150 case bo_machinegun:
151 case bo_chaingun:
152 case bo_food:
153 case bo_alpo:
154 case bo_gibs:
155 case bo_spear:
03e94537 »
2007-07-30 Reduce object state size.
156 laststatobj->is_bonus = true;
95189b30 »
2007-07-29 Import
157 laststatobj->itemnumber = statinfo[type].type;
158 break;
159 default:
160 break;
161 }
162
163 laststatobj++;
164
165 if (laststatobj == &statobjlist[MAXSTATS])
166 Quit ("Too many static objects!\n");
167 }
168
169 /*
170 ===============
171 =
172 = PlaceItemType
173 =
174 = Called during game play to drop actors' items. It finds the proper
175 = item number based on the item type (bo_???). If there are no free item
176 = spots, nothing is done.
177 =
178 ===============
179 */
180
0933d390 »
2007-07-29 Reduce object memory use.
181 void PlaceItemType(myint itemtype, myint tilex, myint tiley)
95189b30 »
2007-07-29 Import
182 {
0933d390 »
2007-07-29 Reduce object memory use.
183 myint type;
95189b30 »
2007-07-29 Import
184 statobj_t *spot;
185
186 //
187 // find the item number
188 //
189 for (type = 0; ; type++)
190 {
191 if (statinfo[type].picnum == -1) /* end of list */
192 Quit("PlaceItemType: couldn't find type!");
193 if (statinfo[type].type == itemtype)
194 break;
195 }
196
197 //
198 // find a spot in statobjlist to put it in
199 //
200 for (spot=&statobjlist[0] ; ; spot++)
201 {
202 if (spot==laststatobj)
203 {
204 if (spot == &statobjlist[MAXSTATS])
205 return; /* no free spots */
206 laststatobj++; /* space at end */
207 break;
208 }
209
210 if (spot->shapenum == -1) /* -1 is a free spot */
211 break;
212 }
213 //
214 // place it
215 //
216 spot->shapenum = statinfo[type].picnum;
217 spot->tilex = tilex;
218 spot->tiley = tiley;
03e94537 »
2007-07-30 Reduce object state size.
219 spot->is_bonus = 1;
95189b30 »
2007-07-29 Import
220 spot->itemnumber = statinfo[type].type;
221 }
222
223 /*
224 =============================================================================
225
226 DOORS
227
228 doorobjlist[] holds most of the information for the doors
229
230 doorposition[] holds the amount the door is open, ranging from 0 to 0xffff
231 this is directly accessed by AsmRefresh during rendering
232
233 The number of doors is limited to 64 because a spot in tilemap holds the
234 door number in the low 6 bits, with the high bit meaning a door center
235 and bit 6 meaning a door side tile
236
237 Open doors conect two areas, so sounds will travel between them and sight
238 will be checked when the player is in a connected area.
239
240 Areaconnect is incremented/decremented by each door. If >0 they connect
241
242 Every time a door opens or closes the areabyplayer matrix gets recalculated.
243 An area is true if it connects with the player's current spot.
244
245 =============================================================================
246 */
247
ddeb2319 »
2007-07-30 Shrink door state.
248 /* Must fit in a 10-bit field. */
95189b30 »
2007-07-29 Import
249 #define OPENTICS 300
250
251 doorobj_t doorobjlist[MAXDOORS],*lastdoorobj;
0933d390 »
2007-07-29 Reduce object memory use.
252 myint doornum;
95189b30 »
2007-07-29 Import
253
6360ea68 »
2007-07-29 Reduce size of door state.
254 umyshort doorposition[MAXDOORS]; // leading edge of door 0=closed
95189b30 »
2007-07-29 Import
255 // 0xffff = fully open
891c041b »
2007-08-03 Shrink areabyplayer.
256 uint64_t areabyplayer;
95189b30 »
2007-07-29 Import
257
258
259 /*
260 ==============
261 =
262 = ConnectAreas
263 =
264 = Scans outward from playerarea, marking all connected areas
265 =
266 ==============
267 */
268
0e2d09ac »
2007-08-04 Remove areaconnect.
269 void ConnectAreas(boolean reset)
95189b30 »
2007-07-29 Import
270 {
0e2d09ac »
2007-08-04 Remove areaconnect.
271 int door;
272 boolean again;
273 int area1, area2;
274 boolean by1, by2;
275 ms0 *map;
95189b30 »
2007-07-29 Import
276
0e2d09ac »
2007-08-04 Remove areaconnect.
277 if (reset) {
891c041b »
2007-08-03 Shrink areabyplayer.
278 areabyplayer = 0;
279 setareabyplayer(player->areanumber);
0e2d09ac »
2007-08-04 Remove areaconnect.
280 }
281 do {
282 again = false;
283 for (door = 0; door < doornum; door++) {
284 if (doorposition[door] == 0)
285 continue;
286 map = (mapseg0 + farmapylookup(doorobjlist[door].tiley)
287 +doorobjlist[door].tilex);
288
289 if (doorobjlist[door].vertical) {
290 area1 = *(map+1);
291 area2 = *(map-1);
292 } else {
293 area1 = *(map-mapwidth);
294 area2 = *(map+mapwidth);
295 }
296 area1 -= AREATILE;
297 area2 -= AREATILE;
298 by1 = getareabyplayer(area1);
299 by2 = getareabyplayer(area2);
300 if (by1 ^ by2) {
301 again = true;
302 if (!by1)
303 setareabyplayer(area1);
304 if (!by2)
305 setareabyplayer(area2);
306 }
307 }
308 } while (again);
95189b30 »
2007-07-29 Import
309 }
310
311 void InitAreas()
312 {
891c041b »
2007-08-03 Shrink areabyplayer.
313 areabyplayer = 0;
314 setareabyplayer(player->areanumber);
95189b30 »
2007-07-29 Import
315 }
316
317 /*
318 ===============
319 =
320 = InitDoorList
321 =
322 ===============
323 */
324
325 void InitDoorList()
326 {
891c041b »
2007-08-03 Shrink areabyplayer.
327 areabyplayer = 0;
95189b30 »
2007-07-29 Import
328
329 lastdoorobj = &doorobjlist[0];
330 doornum = 0;
331 }
332
333 /*
334 ===============
335 =
336 = SpawnDoor
337 =
338 ===============
339 */
340
0933d390 »
2007-07-29 Reduce object memory use.
341 void SpawnDoor(myint tilex, myint tiley, boolean vertical, myint lock)
95189b30 »
2007-07-29 Import
342 {
2a90e2c2 »
2007-08-04 Shrink mapseg.
343 ms0 *map;
95189b30 »
2007-07-29 Import
344
345 if (doornum == 64)
346 Quit ("64+ doors on level!");
347
348 doorposition[doornum] = 0; // doors start out fully closed
349 lastdoorobj->tilex = tilex;
350 lastdoorobj->tiley = tiley;
351 lastdoorobj->vertical = vertical;
352 lastdoorobj->lock = lock;
353 lastdoorobj->action = dr_closed;
354
0a247d1f »
2007-08-02 Shrink actorat array.
355 set_door_actor(tilex, tiley, doornum); // consider it a solid wall
95189b30 »
2007-07-29 Import
356
357 //
358 // make the door tile a special tile, and mark the adjacent tiles
359 // for door sides
360 //
361 tilemap[tilex][tiley] = doornum | 0x80;
2a90e2c2 »
2007-08-04 Shrink mapseg.
362 map = (mapseg0 + farmapylookup(tiley)+tilex);
95189b30 »
2007-07-29 Import
363 if (vertical)
364 {
365 *map = *(map-1); // set area number
366 tilemap[tilex][tiley-1] |= 0x40;
367 tilemap[tilex][tiley+1] |= 0x40;
368 }
369 else
370 {
371 *map = *(map-mapwidth); // set area number
372 tilemap[tilex-1][tiley] |= 0x40;
373 tilemap[tilex+1][tiley] |= 0x40;
374 }
375
376 doornum++;
377 lastdoorobj++;
378 }
379
380 /*
381 =====================
382 =
383 = OpenDoor
384 =
385 =====================
386 */
387
0933d390 »
2007-07-29 Reduce object memory use.
388 void OpenDoor(myint door)
95189b30 »
2007-07-29 Import
389 {
390 if (doorobjlist[door].action == dr_open)
391 doorobjlist[door].ticcount = 0; // reset open time
392 else
393 doorobjlist[door].action = dr_opening; // start it opening
394 }
395
396 /*
397 =====================
398 =
399 = CloseDoor
400 =
401 =====================
402 */
403
0933d390 »
2007-07-29 Reduce object memory use.
404 void CloseDoor(myint door)
95189b30 »
2007-07-29 Import
405 {
0933d390 »
2007-07-29 Reduce object memory use.
406 myint tilex, tiley, area;
95189b30 »
2007-07-29 Import
407 objtype *check;
408
409 //
410 // don't close on anything solid
411 //
412 tilex = doorobjlist[door].tilex;
413 tiley = doorobjlist[door].tiley;
414
0a247d1f »
2007-08-02 Shrink actorat array.
415 if (any_actor_at(tilex, tiley))
95189b30 »
2007-07-29 Import
416 return;
417
418 if (player->tilex == tilex && player->tiley == tiley)
419 return;
420
421 if (doorobjlist[door].vertical)
422 {
423 if (player->tiley == tiley)
424 {
425 if (((player->x+MINDIST) >>TILESHIFT) == tilex)
426 return;
427 if (((player->x-MINDIST) >>TILESHIFT) == tilex)
428 return;
429 }
430
0a247d1f »
2007-08-02 Shrink actorat array.
431 if (obj_actor_at(tilex-1, tiley))
432 check = &objlist[get_actor_at(tilex-1, tiley)];
95189b30 »
2007-07-29 Import
433 else
434 check = NULL;
435
436 if (check && ((check->x+MINDIST) >> TILESHIFT) == tilex)
437 return;
438
0a247d1f »
2007-08-02 Shrink actorat array.
439 if (obj_actor_at(tilex+1, tiley))
440 check = &objlist[get_actor_at(tilex+1, tiley)];
95189b30 »
2007-07-29 Import
441 else
442 check = NULL;
443
444 if (check && ((check->x-MINDIST) >> TILESHIFT) == tilex)
445 return;
446 }
447 else if (!doorobjlist[door].vertical)
448 {
449 if (player->tilex == tilex)
450 {
451 if ( ((player->y+MINDIST) >>TILESHIFT) == tiley )
452 return;
453 if ( ((player->y-MINDIST) >>TILESHIFT) == tiley )
454 return;
455 }
456
0a247d1f »
2007-08-02 Shrink actorat array.
457 if (obj_actor_at(tilex, tiley-1))
458 check = &objlist[get_actor_at(tilex, tiley-1)];
95189b30 »
2007-07-29 Import
459 else
460 check = NULL;
461
462 if (check && ((check->y+MINDIST) >> TILESHIFT) == tiley )
463 return;
464
0a247d1f »
2007-08-02 Shrink actorat array.
465 if (obj_actor_at(tilex, tiley+1))
466 check = &objlist[get_actor_at(tilex, tiley+1)];
95189b30 »
2007-07-29 Import
467 else
468 check = NULL;
469
470 if (check && ((check->y-MINDIST) >> TILESHIFT) == tiley )
471 return;
472 }
473
474
475 //
476 // play door sound if in a connected area
477 //
0e614208 »
2007-08-01 Statically allocate map planes.
478 area = *(mapseg0 + farmapylookup(doorobjlist[door].tiley)
95189b30 »
2007-07-29 Import
479 +doorobjlist[door].tilex)-AREATILE;
891c041b »
2007-08-03 Shrink areabyplayer.
480 if (getareabyplayer(area))
95189b30 »
2007-07-29 Import
481 {
482 PlaySoundLocTile(CLOSEDOORSND,doorobjlist[door].tilex,doorobjlist[door].tiley); // JAB
483 }
484
485 doorobjlist[door].action = dr_closing;
486 //
487 // make the door space solid
488 //
0a247d1f »
2007-08-02 Shrink actorat array.
489 set_door_actor(tilex, tiley, door);
95189b30 »
2007-07-29 Import
490 }
491
492 /*
493 =====================
494 =
495 = OperateDoor
496 =
497 = The player wants to change the door's direction
498 =
499 =====================
500 */
501
0933d390 »
2007-07-29 Reduce object memory use.
502 void OperateDoor(myint door)
95189b30 »
2007-07-29 Import
503 {
0933d390 »
2007-07-29 Reduce object memory use.
504 myint lock;
95189b30 »
2007-07-29 Import
505
506 lock = doorobjlist[door].lock;
507 if (lock >= dr_lock1 && lock <= dr_lock4)
508 {
509 if ( ! (gamestate.keys & (1 << (lock-dr_lock1) ) ) )
510 {
511 SD_PlaySound (NOWAYSND); // locked
512 return;
513 }
514 }
515
516 switch (doorobjlist[door].action)
517 {
518 case dr_closed:
519 case dr_closing:
520 OpenDoor (door);
521 break;
522 case dr_open:
523 case dr_opening:
524 CloseDoor (door);
525 break;
526 }
527 }
528
529 /*
530 ===============
531 =
532 = DoorOpen
533 =
534 = Close the door after three seconds
535 =
536 ===============
537 */
538
0933d390 »
2007-07-29 Reduce object memory use.
539 void DoorOpen (myint door)
95189b30 »
2007-07-29 Import
540 {
541 if ( (doorobjlist[door].ticcount += tics) >= OPENTICS)
542 CloseDoor (door);
543 }
544
545
546
547 /*
548 ===============
549 =
550 = DoorOpening
551 =
552 ===============
553 */
554
0933d390 »
2007-07-29 Reduce object memory use.
555 void DoorOpening(myint door)
95189b30 »
2007-07-29 Import
556 {
557 long position;
558
559 position = doorposition[door];
560 if (!position)
561 {
562 //
563 // door is just starting to open, so connect the areas
564 //
0e2d09ac »
2007-08-04 Remove areaconnect.
565 // Open the door slightly.
566 doorposition[door] = 1;
567 ConnectAreas (false);
568 #ifdef ENABLE_AUDIO
891c041b »
2007-08-03 Shrink areabyplayer.
569 if (getareabyplayer(area1))
95189b30 »
2007-07-29 Import
570 {
571 PlaySoundLocTile(OPENDOORSND,doorobjlist[door].tilex,doorobjlist[door].tiley); // JAB
572 }
0e2d09ac »
2007-08-04 Remove areaconnect.
573 #endif
95189b30 »
2007-07-29 Import
574 }
575
576 //
577 // slide the door by an adaptive amount
578 //
579 position += tics<<10;
580 if (position >= 0xffff)
581 {
582 //
583 // door is all the way open
584 //
585 position = 0xffff;
586 doorobjlist[door].ticcount = 0;
587 doorobjlist[door].action = dr_open;
0a247d1f »
2007-08-02 Shrink actorat array.
588 clear_actor(doorobjlist[door].tilex, doorobjlist[door].tiley);
95189b30 »
2007-07-29 Import
589 }
590
591 doorposition[door] = position;
592 }
593
594
595 /*
596 ===============
597 =
598 = DoorClosing
599 =
600 ===============
601 */
602
0933d390 »
2007-07-29 Reduce object memory use.
603 void DoorClosing(myint door)
95189b30 »
2007-07-29 Import
604 {
605 long position;
0933d390 »
2007-07-29 Reduce object memory use.
606 myint tilex,tiley;
95189b30 »
2007-07-29 Import
607
608 tilex = doorobjlist[door].tilex;
609 tiley = doorobjlist[door].tiley;
610
0a247d1f »
2007-08-02 Shrink actorat array.
611 if (obj_actor_at(tilex, tiley)
95189b30 »
2007-07-29 Import
612 || (player->tilex == tilex && player->tiley == tiley) )
613 { // something got inside the door
614 OpenDoor(door);
615 return;
616 };
617
618 position = doorposition[door];
619
620 //
621 // slide the door by an adaptive amount
622 //
623 position -= tics<<10;
624 if (position <= 0)
625 {
626 //
627 // door is closed all the way, so disconnect the areas
628 //
0e2d09ac »
2007-08-04 Remove areaconnect.
629 doorposition[door] = 0;
95189b30 »
2007-07-29 Import
630
631 doorobjlist[door].action = dr_closed;
632
0e2d09ac »
2007-08-04 Remove areaconnect.
633 ConnectAreas (true);
634 } else {
635 doorposition[door] = position;
95189b30 »
2007-07-29 Import
636 }
637 }
638
639 /*
640 =====================
641 =
642 = MoveDoors
643 =
644 = Called from PlayLoop
645 =
646 =====================
647 */
648
649 void MoveDoors()
650 {
0933d390 »
2007-07-29 Reduce object memory use.
651 myint door;
95189b30 »
2007-07-29 Import
652
653 if (gamestate.victoryflag) // don't move door during victory sequence
654 return;
655
656 for (door = 0 ; door < doornum ; door++)
657 switch(doorobjlist[door].action)
658 {
659 case dr_open:
660 DoorOpen (door);
661 break;
662
663 case dr_opening:
664 DoorOpening(door);
665 break;
666
667 case dr_closing:
668 DoorClosing(door);
669 break;
670 default:
671 break;
672 }
673 }
674
675
676 /*
677 =============================================================================
678
679 PUSHABLE WALLS
680
681 =============================================================================
682 */
683
6360ea68 »
2007-07-29 Reduce size of door state.
684 umyshort pwallstate;
685 umyshort pwallpos; // amount a pushable wall has been moved (0-63)
686 umyshort pwallx, pwally;
0933d390 »
2007-07-29 Reduce object memory use.
687 myint pwalldir;
95189b30 »
2007-07-29 Import
688
689 /*
690 ===============
691 =
692 = PushWall
693 =
694 ===============
695 */
696
0933d390 »
2007-07-29 Reduce object memory use.
697 void PushWall(myint checkx, myint checky, myint dir)
95189b30 »
2007-07-29 Import
698 {
0933d390 »
2007-07-29 Reduce object memory use.
699 myint oldtile;
95189b30 »
2007-07-29 Import
700
701 if (pwallstate)
702 return;
703
704 oldtile = tilemap[checkx][checky];
705 if (!oldtile)
706 return;
707
708 switch (dir)
709 {
710 case di_north:
0a247d1f »
2007-08-02 Shrink actorat array.
711 if (any_actor_at(checkx, checky-1))
95189b30 »
2007-07-29 Import
712 {
713 SD_PlaySound(NOWAYSND);
714 return;
715 }
716 actorat[checkx][checky-1] = tilemap[checkx][checky-1] = oldtile;
717 break;
718
719 case di_east:
0a247d1f »
2007-08-02 Shrink actorat array.
720 if (any_actor_at(checkx+1, checky))
95189b30 »
2007-07-29 Import
721 {
722 SD_PlaySound(NOWAYSND);
723 return;
724 }
725 actorat[checkx+1][checky] = tilemap[checkx+1][checky] = oldtile;
726 break;
727
728 case di_south:
0a247d1f »
2007-08-02 Shrink actorat array.
729 if (any_actor_at(checkx, checky+1))
95189b30 »
2007-07-29 Import
730 {
731 SD_PlaySound(NOWAYSND);
732 return;
733 }
734 actorat[checkx][checky+1] = tilemap[checkx][checky+1] = oldtile;
735 break;
736
737 case di_west:
0a247d1f »
2007-08-02 Shrink actorat array.
738 if (any_actor_at(checkx-1, checky))
95189b30 »
2007-07-29 Import
739 {
740 SD_PlaySound(NOWAYSND);
741 return;
742 }
743 actorat[checkx-1][checky] = tilemap[checkx-1][checky] = oldtile;
744 break;
745 }
746
282d8012 »
2007-08-19 Disable more stats code.
747 #ifdef ENABLE_STATS
95189b30 »
2007-07-29 Import
748 gamestate.secretcount++;
282d8012 »
2007-08-19 Disable more stats code.
749 #endif
95189b30 »
2007-07-29 Import
750 pwallx = checkx;
751 pwally = checky;
752 pwalldir = dir;
753 pwallstate = 1;
754 pwallpos = 0;
755 tilemap[pwallx][pwally] |= 0xc0;
2a90e2c2 »
2007-08-04 Shrink mapseg.
756 setmapspecial(pwallx, pwally, 0);
95189b30 »
2007-07-29 Import
757
758 SD_PlaySound(PUSHWALLSND);
759 }
760
761
762
763 /*
764 =================
765 =
766 = MovePWalls
767 =
768 =================
769 */
770
771 void MovePWalls()
772 {
0933d390 »
2007-07-29 Reduce object memory use.
773 myint oldblock, oldtile;
95189b30 »
2007-07-29 Import
774
775 if (!pwallstate)
776 return;
777
778 oldblock = pwallstate/128;
779
780 pwallstate += tics;
781
782 if (pwallstate/128 != oldblock)
783 {
784 // block crossed into a new block
785 oldtile = tilemap[pwallx][pwally] & 63;
786
787 //
788 // the tile can now be walked into
789 //
790 tilemap[pwallx][pwally] = 0;
0a247d1f »
2007-08-02 Shrink actorat array.
791 clear_actor(pwallx, pwally);
0e614208 »
2007-08-01 Statically allocate map planes.
792 *(mapseg0+farmapylookup(pwally)+pwallx) = player->areanumber+AREATILE;
95189b30 »
2007-07-29 Import
793
794 //
795 // see if it should be pushed farther
796 //
797 if (pwallstate>256)
798 {
799 //
800 // the block has been pushed two tiles
801 //
802 pwallstate = 0;
803 return;
804 }
805 else
806 {
807 switch (pwalldir)
808 {
809 case di_north:
810 pwally--;
0a247d1f »
2007-08-02 Shrink actorat array.
811 if (any_actor_at(pwallx, pwally-1))
95189b30 »
2007-07-29 Import
812 {
813 pwallstate = 0;
814 return;
815 }
816 actorat[pwallx][pwally-1] =
817 tilemap[pwallx][pwally-1] = oldtile;
818 break;
819
820 case di_east:
821 pwallx++;
0a247d1f »
2007-08-02 Shrink actorat array.
822 if (any_actor_at(pwallx+1, pwally))
95189b30 »
2007-07-29 Import
823 {
824 pwallstate = 0;
825 return;
826 }
827 actorat[pwallx+1][pwally] =
828 tilemap[pwallx+1][pwally] = oldtile;
829 break;
830
831 case di_south:
832 pwally++;
0a247d1f »
2007-08-02 Shrink actorat array.
833 if (any_actor_at(pwallx, pwally+1))
95189b30 »
2007-07-29 Import
834 {
835 pwallstate = 0;
836 return;
837 }
838 actorat[pwallx][pwally+1] =
839 tilemap[pwallx][pwally+1] = oldtile;
840 break;
841
842 case di_west:
843 pwallx--;
0a247d1f »
2007-08-02 Shrink actorat array.
844 if (any_actor_at(pwallx-1, pwally))
95189b30 »
2007-07-29 Import
845 {
846 pwallstate = 0;
847 return;
848 }
849 actorat[pwallx-1][pwally] =
850 tilemap[pwallx-1][pwally] = oldtile;
851 break;
852 }
853
854 tilemap[pwallx][pwally] = oldtile | 0xc0;
855 }
856 }
857
858 pwallpos = (pwallstate/2)&63;
859
860 }
Something went wrong with that request. Please try again.