projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
changed frame counter for EM engine counting upward instead of downward
[rocksndiamonds.git]
/
src
/
game_em
/
graphics.c
diff --git
a/src/game_em/graphics.c
b/src/game_em/graphics.c
index d103de7d7df0029cbe2685a5e44073c2a12f19e4..972e0d94678ca5af2253a897a52cf30d88d7c3b9 100644
(file)
--- a/
src/game_em/graphics.c
+++ b/
src/game_em/graphics.c
@@
-25,11
+25,11
@@
#define VALID_SCREEN_Y(y) ((y) < MIN_SCREEN_Y ? MIN_SCREEN_Y : \
(y) > MAX_SCREEN_Y ? MAX_SCREEN_Y : (y))
#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)
- ((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
- ((SCR_FIELDY - 1) * TILEY) / 2)
#define USE_EXTENDED_GRAPHICS_ENGINE 1
@@
-39,9
+39,13
@@
int frame; /* current screen frame */
int screen_x, screen_y; /* current scroll position */
/* tiles currently on screen */
int screen_x, screen_y; /* current scroll position */
/* tiles currently on screen */
-static int screentiles[MAX_PLAYFIELD_WIDTH + 2][MAX_PLAYFIELD_HEIGHT + 2];
+static int screen
_
tiles[MAX_PLAYFIELD_WIDTH + 2][MAX_PLAYFIELD_HEIGHT + 2];
static int crumbled_state[MAX_PLAYFIELD_WIDTH + 2][MAX_PLAYFIELD_HEIGHT + 2];
static int crumbled_state[MAX_PLAYFIELD_WIDTH + 2][MAX_PLAYFIELD_HEIGHT + 2];
+/* graphic info for game objects/frames and players/actions/frames */
+struct GraphicInfo_EM graphic_info_em_object[TILE_MAX][8];
+struct GraphicInfo_EM graphic_info_em_player[MAX_PLAYERS][PLY_MAX][8];
+
int getFieldbufferOffsetX_EM(void)
{
return screen_x % TILEX;
int getFieldbufferOffsetX_EM(void)
{
return screen_x % TILEX;
@@
-107,7
+111,7
@@
void BlitScreenToBitmap_EM(Bitmap *target_bitmap)
}
}
}
}
-void BackToFront_EM(void)
+
static
void BackToFront_EM(void)
{
BlitBitmap(backbuffer, window, SX, SY, SXSIZE, SYSIZE, SX, SY);
}
{
BlitBitmap(backbuffer, window, SX, SY, SXSIZE, SYSIZE, SX, SY);
}
@@
-118,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)
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;
}
return g;
}
@@
-128,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)
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;
}
return g;
}
@@
-308,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],
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++)
x - lev.left, y - lev.top);
for (y = top; y < top + MAX_BUF_YSIZE; y++)
@@
-343,7
+347,7
@@
static void animscreen(void)
}
}
}
}
- redraw_screen_tile = (screen
tiles[sx][sy]
!= obj ||
+ redraw_screen_tile = (screen
_tiles[sx][sy]
!= obj ||
crumbled_state[sx][sy] != crm);
/* only redraw screen tiles if they (or their crumbled state) changed */
crumbled_state[sx][sy] != crm);
/* only redraw screen tiles if they (or their crumbled state) changed */
@@
-352,7
+356,7
@@
static void animscreen(void)
DrawLevelField_EM(x, y, sx, sy, FALSE);
DrawLevelFieldCrumbled_EM(x, y, sx, sy, crm, FALSE);
DrawLevelField_EM(x, y, sx, sy, FALSE);
DrawLevelFieldCrumbled_EM(x, y, sx, sy, crm, FALSE);
- screentiles[sx][sy] = obj;
+ screen
_
tiles[sx][sy] = obj;
crumbled_state[sx][sy] = crm;
}
}
crumbled_state[sx][sy] = crm;
}
}
@@
-373,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 */
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;
x2 = x1 + TILEX - 1;
y2 = y1 + TILEY - 1;
@@
-384,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;
/* 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;
int new_x = old_x + SIGN(dx);
int new_y = old_y + SIGN(dy);
int old_sx = old_x % MAX_BUF_XSIZE;
@@
-422,8
+426,8
@@
static void blitplayer(struct PLAYER *ply)
}
/* redraw screen tiles in the next frame (player may have left the tiles) */
}
/* redraw screen tiles in the next frame (player may have left the tiles) */
- screentiles[old_sx][old_sy] = -1;
- screentiles[new_sx][new_sy] = -1;
+ screen
_
tiles[old_sx][old_sy] = -1;
+ screen
_
tiles[new_sx][new_sy] = -1;
}
}
}
}
@@
-432,7
+436,7
@@
void game_initscreen(void)
int player_nr;
int x,y;
int player_nr;
int x,y;
- frame =
6
;
+ frame =
1
;
player_nr = (game.centered_player_nr != -1 ? game.centered_player_nr : 0);
player_nr = (game.centered_player_nr != -1 ? game.centered_player_nr : 0);
@@
-443,7
+447,7
@@
void game_initscreen(void)
{
for (x = 0; x < MAX_BUF_XSIZE; x++)
{
{
for (x = 0; x < MAX_BUF_XSIZE; x++)
{
- screentiles[x][y] = -1;
+ screen
_
tiles[x][y] = -1;
crumbled_state[x][y] = 0;
}
}
crumbled_state[x][y] = 0;
}
}
@@
-551,6
+555,7
@@
static boolean checkIfAllPlayersAreVisible(int center_x, int center_y)
void RedrawPlayfield_EM(boolean force_redraw)
{
boolean draw_new_player_location = FALSE;
void RedrawPlayfield_EM(boolean force_redraw)
{
boolean draw_new_player_location = FALSE;
+ boolean draw_new_player_location_fast = FALSE;
boolean quick_relocation = setup.quick_switch;
int max_center_distance_player_nr =
getMaxCenterDistancePlayerNr(screen_x, screen_y);
boolean quick_relocation = setup.quick_switch;
int max_center_distance_player_nr =
getMaxCenterDistancePlayerNr(screen_x, screen_y);
@@
-589,9
+594,11
@@
void RedrawPlayfield_EM(boolean force_redraw)
game.centered_player_nr = game.centered_player_nr_next;
draw_new_player_location = TRUE;
game.centered_player_nr = game.centered_player_nr_next;
draw_new_player_location = TRUE;
+ draw_new_player_location_fast = game.set_centered_player_fast;
force_redraw = TRUE;
game.set_centered_player = FALSE;
force_redraw = TRUE;
game.set_centered_player = FALSE;
+ game.set_centered_player_fast = FALSE;
}
if (game.centered_player_nr == -1)
}
if (game.centered_player_nr == -1)
@@
-622,11
+629,16
@@
void RedrawPlayfield_EM(boolean force_redraw)
if (draw_new_player_location && !quick_relocation)
{
if (draw_new_player_location && !quick_relocation)
{
- unsigned int
game_frame_delay_value = getGameFrameDelay_EM(20
);
- int wait_delay_value =
game_frame_delay_value
;
+ unsigned int
frame_delay_value_old = GetVideoFrameDelay(
);
+ int wait_delay_value =
frame_delay_value_old
;
int screen_xx = VALID_SCREEN_X(sx);
int screen_yy = VALID_SCREEN_Y(sy);
int screen_xx = VALID_SCREEN_X(sx);
int screen_yy = VALID_SCREEN_Y(sy);
+ if (draw_new_player_location_fast)
+ wait_delay_value /= 4;
+
+ SetVideoFrameDelay(wait_delay_value);
+
while (screen_x != screen_xx || screen_y != screen_yy)
{
int dx = (screen_xx < screen_x ? +1 : screen_xx > screen_x ? -1 : 0);
while (screen_x != screen_xx || screen_y != screen_yy)
{
int dx = (screen_xx < screen_x ? +1 : screen_xx > screen_x ? -1 : 0);
@@
-670,8
+682,6
@@
void RedrawPlayfield_EM(boolean force_redraw)
BlitScreenToBitmap_EM(backbuffer);
BackToFront_EM();
BlitScreenToBitmap_EM(backbuffer);
BackToFront_EM();
- Delay(wait_delay_value);
-
/* scroll second step to align at full tile size */
screen_x -= dxx;
screen_y -= dyy;
/* scroll second step to align at full tile size */
screen_x -= dxx;
screen_y -= dyy;
@@
-683,10
+693,10
@@
void RedrawPlayfield_EM(boolean force_redraw)
BlitScreenToBitmap_EM(backbuffer);
BackToFront_EM();
BlitScreenToBitmap_EM(backbuffer);
BackToFront_EM();
-
- Delay(wait_delay_value);
}
}
+ SetVideoFrameDelay(frame_delay_value_old);
+
screen_x_old = screen_x;
screen_y_old = screen_y;
}
screen_x_old = screen_x;
screen_y_old = screen_y;
}
@@
-697,7
+707,7
@@
void RedrawPlayfield_EM(boolean force_redraw)
{
for (x = 0; x < MAX_BUF_XSIZE; x++)
{
{
for (x = 0; x < MAX_BUF_XSIZE; x++)
{
- screentiles[x][y] = -1;
+ screen
_
tiles[x][y] = -1;
crumbled_state[x][y] = 0;
}
}
crumbled_state[x][y] = 0;
}
}