author | ecalot
<ecalot> 2004-08-25 10:55:39 UTC |
committer | ecalot
<ecalot> 2004-08-25 10:55:39 UTC |
parent | eb235f3e425b2d8262577eb56f0269aca593ce2b |
FP/src/include/types.h | +1 | -0 |
FP/src/ker/room.c | +1 | -1 |
FP/src/res/maps.c | +38 | -5 |
diff --git a/FP/src/include/types.h b/FP/src/include/types.h index f42152c..7e96ef4 100644 --- a/FP/src/include/types.h +++ b/FP/src/include/types.h @@ -42,6 +42,7 @@ typedef unsigned char tModId; typedef enum {eOpenTimer,eOpen,eClose,eClosing,eOpening,eClosingFast}tGateAction; typedef struct { + int time; int frame; tGateAction action; } tGate; diff --git a/FP/src/ker/room.c b/FP/src/ker/room.c index 9f8db9b..ed1a436 100644 --- a/FP/src/ker/room.c +++ b/FP/src/ker/room.c @@ -82,8 +82,8 @@ tTile roomGetTile(tRoom* room,int x, int y) { result.hasPillar=0; result.hasBigPillar=0; result.isGate=(result.code==T_GATE); - printf("getting details on gate at %d,%d screen %d, door number %d\n",x,y,roomId,result.back); result.gateInfo=room->level->screenGates[roomId-1][result.back]; + printf("gate@%d,%d. S%d, door=%d fr=%d time=%d action=%d\n",x,y,roomId,result.back,result.gateInfo->frame,result.gateInfo->time,result.gateInfo->action); result.walkable=1; result.hasChopper=0; result.isExit=(result.code==T_EXIT_LEFT)?1:((result.code==T_EXIT_RIGHT)?2:0); diff --git a/FP/src/res/maps.c b/FP/src/res/maps.c index 45ba3d7..0408518 100644 --- a/FP/src/res/maps.c +++ b/FP/src/res/maps.c @@ -259,20 +259,53 @@ void mapStart(tMap* map, tKid* kid, tRoomId *roomId, int level) { } void mapMove(tMap* map) { + int i; slevel(time)++; if (slevel(time)==1000) slevel(time)=0; - + /* check out all the gates in the level */ + for (i=0;i<slevel(totalGates);i++) { + switch (map->gates[i].action) { + case eOpenTimer: + if (map->gates[i].time) { + map->gates[i].time--; + } else { + map->gates[i].action=eClosing; + } + break; + case eOpening: + map->gates[i].time=12*10; + if (map->gates[i].frame) { + map->gates[i].frame--; + } else { + map->gates[i].action=eOpenTimer; + } + break; + case eClosing: + if (map->gates[i].frame!=46) { + map->gates[i].frame++; + } else { + map->gates[i].action=eClose; + } + break; + case eClosingFast: + map->gates[i].frame+=30; + if (map->gates[i].frame>46) { + map->gates[i].action=eClose; + map->gates[i].frame=46; + } + break; + default: + break; + } + } } void mapPressedTile(tMap* map, tTile tile, int s, int x, int y) { if (tile.isPressable) { - tGate* gate; /* drop or raise button */ fprintf(stderr,"mapPressedTile: throw event %d\n",tile.back); do { - gate=map->events[tile.back].gate; - fprintf(stderr,"mapPressedTile: activating door. gate pointer=%p\n",(void*)gate); - /*fprintf(stderr,"mapPressedTile: activating door. status=%d action=%d\n",gate->status,gate->action);*/ + map->events[tile.back].gate->action=eOpening; } while (0&&map->events[tile.back++].triggerNext); }