diff options
author | Aleksey Veresov <aleksey@veresov.pro> | 2021-03-01 18:02:05 +0300 |
---|---|---|
committer | Aleksey Veresov <aleksey@veresov.pro> | 2021-03-01 18:02:05 +0300 |
commit | 5d973f7851d8bfbbbc57b339948995ae44fc2112 (patch) | |
tree | 440ce38a74a8f35b129790bc3b1271fad043dec2 /src | |
parent | ec583c67456efbfdb07bb2df43b0d0eee4f7b3e2 (diff) | |
download | takethis-5d973f7851d8bfbbbc57b339948995ae44fc2112.tar takethis-5d973f7851d8bfbbbc57b339948995ae44fc2112.tar.xz takethis-5d973f7851d8bfbbbc57b339948995ae44fc2112.zip |
o_O
Diffstat (limited to 'src')
-rw-r--r-- | src/game.c | 11 | ||||
-rw-r--r-- | src/map.c | 2 | ||||
-rw-r--r-- | src/player.c | 4 | ||||
-rw-r--r-- | src/player.h | 2 |
4 files changed, 17 insertions, 2 deletions
@@ -15,6 +15,17 @@ static void step(int d) if (xw || yw) { ttplayer.rem += d; } + if (ttplayer.zhiv_lenin) { + int oldpos = ttplayer.lenin_pos; + ttplayer.lenin_rem += d; + ttplayer.lenin_pos_rem += d * ttplayer.lenin_vel; + ttplayer.lenin_pos += ttplayer.lenin_pos_rem / 1000; + ttplayer.lenin_pos_rem = ttplayer.lenin_pos_rem % 1000; + if (ttplayer.lenin_pos < 64 || 32 * 16 < ttplayer.lenin_pos) { + ttplayer.lenin_pos = oldpos; + ttplayer.lenin_vel *= -1; + } + } static int first_gulag = 1; if (ttplayer.tobein_gulag && ttplayer.until_gulag > 0) { if (first_gulag) { @@ -87,8 +87,10 @@ static void loadroom(tt_room *r, FILE *f) ttplayer.keys = 0; ttplayer.the_key = 0; ttplayer.lenin_pos = 32 * 9; + ttplayer.lenin_pos_rem = 0; ttplayer.zhiv_lenin = 0; ttplayer.lenin_rem = 0; + ttplayer.lenin_vel = -50; ttplayer.variant = 0; ttplayer.tobein_gulag = 0; ttplayer.until_gulag = 5300; diff --git a/src/player.c b/src/player.c index edaa04f..b4846bf 100644 --- a/src/player.c +++ b/src/player.c @@ -26,14 +26,14 @@ void tt_player_draw() if (ttplayer.zhiv_lenin) { { - SDL_Rect src = { 32 + 32 * (ttplayer.lenin_rem / 100 % 2), + SDL_Rect src = { 32 + 32 * (ttplayer.lenin_rem / 200 % 2), 16 * 11 + 4, 32, 38 }; SDL_Rect dst = { 14 + ttplayer.lenin_pos, 14 + 32 + 96 - 8 - 38 * 2, 64, 38 * 2 }; SDL_RenderCopy(ttrdr, tttxr, &src, &dst); } { - SDL_Rect src = { 96 + 64 * (ttplayer.lenin_rem / 100 % 2), + SDL_Rect src = { 96 + 64 * (ttplayer.lenin_rem / 200 % 2), 16 * 11, 64, 48 }; SDL_Rect dst = { 14 + ttplayer.lenin_pos - 32, 110, 128, 96 }; diff --git a/src/player.h b/src/player.h index 7c2fc56..fca14e6 100644 --- a/src/player.h +++ b/src/player.h @@ -22,6 +22,8 @@ typedef struct tt_player { int until_gulag; int lenin_pos; + int lenin_pos_rem; + int lenin_vel; int zhiv_lenin; int lenin_rem; } tt_player; |