git » fp-git.git » commit 8200bcd

all drawing macros receives x,y as the first arguments

author ecalot
2005-03-05 10:23:07 UTC
committer ecalot
2005-03-05 10:23:07 UTC
parent 69d445c6504fcdb9165ac4a734c33ab29f3432c6

all drawing macros receives x,y as the first arguments

FP/src/include/room.h +67 -67
FP/src/ker/room.c +21 -21

diff --git a/FP/src/include/room.h b/FP/src/include/room.h
index 8844b50..9639603 100644
--- a/FP/src/include/room.h
+++ b/FP/src/include/room.h
@@ -49,46 +49,46 @@ void roomKidChangedFloor(tRoom* room, tObject* kid);
 #define drawAllLeft(x,y,left,tile) \
 	/* Gate/left */\
 	if (isIn(left,TILES_DOOR)) {\
-		e(15,(x)+0,(y)+2);\
+		e((x)+0,(y)+2,15);\
 		drawGate((x)+0,(y)-TILE_H+3,gateGetFrame(left));\
 	}\
 	/* normal/left */\
 	if (isIn(left,TILES_FLOOR)) \
-		e(10,(x)+0,(y)+2);\
+		e((x)+0,(y)+2,10);\
 	/* loose moving/left */\
 	if (isIn(left,TILES_LOOSEMOVING)) \
 		drawLoose((x)+0,(y)+2,looseGetFrame(left),layTritop);\
 	/* exit_left/left */\
 	if (isIn(left,TILE_EXIT_RIGHT)) \
-		e(7,(x)+0,(y)+2);\
+		e((x)+0,(y)+2,7);\
 	/* pillar/left */\
 	if (isIn(left,TILES_PILLAR)) \
-		e(44,(x)+0,(y)+2);\
+		e((x)+0,(y)+2,44);\
 	/* pillar_big_up/left */\
 	if (isIn(left,TILE_BP_BOTTOM)) \
-		e(83,(x)+0,(y)+2);\
+		e((x)+0,(y)+2,83);\
 	if (isIn(left,TILE_BP_TOP)) \
-		e(85,(x)+0,(y)+3);\
+		e((x)+0,(y)+3,85);\
 	/* pressable/left */\
 	if (isIn(left,TILES_RAISE_PRESSED)) \
-		e(10,(x)+0,(y)+2);\
+		e((x)+0,(y)+2,10);\
 	if (isIn(left,TILES_RAISE_UNPRESSED)) \
-		e(10,(x)+0,(y)+1);\
+		e((x)+0,(y)+1,10);\
 	if (isIn(left,TILES_DROP_PRESSED)) \
-		e(10,(x)+0,(y)+3);\
+		e((x)+0,(y)+3,10);\
 	if (isIn(left,TILES_DROP_UNPRESSED)) \
-		e(10,(x)+0,(y)+2);\
+		e((x)+0,(y)+2,10);\
 	/* debris/left */\
 	if (isIn(left,TILES_BROKENTILE)) \
-		e(49,(x)+0,(y)+2);\
+		e((x)+0,(y)+2,49);\
 	/* spikes/left */\
 	if (isIn(left,TILES_SPIKES)) {\
-		e(107,(x)+0,(y)+2);\
+		e((x)+0,(y)+2,107);\
 		drawSpike((x)-TILE_W+0,(y),spikeGetFrame(left),layRight);\
 	}\
 	/* skeleton/left */\
 	if (isIn(left,TILES_SKELETON)) \
-		e(81,(x)+0,(y)+2);\
+		e((x)+0,(y)+2,81);\
 	/* sword/left */\
 	if (isIn(left,TILES_SWORD)) \
 		drawSword((x)-15,(y)-4);\
@@ -108,76 +108,76 @@ void roomKidChangedFloor(tRoom* room, tObject* kid);
 #define drawAllTile(x,y,left,tile) \
 	/* Wall/left */\
 	if ((!isIn(tile,TILES_WALL))&&(isIn(left,TILES_WALL))) \
-		e(63,(x)+0,(y)+2);\
+		e((x)+0,(y)+2,63);\
 	/* torch/this */\
 	if (isIn(tile,TILES_TORCH)) { /* animation */\
 		drawTorchFire((x)+11+TILE_W,(y)-39); \
 		/* base */\
-		e(56,(x)+3+TILE_W,(y)-24);\
+		e((x)+3+TILE_W,(y)-24,56);\
 	}\
 	/* chopper/this */\
 	if (isIn(tile,TILE_CHOPPER)) \
 		drawChopper((x)+0,(y),chopperGetFrame(tile),layCBack);\
 	/* empty_bricks/this */\
 	if (isIn(tile,TILES_BRICKE1)) \
