File fix-compilation.patch of Package hota-redux
From e92706c2144a122d964be771f73f242fa53de52e Mon Sep 17 00:00:00 2001
From: Carsten Teibes <dev@f4ke.de>
Date: Sun, 11 Dec 2016 01:29:34 +0100
Subject: [PATCH] Fix compilation errors and Makefile clean target
---
src/Makefile | 3 ++-
src/animation.c | 1 +
src/music.c | 2 +-
src/render.c | 19 ++++++++-----------
src/sound.c | 5 ++---
src/sprites.c | 2 --
src/sprites.h | 1 +
7 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/src/Makefile b/src/Makefile
index f8ae377..29e37c2 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -18,4 +18,5 @@ alien: $(OBJS)
$(CC) $(CFLAGS) -c $< -o $@
clean:
- @rm $(OBJS)
+ @rm -f $(OBJS) alien
+
diff --git a/src/animation.c b/src/animation.c
index 2cdb190..96d4cd7 100644
--- a/src/animation.c
+++ b/src/animation.c
@@ -35,6 +35,7 @@ void rest(int fps);
extern SDL_Surface *screen;
extern SDL_Color palette[256];
+extern void update_keys();
/* used for 4->8 bit convertion (140K penalty) */
static unsigned char dummy[304*192/2];
diff --git a/src/music.c b/src/music.c
index 98f286e..9bd8d58 100644
--- a/src/music.c
+++ b/src/music.c
@@ -89,7 +89,7 @@ static void play_music_track_mp3(int track, int loop)
Mix_PlayMusic(current_track, loop);
}
-/** Plays audio track */
+/** Plays audio track
@param track track to play
@param loop loop count
*/
diff --git a/src/render.c b/src/render.c
index d4cd3e3..6f6a8ba 100644
--- a/src/render.c
+++ b/src/render.c
@@ -21,23 +21,20 @@
#include "debug.h"
#include "render.h"
#include "game2bin.h"
+#include "client.h"
#include "scale2x.h"
#include "scale3x.h"
static int fullscreen = 0;
static int scroll_reg = 0;
-
extern int fullscreen_flag;
extern int filtered_flag;
-extern int scale;
-extern int palette_changed;
-extern SDL_Color palette[256];
+SDL_Color palette[256];
extern SDL_Surface *screen;
static int palette_changed = 0;
static int current_palette = 0;
-static SDL_Color palette[256];
/** Returns the current palette used
@returns palette
@@ -184,7 +181,7 @@ void render(unsigned char *src)
SDL_SetColors(screen, palette, 0, 256);
}
- switch(scale)
+ switch(cls.scale)
{
case 1:
/* normal 1x */
@@ -267,7 +264,7 @@ void set_palette(int which)
void toggle_fullscreen()
{
/* hack, fullscreen not supported at scale==3 */
- if (scale == 3)
+ if (cls.scale == 3)
{
return;
}
@@ -280,7 +277,7 @@ void toggle_fullscreen()
{
LOG(("create SDL surface of 304x192x8\n"));
- screen = SDL_SetVideoMode(304*scale, 192*scale, 8, SDL_SWSURFACE);
+ screen = SDL_SetVideoMode(304*cls.scale, 192*cls.scale, 8, SDL_SWSURFACE);
SDL_SetColors(screen, palette, 0, 256);
SDL_ShowCursor(1);
}
@@ -288,8 +285,8 @@ void toggle_fullscreen()
{
int w, h;
- w = 320*scale;
- h = 200*scale;
+ w = 320*cls.scale;
+ h = 200*cls.scale;
LOG(("setting fullscreen mode %dx%dx8\n", w, h));
@@ -302,7 +299,7 @@ void toggle_fullscreen()
int render_create_surface()
{
- screen = SDL_SetVideoMode(304*scale, 192*scale, 8, SDL_SWSURFACE);
+ screen = SDL_SetVideoMode(304*cls.scale, 192*cls.scale, 8, SDL_SWSURFACE);
if (screen == NULL)
{
return -1;
diff --git a/src/sound.c b/src/sound.c
index 089591f..3b6bfbe 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -27,8 +27,7 @@
#include "sound.h"
#include "common.h"
#include "vm.h"
-
-extern int nosound_flag;
+#include "client.h"
/* cached samples, useless convertions and allocations hurt my eyes! */
static Mix_Chunk *cached_samples[256];
@@ -63,7 +62,7 @@ void play_sample(int index, int volume, int channel)
SDL_AudioCVT cvt;
Mix_Chunk *chunk;
- if (nosound_flag)
+ if (cls.nosound)
{
/* day off! */
return;
diff --git a/src/sprites.c b/src/sprites.c
index 723a264..3bdad68 100644
--- a/src/sprites.c
+++ b/src/sprites.c
@@ -400,8 +400,6 @@ void render_sprite(int list_entry)
x = extl(sprites[list_entry].x);
y = extl(sprites[list_entry].y);
- d3 = y*304 + x;
-
d2 = sprites[list_entry].frame & 0x7f;
d1 = get_word(a3 + d2*2 + 6);
a2 = a3 + d1 + 4;
diff --git a/src/sprites.h b/src/sprites.h
index a51ff4a..a073694 100644
--- a/src/sprites.h
+++ b/src/sprites.h
@@ -56,6 +56,7 @@ void mirror_sprite(int sprite);
void unmirror_sprite(int sprite);
void remove_sprite(int var);
void render_sprite(int list_entry);
+void draw_sprites();
int quickload_sprites(FILE *fp);
int quicksave_sprites(FILE *fp);