projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20020930-2-src
[rocksndiamonds.git]
/
src
/
game.c
diff --git
a/src/game.c
b/src/game.c
index 2c5f0e9aabb2f693c3f3c3da9c6ba06d77c428ad..56cb38b2a363d17f719130ff276301cc5b8ef44f 100644
(file)
--- a/
src/game.c
+++ b/
src/game.c
@@
-669,12
+669,14
@@
void InitGame()
InitGameEngine();
InitGameEngine();
+#if 0
#if DEBUG
#if USE_NEW_AMOEBA_CODE
printf("Using new amoeba code.\n");
#else
printf("Using old amoeba code.\n");
#endif
#if DEBUG
#if USE_NEW_AMOEBA_CODE
printf("Using new amoeba code.\n");
#else
printf("Using old amoeba code.\n");
#endif
+#endif
#endif
/* don't play tapes over network */
#endif
/* don't play tapes over network */
@@
-793,6
+795,7
@@
void InitGame()
MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0;
Store[x][y] = Store2[x][y] = StorePlayer[x][y] = 0;
Frame[x][y] = 0;
MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0;
Store[x][y] = Store2[x][y] = StorePlayer[x][y] = 0;
Frame[x][y] = 0;
+ GfxAction[x][y] = GFX_ACTION_DEFAULT;
AmoebaNr[x][y] = 0;
JustStopped[x][y] = 0;
Stop[x][y] = FALSE;
AmoebaNr[x][y] = 0;
JustStopped[x][y] = 0;
Stop[x][y] = FALSE;
@@
-1211,7
+1214,7
@@
void GameWon()
#endif
/* Hero disappears */
#endif
/* Hero disappears */
- DrawLevelField(ExitX, ExitY);
+ Draw
New
LevelField(ExitX, ExitY);
BackToFront();
if (tape.playing)
BackToFront();
if (tape.playing)
@@
-1327,8
+1330,11
@@
void InitMovingField(int x, int y, int direction)
MovDir[x][y] = direction;
MovDir[newx][newy] = direction;
MovDir[x][y] = direction;
MovDir[newx][newy] = direction;
+
if (Feld[newx][newy] == EL_EMPTY)
Feld[newx][newy] = EL_BLOCKED;
if (Feld[newx][newy] == EL_EMPTY)
Feld[newx][newy] = EL_BLOCKED;
+
+ GfxAction[x][y] = GFX_ACTION_MOVING;
}
void Moving2Blocked(int x, int y, int *goes_to_x, int *goes_to_y)
}
void Moving2Blocked(int x, int y, int *goes_to_x, int *goes_to_y)
@@
-1439,22
+1445,31
@@
void RemoveMovingField(int x, int y)
Feld[newx][newy] = EL_EMPTY;
MovPos[oldx][oldy] = MovDir[oldx][oldy] = MovDelay[oldx][oldy] = 0;
MovPos[newx][newy] = MovDir[newx][newy] = MovDelay[newx][newy] = 0;
Feld[newx][newy] = EL_EMPTY;
MovPos[oldx][oldy] = MovDir[oldx][oldy] = MovDelay[oldx][oldy] = 0;
MovPos[newx][newy] = MovDir[newx][newy] = MovDelay[newx][newy] = 0;
+ GfxAction[oldx][oldy] = GfxAction[newx][newy] = GFX_ACTION_DEFAULT;
- DrawLevelField(oldx, oldy);
- DrawLevelField(newx, newy);
+ Draw
New
LevelField(oldx, oldy);
+ Draw
New
LevelField(newx, newy);
}
void DrawDynamite(int x, int y)
{
int sx = SCREENX(x), sy = SCREENY(y);
}
void DrawDynamite(int x, int y)
{
int sx = SCREENX(x), sy = SCREENY(y);
+#if 0
int graphic = el2gfx(Feld[x][y]);
int graphic = el2gfx(Feld[x][y]);
+#else
+ int graphic = el2img(Feld[x][y]);
+#endif
int phase;
if (!IN_SCR_FIELD(sx, sy) || IS_PLAYER(x, y))
return;
if (Store[x][y])
int phase;
if (!IN_SCR_FIELD(sx, sy) || IS_PLAYER(x, y))
return;
if (Store[x][y])
+#if 0
DrawGraphic(sx, sy, el2gfx(Store[x][y]));
DrawGraphic(sx, sy, el2gfx(Store[x][y]));
+#else
+ DrawNewGraphic(sx, sy, el2img(Store[x][y]), 0);
+#endif
if (Feld[x][y] == EL_DYNAMITE_ACTIVE)
{
if (Feld[x][y] == EL_DYNAMITE_ACTIVE)
{
@@
-1467,12
+1482,29
@@
void DrawDynamite(int x, int y)
phase = 7 - phase;
}
phase = 7 - phase;
}
+#if 1
+ phase = getNewGraphicAnimationFrame(graphic, 96 - MovDelay[x][y]);
+#endif
+
+ /*
+ printf("-> %d: %d [%d]\n", graphic, phase, MovDelay[x][y]);
+ */
+
+#if 0
if (game.emulation == EMU_SUPAPLEX)
DrawGraphic(sx, sy, GFX_SP_DISK_RED);
else if (Store[x][y])
DrawGraphicThruMask(sx, sy, graphic + phase);
else
DrawGraphic(sx, sy, graphic + phase);
if (game.emulation == EMU_SUPAPLEX)
DrawGraphic(sx, sy, GFX_SP_DISK_RED);
else if (Store[x][y])
DrawGraphicThruMask(sx, sy, graphic + phase);
else
DrawGraphic(sx, sy, graphic + phase);
+#else
+ if (game.emulation == EMU_SUPAPLEX)
+ DrawNewGraphic(sx, sy, IMG_SP_DISK_RED, 0);
+ else if (Store[x][y])
+ DrawNewGraphicThruMask(sx, sy, graphic, phase);
+ else
+ DrawNewGraphic(sx, sy, graphic, phase);
+#endif
}
void CheckDynamite(int x, int y)
}
void CheckDynamite(int x, int y)
@@
-2721,6
+2753,8
@@
void StartMoving(int x, int y)
if (Stop[x][y])
return;
if (Stop[x][y])
return;
+ GfxAction[x][y] = GFX_ACTION_DEFAULT;
+
if (CAN_FALL(element) && y<lev_fieldy-1)
{
if ((x>0 && IS_PLAYER(x-1, y)) || (x<lev_fieldx-1 && IS_PLAYER(x+1, y)))
if (CAN_FALL(element) && y<lev_fieldy-1)
{
if ((x>0 && IS_PLAYER(x-1, y)) || (x<lev_fieldx-1 && IS_PLAYER(x+1, y)))
@@
-2909,16
+2943,11
@@
void StartMoving(int x, int y)
TurnRound(x, y);
if (MovDelay[x][y] && (element == EL_BUG ||
TurnRound(x, y);
if (MovDelay[x][y] && (element == EL_BUG ||
- element == EL_SPACESHIP ||
- element == EL_SP_SNIKSNAK ||
- element == EL_SP_ELECTRON))
- DrawNewLevelField(x, y);
- else if (MovDelay[x][y] && (element == EL_BUG ||
element == EL_SPACESHIP ||
element == EL_SP_SNIKSNAK ||
element == EL_SP_ELECTRON ||
element == EL_MOLE))
element == EL_SPACESHIP ||
element == EL_SP_SNIKSNAK ||
element == EL_SP_ELECTRON ||
element == EL_MOLE))
- DrawLevelField(x, y);
+ Draw
New
LevelField(x, y);
}
}
}
}
@@
-2946,7
+2975,7
@@
void StartMoving(int x, int y)
}
}
else if (element == EL_SP_ELECTRON)
}
}
else if (element == EL_SP_ELECTRON)
- DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_
NORMAL
);
+ DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_
LOOP
);
else if (element == EL_DRAGON)
{
int i;
else if (element == EL_DRAGON)
{
int i;
@@
-3030,7
+3059,7
@@
void StartMoving(int x, int y)
if (Feld[newx][newy] == EL_EXIT_OPEN)
{
Feld[x][y] = EL_EMPTY;
if (Feld[newx][newy] == EL_EXIT_OPEN)
{
Feld[x][y] = EL_EMPTY;
- DrawLevelField(x, y);
+ Draw
New
LevelField(x, y);
PlaySoundLevel(newx, newy, SND_PENGUIN_PASSING_EXIT);
if (IN_SCR_FIELD(SCREENX(newx), SCREENY(newy)))
PlaySoundLevel(newx, newy, SND_PENGUIN_PASSING_EXIT);
if (IN_SCR_FIELD(SCREENX(newx), SCREENY(newy)))
@@
-3046,7
+3075,7
@@
void StartMoving(int x, int y)
else if (IS_MAMPF3(Feld[newx][newy]))
{
if (DigField(local_player, newx, newy, 0, 0, DF_DIG) == MF_MOVING)
else if (IS_MAMPF3(Feld[newx][newy]))
{
if (DigField(local_player, newx, newy, 0, 0, DF_DIG) == MF_MOVING)
- DrawLevelField(newx, newy);
+ Draw
New
LevelField(newx, newy);
else
MovDir[x][y] = MV_NO_MOVING;
}
else
MovDir[x][y] = MV_NO_MOVING;
}
@@
-3055,7
+3084,7
@@
void StartMoving(int x, int y)
if (IS_PLAYER(x, y))
DrawPlayerField(x, y);
else
if (IS_PLAYER(x, y))
DrawPlayerField(x, y);
else
- DrawLevelField(x, y);
+ Draw
New
LevelField(x, y);
return;
}
}
return;
}
}
@@
-3068,7
+3097,7
@@
void StartMoving(int x, int y)
else
{
Feld[newx][newy] = EL_EMPTY;
else
{
Feld[newx][newy] = EL_EMPTY;
- DrawLevelField(newx, newy);
+ Draw
New
LevelField(newx, newy);
}
PlaySoundLevel(x, y, SND_PIG_EATING);
}
PlaySoundLevel(x, y, SND_PIG_EATING);
@@
-3078,7
+3107,7
@@
void StartMoving(int x, int y)
if (IS_PLAYER(x, y))
DrawPlayerField(x, y);
else
if (IS_PLAYER(x, y))
DrawPlayerField(x, y);
else
- DrawLevelField(x, y);
+ Draw
New
LevelField(x, y);
return;
}
}
return;
}
}
@@
-3089,7
+3118,7
@@
void StartMoving(int x, int y)
if (IS_PLAYER(x, y))
DrawPlayerField(x, y);
else
if (IS_PLAYER(x, y))
DrawPlayerField(x, y);
else
- DrawLevelField(x, y);
+ Draw
New
LevelField(x, y);
return;
}
else
return;
}
else
@@
-3110,7
+3139,7
@@
void StartMoving(int x, int y)
if (IS_PLAYER(x, y))
DrawPlayerField(x, y);
else
if (IS_PLAYER(x, y))
DrawPlayerField(x, y);
else
- DrawLevelField(x, y);
+ Draw
New
LevelField(x, y);
PlaySoundLevel(x, y, SND_DRAGON_ATTACKING);
PlaySoundLevel(x, y, SND_DRAGON_ATTACKING);
@@
-3132,7
+3161,7
@@
void StartMoving(int x, int y)
else
{
Feld[newx][newy] = EL_EMPTY;
else
{
Feld[newx][newy] = EL_EMPTY;
- DrawLevelField(newx, newy);
+ Draw
New
LevelField(newx, newy);
}
PlaySoundLevel(x, y, SND_YAMYAM_EATING);
}
PlaySoundLevel(x, y, SND_YAMYAM_EATING);
@@
-3153,7
+3182,7
@@
void StartMoving(int x, int y)
else
{
Feld[newx][newy] = EL_EMPTY;
else
{
Feld[newx][newy] = EL_EMPTY;
- DrawLevelField(newx, newy);
+ Draw
New
LevelField(newx, newy);
}
PlaySoundLevel(x, y, SND_DARK_YAMYAM_EATING);
}
PlaySoundLevel(x, y, SND_DARK_YAMYAM_EATING);
@@
-3205,26
+3234,26
@@
void StartMoving(int x, int y)
#endif
else if (element == EL_BUG || element == EL_SPACESHIP ||
element == EL_SP_SNIKSNAK || element == EL_MOLE)
#endif
else if (element == EL_BUG || element == EL_SPACESHIP ||
element == EL_SP_SNIKSNAK || element == EL_MOLE)
-#if
1
+#if
0
DrawLevelField(x, y);
#else
DrawNewLevelField(x, y);
#endif
else if (element == EL_BD_BUTTERFLY || element == EL_BD_FIREFLY)
#if 0
DrawLevelField(x, y);
#else
DrawNewLevelField(x, y);
#endif
else if (element == EL_BD_BUTTERFLY || element == EL_BD_FIREFLY)
#if 0
- DrawGraphicAnimation(x, y, el2gfx(element), 2, 4, ANIM_
NORMAL
);
+ DrawGraphicAnimation(x, y, el2gfx(element), 2, 4, ANIM_
LOOP
);
#else
DrawNewGraphicAnimation(x, y, el2img(element));
#endif
else if (element == EL_SATELLITE)
#if 0
#else
DrawNewGraphicAnimation(x, y, el2img(element));
#endif
else if (element == EL_SATELLITE)
#if 0
- DrawGraphicAnimation(x, y, GFX_SONDE_START, 8, 2, ANIM_
NORMAL
);
+ DrawGraphicAnimation(x, y, GFX_SONDE_START, 8, 2, ANIM_
LOOP
);
#else
DrawNewGraphicAnimation(x, y, IMG_SATELLITE);
#endif
else if (element == EL_SP_ELECTRON)
#if 0
#else
DrawNewGraphicAnimation(x, y, IMG_SATELLITE);
#endif
else if (element == EL_SP_ELECTRON)
#if 0
- DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_
NORMAL
);
+ DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_
LOOP
);
#else
DrawNewGraphicAnimation(x, y, IMG_SP_ELECTRON);
#endif
#else
DrawNewGraphicAnimation(x, y, IMG_SP_ELECTRON);
#endif
@@
-3296,7
+3325,7
@@
void ContinueMoving(int x, int y)
};
Feld[x][y] = EL_SAND;
};
Feld[x][y] = EL_SAND;
- DrawLevelField(x, y);
+ Draw
New
LevelField(x, y);
for(i=0; i<4; i++)
{
for(i=0; i<4; i++)
{
@@
-3306,7
+3335,7
@@
void ContinueMoving(int x, int y)
yy = y + xy[i][1];
if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_SAND)
yy = y + xy[i][1];
if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_SAND)
- Draw
LevelField(xx, yy);
/* for "ErdreichAnbroeckeln()" */
+ Draw
NewLevelField(xx, yy);
/* for "ErdreichAnbroeckeln()" */
}
}
}
}
@@
-3362,21
+3391,14
@@
void ContinueMoving(int x, int y)
MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0;
MovDelay[newx][newy] = 0;
MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0;
MovDelay[newx][newy] = 0;
+ GfxAction[newx][newy] = GfxAction[x][y]; /* keep action one frame */
+ GfxAction[x][y] = GFX_ACTION_DEFAULT;
+
if (!CAN_MOVE(element))
MovDir[newx][newy] = 0;
if (!CAN_MOVE(element))
MovDir[newx][newy] = 0;
- if (element == EL_BUG || element == EL_SPACESHIP ||
- element == EL_SP_SNIKSNAK || element == EL_PACMAN ||
- element == EL_SP_ELECTRON)
- {
- DrawNewLevelField(x, y);
- DrawNewLevelField(newx, newy);
- }
- else
- {
- DrawLevelField(x, y);
- DrawLevelField(newx, newy);
- }
+ DrawNewLevelField(x, y);
+ DrawNewLevelField(newx, newy);
Stop[newx][newy] = TRUE;
JustStopped[newx][newy] = 3;
Stop[newx][newy] = TRUE;
JustStopped[newx][newy] = 3;
@@
-3396,12
+3418,10
@@
void ContinueMoving(int x, int y)
}
else /* still moving on */
{
}
else /* still moving on */
{
- if (element == EL_BUG || element == EL_SPACESHIP ||
- element == EL_SP_SNIKSNAK || element == EL_PACMAN ||
- element == EL_SP_ELECTRON)
- DrawNewLevelField(x, y);
- else
- DrawLevelField(x, y);
+ if (GfxAction[x][y] == GFX_ACTION_DEFAULT)
+ GfxAction[x][y] = GFX_ACTION_MOVING;
+
+ DrawNewLevelField(x, y);
}
}
}
}
@@
-3921,7
+3941,7
@@
void Blubber(int x, int y)
if (y > 0 && IS_MOVING(x, y-1) && MovDir[x][y-1] == MV_DOWN)
DrawLevelField(x, y-1);
else
if (y > 0 && IS_MOVING(x, y-1) && MovDir[x][y-1] == MV_DOWN)
DrawLevelField(x, y-1);
else
- DrawGraphicAnimation(x, y, GFX_GEBLUBBER, 4, 10, ANIM_
NORMAL
);
+ DrawGraphicAnimation(x, y, GFX_GEBLUBBER, 4, 10, ANIM_
LOOP
);
}
void NussKnacken(int x, int y)
}
void NussKnacken(int x, int y)
@@
-4513,7
+4533,7
@@
static void DrawBeltAnimation(int x, int y, int element)
if (belt_dir != MV_NO_MOVING)
{
int delay = 2;
if (belt_dir != MV_NO_MOVING)
{
int delay = 2;
- int mode =
(belt_dir == MV_LEFT ? ANIM_NORMAL
: ANIM_REVERSE);
+ int mode =
ANIM_LOOP | (belt_dir == MV_LEFT ? 0
: ANIM_REVERSE);
int graphic = el2gfx(element) + (belt_dir == MV_LEFT ? 0 : 7);
DrawGraphicAnimation(x, y, graphic, 8, delay, mode);
int graphic = el2gfx(element) + (belt_dir == MV_LEFT ? 0 : 7);
DrawGraphicAnimation(x, y, graphic, 8, delay, mode);
@@
-4871,10
+4891,10
@@
void GameActions()
else if (element == EL_TRAP || element == EL_TRAP_ACTIVE)
CheckTrap(x, y);
else if (element == EL_SP_TERMINAL)
else if (element == EL_TRAP || element == EL_TRAP_ACTIVE)
CheckTrap(x, y);
else if (element == EL_SP_TERMINAL)
- DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL, 7, 12, ANIM_
NORMAL
);
+ DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL, 7, 12, ANIM_
LOOP
);
else if (element == EL_SP_TERMINAL_ACTIVE)
{
else if (element == EL_SP_TERMINAL_ACTIVE)
{
- DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL_ACTIVE, 7, 4, ANIM_
NORMAL
);
+ DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL_ACTIVE, 7, 4, ANIM_
LOOP
);
#if 0
if (!(FrameCounter % 4))
PlaySoundLevel(x, y, SND_SP_TERMINAL_ACTIVE);
#if 0
if (!(FrameCounter % 4))
PlaySoundLevel(x, y, SND_SP_TERMINAL_ACTIVE);
@@
-4891,10
+4911,10
@@
void GameActions()
else if (element == EL_TIMEGATE_CLOSING)
CloseTimegate(x, y);
else if (element == EL_EXTRA_TIME)
else if (element == EL_TIMEGATE_CLOSING)
CloseTimegate(x, y);
else if (element == EL_EXTRA_TIME)
- DrawGraphicAnimation(x, y, GFX_EXTRA_TIME, 6, 4, ANIM_
NORMAL
);
+ DrawGraphicAnimation(x, y, GFX_EXTRA_TIME, 6, 4, ANIM_
LOOP
);
else if (element == EL_SHIELD_NORMAL)
{
else if (element == EL_SHIELD_NORMAL)
{
- DrawGraphicAnimation(x, y, GFX_SHIELD_PASSIVE, 6, 4, ANIM_
NORMAL
);
+ DrawGraphicAnimation(x, y, GFX_SHIELD_PASSIVE, 6, 4, ANIM_
LOOP
);
#if 0
if (!(FrameCounter % 4))
PlaySoundLevel(x, y, SND_SHIELD_PASSIVE_ACTIVATED);
#if 0
if (!(FrameCounter % 4))
PlaySoundLevel(x, y, SND_SHIELD_PASSIVE_ACTIVATED);
@@
-4902,7
+4922,7
@@
void GameActions()
}
else if (element == EL_SHIELD_DEADLY)
{
}
else if (element == EL_SHIELD_DEADLY)
{
- DrawGraphicAnimation(x, y, GFX_SHIELD_ACTIVE, 6, 4, ANIM_
NORMAL
);
+ DrawGraphicAnimation(x, y, GFX_SHIELD_ACTIVE, 6, 4, ANIM_
LOOP
);
#if 0
if (!(FrameCounter % 4))
PlaySoundLevel(x, y, SND_SHIELD_DEADLY_ACTIVE);
#if 0
if (!(FrameCounter % 4))
PlaySoundLevel(x, y, SND_SHIELD_DEADLY_ACTIVE);