-		e(52,(x)+TILE_W+0,(y)-18);\
+		e((x)+TILE_W+0,(y)-18,52);\
 	if (isIn(tile,TILES_BRICKE2)) \
-		e(53,(x)+TILE_W+0,(y)-18);\
+		e((x)+TILE_W+0,(y)-18,53);\
 	if (isIn(tile,TILES_WINDOW)) \
-		e(54,(x)+TILE_W+0,(y)-18);\
+		e((x)+TILE_W+0,(y)-18,54);\
 	/* floor_bricks/this */\
 	if (isIn(tile,TILES_BRICKF1)) \
-		e(12,(x)+TILE_W+0,(y)-18);\
+		e((x)+TILE_W+0,(y)-18,12);\
 	if (isIn(tile,TILES_BRICKF2)) \
-		e(13,(x)+TILE_W+0,(y)-18);\
+		e((x)+TILE_W+0,(y)-18,13);\
 	/* gate/this */\
 	if (isIn(tile,TILES_DOOR)) \
-		e(14,(x)+0,(y)+0);\
+		e((x)+0,(y)+0,14);\
 	/* gate_frame/this */\
 	if (isIn(tile,TILES_GATEFRAME)) \
-		e(17,(x)+24,(y)+0);\
+		e((x)+24,(y)+0,17);\
 	/* normal/this */\
 	if (isIn(tile,TILES_FLOOR)) \
-		e(9,(x)+0,(y)+0);\
+		e((x)+0,(y)+0,9);\
 	/* loose moving/this */\
 	if (isIn(tile,TILES_LOOSEMOVING)) \
 		drawLoose((x)+0,(y)+0,looseGetFrame(tile),layTribot);\
 	/* exit_left/this */\
 	if (isIn(tile,TILE_EXIT_RIGHT)) \
-		e(5,(x)+0,(y)+0);\
+		e((x)+0,(y)+0,5);\
 	if (isIn(tile,TILE_EXIT_LEFT)) {\
-		e(9,(x)+0,(y)+0);\
+		e((x)+0,(y)+0,9);\
 		drawExit((x)+TILE_W+8,(y)-TILE_H-1,gateGetFrame(tile));\
 	}\
 	/* pillar/this */\
 	if (isIn(tile,TILES_PILLAR)) \
-		e(43,(x)+0,(y)+0);\
+		e((x)+0,(y)+0,43);\
 	/* big_pillar/this */\
 	if (isIn(tile,TILE_BP_BOTTOM)) \
-		e(82,(x)+0,(y)+0);\
+		e((x)+0,(y)+0,82);\
 	if (isIn(tile,TILE_BP_TOP)) \
-		e(87,(x)+8,(y)+3);\
+		e((x)+8,(y)+3,87);\
 	/* pressable/this */\
 	/* TODO: use boolean algebra to simplify this */\
 	if (isIn(tile,TILES_RAISE_UNPRESSED)&&isIn(left,TILES_WALKABLE)&&(!isIn(left,TILES_RAISE)))\
-		e(57,(x)+0,(y));\
+		e((x)+0,(y),57);\
 	if ((isIn(tile,TILES_RAISE)&&((!isIn(tile,TILES_UNPRESSED))||(!isIn(left,TILES_WALKABLE))||isIn(left,TILES_RAISE)))&&(isIn(tile,TILES_UNPRESSED))) \
-		e(58,(x)+0,(y));\
+		e((x)+0,(y),58);\
 	if (((isIn(tile,TILES_RAISE)&&((!isIn(tile,TILES_UNPRESSED))||(!isIn(left,TILES_WALKABLE))||isIn(left,TILES_RAISE)))&&(!isIn(tile,TILES_UNPRESSED)))||isIn(tile,TILES_DROP_UNPRESSED))\
-		e(58,(x)+0,(y)+1);\
+		e((x)+0,(y)+1,58);\
 	if (isIn(tile,TILES_DROP_PRESSED)) \
-		e(58,(x)+0,(y)+2);\
+		e((x)+0,(y)+2,58);\
 	/* debris/this */\
 	if (isIn(tile,TILES_BROKENTILE)) \
