projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
removed needless delay when relocating the player
[rocksndiamonds.git]
/
src
/
game_em
/
logic.c
diff --git
a/src/game_em/logic.c
b/src/game_em/logic.c
index bcaf88c82f72b3bfcc7ea52ca4e3110dfddd459a..a1afd71355f05055cbc43c4401ffa2a6603ff18c 100644
(file)
--- a/
src/game_em/logic.c
+++ b/
src/game_em/logic.c
@@
-1228,7
+1228,7
@@
static void check_player(struct PLAYER *ply)
static void set_nearest_player_xy(int x, int y, int *dx, int *dy)
{
static void set_nearest_player_xy(int x, int y, int *dx, int *dy)
{
- int distance, distance_shortest =
EM_MAX_CAVE_WIDTH + EM_MAX_
CAVE_HEIGHT;
+ int distance, distance_shortest =
CAVE_WIDTH +
CAVE_HEIGHT;
int i;
/* default values if no players are alive anymore */
int i;
/* default values if no players are alive anymore */
@@
-6228,6
+6228,16
@@
void logic_1(void)
for (i = 0; i < MAX_PLAYERS; i++)
{
for (i = 0; i < MAX_PLAYERS; i++)
{
+ /* check for wrap-around movement */
+ if (ply[i].x < lev.left ||
+ ply[i].x > lev.right - 1)
+ {
+ ply[i].x = (ply[i].x < lev.left ? lev.right - 1 : lev.left);
+
+ game.centered_player_nr_next = i;
+ game.set_centered_player = TRUE;
+ }
+
ply[i].oldx = ply[i].x;
ply[i].oldy = ply[i].y;
ply[i].anim = PLY_still;
ply[i].oldx = ply[i].x;
ply[i].oldy = ply[i].y;
ply[i].anim = PLY_still;
@@
-6273,8
+6283,8
@@
void logic_2(void)
seed = RandomEM;
score = 0;
seed = RandomEM;
score = 0;
- for (y =
1; y < HEIGHT - 1
; y++)
- for (x =
0; x < WIDTH
; x++)
+ for (y =
lev.top; y < lev.bottom
; y++)
+ for (x =
lev.left; x < lev.right
; x++)
handle_tile(x, y);
if (ply[0].alive || ply[1].alive || ply[2].alive || ply[3].alive)
handle_tile(x, y);
if (ply[0].alive || ply[1].alive || ply[2].alive || ply[3].alive)
@@
-6334,10
+6344,12
@@
void logic_3(void)
for (count = lev.amoeba_time; count--;)
{
for (count = lev.amoeba_time; count--;)
{
- x =
(random >> 10) % (WIDTH -
2);
- y =
(random >> 20) % (HEIGHT -
2);
+ x =
lev.left - 1 + (random >> 10) % (CAVE_WIDTH +
2);
+ y =
lev.top - 1 + (random >> 20) % (CAVE_HEIGHT +
2);
- Lamoeba(x, y);
+ if (x >= lev.left && x < lev.right &&
+ y >= lev.top && y < lev.bottom)
+ Lamoeba(x, y);
random = random * 129 + 1;
}
random = random * 129 + 1;
}
@@
-6346,13
+6358,13
@@
void logic_3(void)
/* handle explosions */
/* handle explosions */
- for (y =
1; y < HEIGHT - 1
; y++)
- for (x =
1; x < WIDTH - 1
; x++)
+ for (y =
lev.top; y < lev.bottom
; y++)
+ for (x =
lev.left; x < lev.right
; x++)
Lexplode(x, y);
/* triple buffering */
Lexplode(x, y);
/* triple buffering */
- for (y =
0; y < HEIGHT
; y++)
- for (x =
0; x < WIDTH
; x++)
+ for (y =
lev.top; y < lev.bottom
; y++)
+ for (x =
lev.left; x < lev.right
; x++)
next[x][y] = cave[x][y];
}
next[x][y] = cave[x][y];
}