changed frame counter for EM engine counting upward instead of downward
authorHolger Schemel <info@artsoft.org>
Tue, 18 Feb 2020 15:37:17 +0000 (16:37 +0100)
committerHolger Schemel <info@artsoft.org>
Tue, 19 May 2020 16:19:58 +0000 (18:19 +0200)
src/game_em/game.c
src/game_em/graphics.c
src/game_em/logic.c
src/tools.c

index 48d1bfc1b42282897fdfa2c990eb6db6305af736..7842a89c5dd7b0b0ad69f897386c4caa5dfcfed0 100644 (file)
@@ -83,7 +83,7 @@ void GameActions_EM(byte action[MAX_PLAYERS], boolean warp_mode)
 
   game_em.random = game_em.random * 129 + 1;
 
-  frame = (frame - 1) & 7;
+  frame = (frame + 1) % 8;
 
   for (i = 0; i < MAX_PLAYERS; i++)
     readjoy(action[i], &ply[i]);
index 15b706602d52de900a8774e15eca2c2b9312eba4..972e0d94678ca5af2253a897a52cf30d88d7c3b9 100644 (file)
 #define VALID_SCREEN_Y(y)      ((y) < MIN_SCREEN_Y ? MIN_SCREEN_Y :    \
                                 (y) > MAX_SCREEN_Y ? MAX_SCREEN_Y : (y))
 
-#define PLAYER_SCREEN_X(p)     (((    frame) * ply[p].oldx +           \
-                                 (8 - frame) * ply[p].x) * TILEX / 8   \
+#define PLAYER_SCREEN_X(p)     (((7 - frame) * ply[p].oldx +           \
+                                 (1 + frame) * ply[p].x) * TILEX / 8   \
                                 - ((SCR_FIELDX - 1) * TILEX) / 2)
-#define PLAYER_SCREEN_Y(p)     (((    frame) * ply[p].oldy +           \
-                                 (8 - frame) * ply[p].y) * TILEY / 8   \
+#define PLAYER_SCREEN_Y(p)     (((7 - frame) * ply[p].oldy +           \
+                                 (1 + frame) * ply[p].y) * TILEY / 8   \
                                 - ((SCR_FIELDY - 1) * TILEY) / 2)
 
 #define USE_EXTENDED_GRAPHICS_ENGINE           1
@@ -122,7 +122,7 @@ static struct GraphicInfo_EM *getObjectGraphic(int x, int y)
   struct GraphicInfo_EM *g = &graphic_info_em_object[tile][frame];
 
   if (!game.use_native_emc_graphics_engine)
-    getGraphicSourceObjectExt_EM(g, tile, 7 - frame, x - lev.left, y - lev.top);
+    getGraphicSourceObjectExt_EM(g, tile, frame, x - lev.left, y - lev.top);
 
   return g;
 }
@@ -132,7 +132,7 @@ static struct GraphicInfo_EM *getPlayerGraphic(int player_nr, int anim)
   struct GraphicInfo_EM *g = &graphic_info_em_player[player_nr][anim][frame];
 
   if (!game.use_native_emc_graphics_engine)
-    getGraphicSourcePlayerExt_EM(g, player_nr, anim, 7 - frame);
+    getGraphicSourcePlayerExt_EM(g, player_nr, anim, frame);
 
   return g;
 }
@@ -312,7 +312,7 @@ static void animscreen(void)
     for (y = lev.top; y < lev.bottom; y++)
       for (x = lev.left; x < lev.right; x++)
        SetGfxAnimation_EM(&graphic_info_em_object[lev.draw[x][y]][frame],
-                          lev.draw[x][y], 7 - frame,
+                          lev.draw[x][y], frame,
                           x - lev.left, y - lev.top);
 
   for (y = top; y < top + MAX_BUF_YSIZE; y++)
@@ -377,8 +377,8 @@ static void blitplayer(struct PLAYER *ply)
     return;
 
   /* x1/y1 are left/top and x2/y2 are right/down part of the player movement */