-		e(48,(x)+0,(y)+0);\
+		e((x)+0,(y)+0,48);\
 	/* spikes/this */\
 	if (isIn(tile,TILES_SPIKES)) {\
-		e(101,(x)+0,(y)+0);\
+		e((x)+0,(y)+0,101);\
 		drawSpike((x)+0,(y),spikeGetFrame(tile),layBack);\
 	}\
 	/* skeleton/this */\
 	if (isIn(tile,TILES_SKELETON)) \
-		e(80,(x)+0,(y)+0);
+		e((x)+0,(y)+0,80);
 
 #define drawAllBack(x,y,left,tile,right,dleft) \
 	/* loose moving */\
@@ -186,95 +186,95 @@ void roomKidChangedFloor(tRoom* room, tObject* kid);
 	/* normal */\
 	if (isIn(tile,TILES_PRESSABLE)) \
 		/* TODO: drop has resource 59 for unpressed/raise 47? checkgame */\
-		e(59,(x)+0,(y)+(isIn(tile,TILES_UNPRESSED)?3:4));\
+		e((x)+0,(y)+(isIn(tile,TILES_UNPRESSED)?3:4),59);\
 	if (isIn(tile,TILES_WALKABLE)&&(!isIn(tile,TILES_LOOSEMOVING))&&(!isIn(tile,TILES_PRESSABLE)))\
-		e(11,(x)+0,(y)+3);\
+		e((x)+0,(y)+3,11);\
 	/* wall */\
 	/* there are 4 cases */\
 	if (wallCase(WALL_LOC_WWW))\
-		e(65,(x)+0,(y)+3);\
+		e((x)+0,(y)+3,65);\
 	if (wallCase(WALL_LOC_SWW))\
-		e(71,(x)+0,(y)+3);\
+		e((x)+0,(y)+3,71);\
 	if (wallCase(WALL_LOC_WWS))\
-		e(67,(x)+0,(y)+3);\
+		e((x)+0,(y)+3,67);\
 	if (wallCase(WALL_LOC_SWS))\
-		e(69,(x)+0,(y)+3);\
+		e((x)+0,(y)+3,69);\
 	/* empty */\
 	/* tile, dleft*/\
 	\
 	/* gate_frame/this */\
 	if (isIn(tile,TILES_SPACE)&&isIn(tile,TILES_GATEFRAME)) \
-		e(42,(x)+0,(y)+3);\
+		e((x)+0,(y)+3,42);\
 	/* gate/left */\
 	if (isIn(tile,TILES_SPACE)&&isIn(dleft,TILES_DOOR)) \
-		e(16,(x)+0,(y)+3);\
+		e((x)+0,(y)+3,16);\
 	/* big_pillar/left */\
 	if (isIn(tile,TILES_SPACE)&&isIn(dleft,TILE_BP_TOP)) \
-		e(86,(x)+0,(y)+3);\
+		e((x)+0,(y)+3,86);\
 	/* pillar/left */\
 	if (isIn(tile,TILES_SPACE)&&isIn(dleft,TILES_PILLAR)) \
-		e(45,(x)+0,(y)+3);\
+		e((x)+0,(y)+3,45);\
 	/* wall/left */\
 	if (isIn(tile,TILES_SPACE)&&isIn(dleft,TILES_WALL)) \
-		e(64,(x)+0,(y)+3);\
+		e((x)+0,(y)+3,64);\
 \
 	/* upper objects */\
 	if (isIn(tile,TILE_EXIT_LEFT)) \
-		e(6,(x)+0+TILE_W,(y)-TILE_H+3);\
+		e((x)+0+TILE_W,(y)-TILE_H+3,6);\
 	if (isIn(tile,TILE_EXIT_RIGHT)) \
-		e(8,(x)+0+TILE_W,(y)-TILE_H+3);
+		e((x)+0+TILE_W,(y)-TILE_H+3,8);
 
 
 #define drawAllFore(x,y,left,tile,right) \
 	/* pillar */\
 	if (isIn(tile,TILES_PILLAR)) \
-		e(46,(x)+8,(y)+0);\
+		e((x)+8,(y)+0,46);\
 	/* big pillar */\
 	if (isIn(tile,TILE_BP_BOTTOM)) \
-		e(84,(x)+8,(y)+0);\
+		e((x)+8,(y)+0,84);\
 	/* wall */\
 	/* there are 4 cases */\
 	if (wallCase(WALL_LOC_WWW))\
