author | ecalot
<ecalot> 2004-08-15 16:32:42 UTC |
committer | ecalot
<ecalot> 2004-08-15 16:32:42 UTC |
parent | c92dcd84690033f38f66da3996bd931b23559d41 |
FP/src/include/room.h | +2 | -2 |
FP/src/ker/kernel.c | +1 | -1 |
FP/src/ker/room.c | +23 | -0 |
FP/src/res/maps.c | +5 | -3 |
diff --git a/FP/src/include/room.h b/FP/src/include/room.h index cbfd77b..ae7e730 100644 --- a/FP/src/include/room.h +++ b/FP/src/include/room.h @@ -34,13 +34,12 @@ room.h: FreePrince : Draw Screen #ifndef _ROOM_H_ #define _ROOM_H_ - typedef char tRoomId; typedef unsigned char tTileId; typedef unsigned char tModId; typedef struct { - void* level; + /*tMap*/ void* level; tRoomId id; tRoomId links[4]; tRoomId corners[4]; @@ -67,6 +66,7 @@ typedef struct { tTile roomGetTile(tRoom* room,int x, int y); void roomDrawBackground(tRoom* room); void roomDrawForeground(tRoom* room); +void roomLoadGfx(long environment); /* Only to initialize environment by mapStart */ #endif diff --git a/FP/src/ker/kernel.c b/FP/src/ker/kernel.c index 3b06ed1..8843c9f 100644 --- a/FP/src/ker/kernel.c +++ b/FP/src/ker/kernel.c @@ -73,7 +73,7 @@ int playgame(int optionflag,int level) { kidMove(&kid,key); mapMove(map); /* Drawing functions */ - outputClearScreen(); /* TODO: send to drawScreen(0) */ + outputClearScreen(); /* TODO: send to drawBackground() */ roomDrawBackground(&room); kidDraw(kid); roomDrawForeground(&room); diff --git a/FP/src/ker/room.c b/FP/src/ker/room.c index caa3213..ee7e030 100644 --- a/FP/src/ker/room.c +++ b/FP/src/ker/room.c @@ -105,6 +105,29 @@ tTile roomGetTile(tRoom* room,int x, int y) { } void roomDrawBackground(tRoom* room) { + int x,y; + tTile tile; + tMap* map=room->level; + + for (x=0;x<12;x++) { + for (y=0;y<5;y++) { + tile=roomGetTile(room,x,y); + if (tile.hasTorch) { + outputDrawBitmap( + roomGfx.torch->pFrames[map->time%(roomGfx.torch->frames)], + (x+1)*13, + y*24 + ); + } + if (tile.hasFloor) { + outputDrawBitmap( + roomGfx.environment->pFrames[10], + (x+1)*13, + y*24 + ); + } + } + } } void roomDrawForeground(tRoom* room) { } diff --git a/FP/src/res/maps.c b/FP/src/res/maps.c index caf539f..39b81b6 100644 --- a/FP/src/res/maps.c +++ b/FP/src/res/maps.c @@ -82,7 +82,8 @@ tRoom mapGetRoom(tData* map, tRoomId roomId) { /* SET room id*/ result.id=roomId; - + result.level=map->pFrames; + /* SET room links */ memcpy(result.links,slevel(links)+((roomId-1)*4),4); /* up corners */ @@ -223,11 +224,12 @@ tRoom mapGetRoom(tData* map, tRoomId roomId) { void mapStart(tData* map, tKid* kid, tRoomId *roomId) { /* kid->x,y */ *roomId=slevel(start)[0]; + roomLoadGfx(RES_IMG_ENV_DUNGEON); } void mapMove(tData* map) { - /* slevel(time)++;*/ - + slevel(time)++; + if (slevel(time)==1000) slevel(time)=0; }