-  x1 = (frame * ply->oldx + (8 - frame) * ply->x) * TILEX / 8;
-  y1 = (frame * ply->oldy + (8 - frame) * ply->y) * TILEY / 8;
+  x1 = ((7 - frame) * ply->oldx + (1 + frame) * ply->x) * TILEX / 8;
+  y1 = ((7 - frame) * ply->oldy + (1 + frame) * ply->y) * TILEY / 8;
   x2 = x1 + TILEX - 1;
   y2 = y1 + TILEY - 1;
 
@@ -388,8 +388,8 @@ static void blitplayer(struct PLAYER *ply)
     /* some casts to "int" are needed because of negative calculation values */
     int dx = (int)ply->x - (int)ply->oldx;
     int dy = (int)ply->y - (int)ply->oldy;
-    int old_x = (int)ply->oldx + (7 - (int)frame) * dx / 8;
-    int old_y = (int)ply->oldy + (7 - (int)frame) * dy / 8;
+    int old_x = (int)ply->oldx + (int)frame * dx / 8;
+    int old_y = (int)ply->oldy + (int)frame * dy / 8;
     int new_x = old_x + SIGN(dx);
     int new_y = old_y + SIGN(dy);
     int old_sx = old_x % MAX_BUF_XSIZE;
@@ -436,7 +436,7 @@ void game_initscreen(void)
   int player_nr;
   int x,y;
 
-  frame = 6;
+  frame = 1;
 
   player_nr = (game.centered_player_nr != -1 ? game.centered_player_nr : 0);
 
index bbac90d27f74286990811db67b35b7244c83fe1e..2e959ffeeea12a38deb8a2f9113463a9b54fbcef 100644 (file)
@@ -7435,13 +7435,13 @@ static void logic_globals(void)
 
 void logic(void)
 {
-  if (frame == 7)
+  if (frame == 0)
   {
     logic_players();
     logic_objects();
   }
 
-  if (frame == 6)
+  if (frame == 1)
   {
     logic_globals();
   }
index 83620631c3ea9a8873936122d7b7a1b087f7c6bd..8b8f2a95b43183d4ac7250ab66917eea751d5b2b 100644 (file)
@@ -8701,7 +8701,7 @@ void InitGraphicInfo_EM(void)
       boolean has_action_graphics = (graphic != base_graphic);
       boolean has_crumbled_graphics = (base_crumbled != base_graphic);
       struct GraphicInfo *g = &graphic_info[graphic];
-      struct GraphicInfo_EM *g_em = &graphic_info_em_object[i][7 - j];
+      struct GraphicInfo_EM *g_em = &graphic_info_em_object[i][j];
       Bitmap *src_bitmap;
       int src_x, src_y;
       // ensure to get symmetric 3-frame, 2-delay animations as used in EM
@@ -8932,8 +8932,8 @@ void InitGraphicInfo_EM(void)
                 Xspring);
 
        // no separate animation for "smashed by rock" -- use rock instead
-       struct GraphicInfo_EM *g_em = &graphic_info_em_object[i][7 - j];
-       struct GraphicInfo_EM *g_xx = &graphic_info_em_object[e][7 - j];
+       struct GraphicInfo_EM *g_em = &graphic_info_em_object[i][j];
+       struct GraphicInfo_EM *g_xx = &graphic_info_em_object[e][j];
 
        g_em->bitmap            = g_xx->bitmap;
        g_em->src_x             = g_xx->src_x;
@@ -8969,7 +8969,7 @@ void InitGraphicInfo_EM(void)
                       el_act_dir2img(effective_element, effective_action,
                                      direction));
        struct GraphicInfo *g = &graphic_info[graphic];
-       struct GraphicInfo_EM *g_em = &graphic_info_em_player[p][i][7 - j];
+       struct GraphicInfo_EM *g_em = &graphic_info_em_player[p][i][j];
        Bitmap *src_bitmap;
        int src_x, src_y;
        int sync_frame = j;