-		e(66,(x)+0,(y)+0);\
+		e((x)+0,(y)+0,66);\
 	if (wallCase(WALL_LOC_SWW))\
-		e(72,(x)+0,(y)+0);\
+		e((x)+0,(y)+0,72);\
 	if (wallCase(WALL_LOC_WWS))\
-		e(68,(x)+0,(y)+0);\
+		e((x)+0,(y)+0,68);\
 	if (wallCase(WALL_LOC_SWS))\
-		e(70,(x)+0,(y)+0);\
+		e((x)+0,(y)+0,70);\
 		\
 	/* the seed generation algorithm */\
 	/* Upper row */\
 	if (wallGetInfo(WALL_TABLE_LINE1_DARKER))\
-		e(75,(x)+0,(y)-39);\
+		e((x)+0,(y)-39,75);\
 	if (wallGetInfo(WALL_TABLE_LINE1_LEFT_DOWN))\
-		e(77,(x)+0,(y)-39);\
+		e((x)+0,(y)-39,77);\
 	if (wallGetInfo(WALL_TABLE_LINE1_RIGHT_DOWN))\
-		e(79,(x)+24,(y)-39);\
+		e((x)+24,(y)-39,79);\
 	if (wallGetInfo(WALL_TABLE_LINE1_RIGHT_UP))\
-		e(78,(x)+24,(y)-49);\
+		e((x)+24,(y)-49,78);\
 	if (wallGetInfo(WALL_TABLE_LINE1_LEFT_UP))\
-		e(76,(x)+0,(y)-54);\
+		e((x)+0,(y)-54,76);\
 	/* Second row */\
 	if (isIn(tile,TILES_WALL))\
-		e(74-wallGetInfo(WALL_TABLE_LINE2_SEP),(x)+7+wallGetInfo(WALL_TABLE_LINE2_OFFSET),(y)-18);\
+		e((x)+7+wallGetInfo(WALL_TABLE_LINE2_OFFSET),(y)-18,74-wallGetInfo(WALL_TABLE_LINE2_SEP));\
 	if (wallGetInfo(WALL_TABLE_LINE2_LEFT_DOWN))\
-		e(77,(x)+7+wallGetInfo(WALL_TABLE_LINE2_OFFSET)+5,(y)-39+21);\
+		e((x)+7+wallGetInfo(WALL_TABLE_LINE2_OFFSET)+5,(y)-39+21,77);\
 	if (wallGetInfo(WALL_TABLE_LINE2_RIGHT_DOWN))\
-		e(79,(x)+24+7+wallGetInfo(WALL_TABLE_LINE2_OFFSET)-32+5,(y)-39+21);\
+		e((x)+24+7+wallGetInfo(WALL_TABLE_LINE2_OFFSET)-32+5,(y)-39+21,79);\
 	if (wallGetInfo(WALL_TABLE_LINE2_RIGHT_UP))\
-		e(78,(x)+24+7+wallGetInfo(WALL_TABLE_LINE2_OFFSET)-32+5,(y)-49+21);\
+		e((x)+24+7+wallGetInfo(WALL_TABLE_LINE2_OFFSET)-32+5,(y)-49+21,78);\
 	if (wallGetInfo(WALL_TABLE_LINE2_LEFT_UP))\
-		e(76,(x)+7+wallGetInfo(WALL_TABLE_LINE2_OFFSET)+5,(y)-54+21);\
+		e((x)+7+wallGetInfo(WALL_TABLE_LINE2_OFFSET)+5,(y)-54+21,76);\
 	/* Third row TODO: send to BottomTile */\
 	if (isIn(tile,TILES_WALL))\
-		e(74-wallGetInfo(WALL_TABLE_LINE3_SEP),(x)+3+wallGetInfo(WALL_TABLE_LINE3_OFFSET),(y)+3);\
+		e((x)+3+wallGetInfo(WALL_TABLE_LINE3_OFFSET),(y)+3,74-wallGetInfo(WALL_TABLE_LINE3_SEP));\
 	if (wallGetInfo(WALL_TABLE_LINE3_LEFT_UP))\
-		e(76,(x)+5+wallGetInfo(WALL_TABLE_LINE3_OFFSET)+5,(y)-55+21*2);\
+		e((x)+5+wallGetInfo(WALL_TABLE_LINE3_OFFSET)+5,(y)-55+21*2,76);\
 \
 	/* debris/this foreground layer */\
 	if (isIn(tile,TILES_BROKENTILE)) \
