author | ecalot
<ecalot> 2004-08-23 19:47:08 UTC |
committer | ecalot
<ecalot> 2004-08-23 19:47:08 UTC |
parent | f44cc927e31568abf535034d25c6dc206252945e |
FP/src/conf/mods.conf | +4 | -0 |
FP/src/include/resources.h | +1 | -1 |
FP/src/include/room.h | +3 | -0 |
FP/src/ker/kid.c | +2 | -1 |
FP/src/ker/object.c | +2 | -1 |
FP/src/ker/room.c | +0 | -2 |
FP/src/res/resources.c | +12 | -3 |
diff --git a/FP/src/conf/mods.conf b/FP/src/conf/mods.conf index bfa4635..e726571 100644 --- a/FP/src/conf/mods.conf +++ b/FP/src/conf/mods.conf @@ -3,3 +3,7 @@ BW 0x02 HAS_D 0x04 HAS_L 0x08 HAS_R 0x10 +WHITE 0x00 +RED 0x20 +GREEN 0x60 +BLUE 0x40 diff --git a/FP/src/include/resources.h b/FP/src/include/resources.h index 4a849ae..4e1320e 100644 --- a/FP/src/include/resources.h +++ b/FP/src/include/resources.h @@ -95,5 +95,5 @@ void resStop(); /* Resource handling includes */ #include "res_conf.h" - +#define BW_COLORS {252/4,252/4,252/4,252/4,0,0,0,252/4,0,0,0,252/4} #endif diff --git a/FP/src/include/room.h b/FP/src/include/room.h index bc8f013..84f35f0 100644 --- a/FP/src/include/room.h +++ b/FP/src/include/room.h @@ -34,6 +34,9 @@ room.h: FreePrince : Draw Screen #ifndef _ROOM_H_ #define _ROOM_H_ +#define TILE_W 32 +#define TILE_H 63 + typedef char tRoomId; typedef unsigned char tTileId; typedef unsigned char tModId; diff --git a/FP/src/ker/kid.c b/FP/src/ker/kid.c index 96153a6..41ee724 100644 --- a/FP/src/ker/kid.c +++ b/FP/src/ker/kid.c @@ -33,6 +33,7 @@ kid.h: Free Prince : Kid object #include "kid.h" #include "output.h" #include "resources.h" /* resLoad/resFree */ +#include "room.h" /* TILE_H */ #include <stdio.h> /* NULL */ static struct { @@ -111,7 +112,7 @@ tKid kidCreate() { } void kidDraw(tKid kid) { - outputDrawBitmap(kid.action->pFrames[kid.frame],kid.location,120+kid.floor*60); /* TODO: use TILE_H */ + outputDrawBitmap(kid.action->pFrames[kid.frame],kid.location,58+kid.floor*TILE_H); /* TODO: use TILE_H */ } int kidMove(tKid* kid,tKey key/*,tRoom room*/) { diff --git a/FP/src/ker/object.c b/FP/src/ker/object.c index 96153a6..41ee724 100644 --- a/FP/src/ker/object.c +++ b/FP/src/ker/object.c @@ -33,6 +33,7 @@ kid.h: Free Prince : Kid object #include "kid.h" #include "output.h" #include "resources.h" /* resLoad/resFree */ +#include "room.h" /* TILE_H */ #include <stdio.h> /* NULL */ static struct { @@ -111,7 +112,7 @@ tKid kidCreate() { } void kidDraw(tKid kid) { - outputDrawBitmap(kid.action->pFrames[kid.frame],kid.location,120+kid.floor*60); /* TODO: use TILE_H */ + outputDrawBitmap(kid.action->pFrames[kid.frame],kid.location,58+kid.floor*TILE_H); /* TODO: use TILE_H */ } int kidMove(tKid* kid,tKey key/*,tRoom room*/) { diff --git a/FP/src/ker/room.c b/FP/src/ker/room.c index 851d651..e6c2262 100644 --- a/FP/src/ker/room.c +++ b/FP/src/ker/room.c @@ -152,8 +152,6 @@ tTile roomGetTile(tRoom* room,int x, int y) { return result; } -#define TILE_W 32 -#define TILE_H 63 /* * Drawing functions diff --git a/FP/src/res/resources.c b/FP/src/res/resources.c index 60a71bc..857be73 100644 --- a/FP/src/res/resources.c +++ b/FP/src/res/resources.c @@ -189,8 +189,17 @@ tData* resLoad(long id) { printf("Fatal error: resLoad: invalid palette\n"); return NULL; } - pal.colors=16; /* TODO: detect when it is 2 colors */ - pal.color=(tColor*)(palette.array+5); /*memcpy(image.pal,data.array+5,16*3);*/ + if (mask&RES_MODS_BW) { /* if black and white */ + /* this palette is white, red, green, blue */ + static const char bwpalettes[]=BW_COLORS; + static char bwpalette[]={0,0,0,0,0,0}; + memcpy(bwpalette,bwpalettes+3*((mask>>5)&3),3); + pal.colors=2; + pal.color=(tColor*)bwpalette; + } else { + pal.colors=16; + pal.color=(tColor*)(palette.array+5); + } for (total=0;total<result->frames;total++) { if(!res_getDataById(res_list[from+2+total],numberOfItems,&raw)) { printf("Fatal Error: resLoad: image not found!\n"); @@ -206,7 +215,7 @@ tData* resLoad(long id) { /* convert image structure into blittable output surfaces */ result->pFrames[total]=(void*)outputLoadBitmap( image.pix,image.widthInBytes*image.height,pal,image.height,image.width, - invert,1,down,invert?right:left + invert,!(mask&RES_MODS_BW),down,invert?right:left ); /* free intermediate image data */