-		e(51,(x)+0,(y)+0);\
+		e((x)+0,(y)+0,51);\
 	/* spikes/this foreground layer */\
 	if (isIn(tile,TILES_SPIKES)) \
 		drawSpike((x)+0,(y)+0,spikeGetFrame(tile),layFore);\
diff --git a/FP/src/ker/room.c b/FP/src/ker/room.c
index e8171f5..72adf60 100644
--- a/FP/src/ker/room.c
+++ b/FP/src/ker/room.c
@@ -144,7 +144,7 @@ int wallGetCase(tTile left, tTile tile, tTile right) {
  * Drawing functions
  */
 
-#define e(a,x,y) outputDrawBitmap(roomGfx.environment->pFrames[a],(x),(y))
+#define e(x,y,a) outputDrawBitmap(roomGfx.environment->pFrames[a],(x),(y))
 
 /*#define isIn(a,TILES_UNPRESSED)  (((tPressable*)a.moreInfo)->action==eNormal)*/
 #define chopperGetFrame(a) (((tDanger*)a.moreInfo)->frame)
@@ -189,13 +189,13 @@ void drawLoose(int x, int y, int frame,tLooseLayer layer) {
 		}
 		switch(layer) {
 			case layTritop:
-				e(tritop-3,x,y);
+				e(x,y,tritop-3);
 				break;
 			case layTribot:
-				e(tribot-3,x,y);
+				e(x,y,tribot-3);
 				break;
 			case layBase:
-				e(base-3,x,y);
+				e(x,y,base-3);
 				break;
 		}
 	}
@@ -208,18 +208,18 @@ void drawUnlinkedLoose(int x, int y/*, int frame,tLooseLayer layer*/) {
 	tribot=40;
 /*	switch(layer) {
 		case layTritop:
-			e(tritop-3,x,y);
+			e(x,y,tritop-3);
 			break;
 		case layTribot:
-			e(tribot-3,x,y);
+			e(x,y,tribot-3);
 			break;
 		case layBase:
-			e(base-3,x,y);
+			e(x,y,base-3);
 			break;
 	}*/
-	e(tritop-3,x+TILE_W,y+2);
-	e(tribot-3,x,y);
-	e(base-3,x,y+3);
+	e(x+TILE_W,y+2,tritop-3);
+	e(x,y,tribot-3);
+	e(x,y+3,base-3);
 }
 
 
@@ -228,20 +228,20 @@ void drawGate(int x, int y, int frame) {
 	register int i;
 	register const int mod=frame&7;
 	
-	e(27-mod,x,y+mod);
+	e(x,y+mod,27-mod);
 	for (i=8;i<=frame;i+=8)
-		e(20,x,y+i+mod);
-	e(18,x,y+i+mod+4);
+		e(x,y+i+mod,20);
+	e(x,y+i+mod+4,18);
 }
 
 void drawExit(int x, int y, int frame) {
 	/* Frame defined from 0 (open) to 50 (close) */
 	register int i;
-	if (frame<47) e(55,x,y+47);
-	e(50,x,y+51);
+	if (frame<47) e(x,y+47,55);
+	e(x,y+51,50);
 	for (i=0;i<=frame;i+=4)
-		e(1,x,y+i+(frame&3));
-	e(2,x,y);
+		e(x,y+i+(frame&3),1);
+	e(x,y,2);
 }
 
 typedef enum {layFore=113,layRight=108,layBack=102}tSpikeLayer;
@@ -259,7 +259,7 @@ void drawSpike(int x, int y, int frame, tSpikeLayer layer) {
 				y-=2;
 				break;
 		}
-		e((int)layer+((frame>4)?(6-frame):frame),x,y);
+		e(x,y,(int)layer+((frame>4)?(6-frame):frame));
 	}
 }	
 
@@ -273,12 +273,12 @@ void drawChopper(int x, int y, int frame, tChopperLayer layer) {
 	}
 	switch (layer) { /* TODO: use relative offsets in resources */
 		case layCFore:
-			e(97-frame,x,y);
+			e(x,y,97-frame);
 			break;
 		case layCBack:
-			e(92-frame,x,y);
+			e(x,y,92-frame);
 			if (frame<3)
-				e(100-frame,x,y-60+outputGetHeight(roomGfx.environment->pFrames[100-frame]));
+				e(x,y-60+outputGetHeight(roomGfx.environment->pFrames[100-frame]),100-frame);
 			break;
 	}
 }