Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
M-HT committed Jan 3, 2016
1 parent e580d1f commit 3e5581a
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 93 deletions.
2 changes: 1 addition & 1 deletion src/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ typedef struct
int speed_throttle;
int filtered;
int pandora;
char *iso_prefix;
char *iso_prefix;
} client_static_t;

extern client_static_t cls;
Expand Down
94 changes: 47 additions & 47 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,24 +485,24 @@ void check_events()
break;

case SDLK_PAGEDOWN:
if (cls.pandora)
{
key_a = 0;
}
if (cls.pandora)
{
key_a = 0;
}
break;

case SDLK_END:
if (cls.pandora)
{
key_b = 0;
}
if (cls.pandora)
{
key_b = 0;
}
break;

case SDLK_HOME:
if (cls.pandora)
{
key_c = 0;
}
if (cls.pandora)
{
key_c = 0;
}
break;

case SDLK_q:
Expand Down Expand Up @@ -583,24 +583,24 @@ void check_events()
break;

case SDLK_PAGEDOWN:
if (cls.pandora)
{
key_a = 1;
}
if (cls.pandora)
{
key_a = 1;
}
break;

case SDLK_END:
if (cls.pandora)
{
key_b = 1;
}
if (cls.pandora)
{
key_b = 1;
}
break;

case SDLK_HOME:
if (cls.pandora)
{
key_c = 1;
}
if (cls.pandora)
{
key_c = 1;
}
break;

#ifdef ENABLE_DEBUG
Expand All @@ -620,10 +620,10 @@ void check_events()
case SDLK_RETURN:
if (event.key.keysym.mod & KMOD_ALT)
{
if (!cls.pandora)
{
toggle_fullscreen();
}
if (!cls.pandora)
{
toggle_fullscreen();
}
}
break;

Expand Down Expand Up @@ -653,29 +653,29 @@ void rest(int fps)
{
if (fastest_flag == 0)
{
if (fps == 0)
{
last_tick = SDL_GetTicks();
last_tick_fp = 0;
return;
}
if (fps == 0)
{
last_tick = SDL_GetTicks();
last_tick_fp = 0;
return;
}

if (speed_throttle == 1)
{
/* 10 times faster */
fps = fps*10;
}

Uint32 diff = ((1000 << 16) / fps) + last_tick_fp;
last_tick_fp = diff & 0xffff;
diff = diff >> 16;
Uint32 current_tick = SDL_GetTicks();
while (current_tick - last_tick < diff)
{
SDL_Delay(1);
current_tick = SDL_GetTicks();
}
last_tick += diff;
Uint32 diff = ((1000 << 16) / fps) + last_tick_fp;
last_tick_fp = diff & 0xffff;
diff = diff >> 16;
Uint32 current_tick = SDL_GetTicks();
while (current_tick - last_tick < diff)
{
SDL_Delay(1);
current_tick = SDL_GetTicks();
}
last_tick += diff;
}
}

Expand Down Expand Up @@ -768,7 +768,7 @@ static void run()
next_script = 7;
}

rest(0);
rest(0);

while (cls.quit == 0)
{
Expand Down Expand Up @@ -876,7 +876,7 @@ void sprite_test()

redraw = 1;
set_palette(0x11);
rest(0);
rest(0);
while (cls.quit == 0)
{
int a4;
Expand Down Expand Up @@ -1011,7 +1011,7 @@ int main(int argc, char **argv)
cls.paused = 0;
cls.nosound = 0;
cls.pandora = 0;
cls.iso_prefix = NULL;
cls.iso_prefix = NULL;

options_index = 0;
while (1)
Expand Down
2 changes: 1 addition & 1 deletion src/music.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void stop_music()
*/
static void play_music_track_cd(int track, int loop)
{
LOG(("play_music_track_cd(track=%d, loop=%d, sdlcd=0x%x)\n", track, loop, (unsigned)sdl_cd));
LOG(("play_music_track_cd(track=%d, loop=%d, sdlcd=0x%x)\n", track, loop, (unsigned)(unsigned long)sdl_cd));

if (CD_INDRIVE(SDL_CDStatus(sdl_cd)))
{
Expand Down
85 changes: 45 additions & 40 deletions src/render.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,25 +367,25 @@ void render(char *src)
case 3:
if (cls.filtered == 0)
{
if (cls.pandora)
{
render800x480(src);
}
else
{
render3x(src);
}
if (cls.pandora)
{
render800x480(src);
}
else
{
render3x(src);
}
}
else
{
if (cls.pandora)
{
render800x480_scaled(src);
}
else
{
render3x_scaled(src);
}
if (cls.pandora)
{
render800x480_scaled(src);
}
else
{
render3x_scaled(src);
}
}
break;
}
Expand Down Expand Up @@ -457,34 +457,39 @@ void toggle_fullscreen()
{
LOG(("create SDL surface of 304x192x8\n"));

if (cls.pandora && (cls.scale == 3))
{
screen = SDL_SetVideoMode(800, 480, 8, SDL_SWSURFACE);
}
else
{
screen = SDL_SetVideoMode(304*cls.scale, 192*cls.scale, 8, SDL_SWSURFACE);
}
if (cls.pandora && (cls.scale == 3))
{
screen = SDL_SetVideoMode(800, 480, 8, SDL_SWSURFACE);
}
else
{
screen = SDL_SetVideoMode(304*cls.scale, 192*cls.scale, 8, SDL_SWSURFACE);
}
SDL_SetColors(screen, palette, 0, 256);
SDL_ShowCursor(1);
}
else
{
int w, h;

#if defined(PANDORA)
w = 304*cls.scale;
h = 192*cls.scale;
#else
w = 320*cls.scale;
h = 200*cls.scale;
#endif

LOG(("setting fullscreen mode %dx%dx8\n", w, h));

if (cls.pandora && (cls.scale == 3))
{
screen = SDL_SetVideoMode(800, 480, 8, SDL_DOUBLEBUF|SDL_HWSURFACE|SDL_FULLSCREEN);
}
else
{
screen = SDL_SetVideoMode(w, h, 8, SDL_DOUBLEBUF|SDL_HWSURFACE|SDL_FULLSCREEN);
}
if (cls.pandora && (cls.scale == 3))
{
screen = SDL_SetVideoMode(800, 480, 8, SDL_DOUBLEBUF|SDL_HWSURFACE|SDL_FULLSCREEN);
}
else
{
screen = SDL_SetVideoMode(w, h, 8, SDL_DOUBLEBUF|SDL_HWSURFACE|SDL_FULLSCREEN);
}

SDL_SetColors(screen, palette, 0, 256);
SDL_ShowCursor(0);
Expand All @@ -493,14 +498,14 @@ void toggle_fullscreen()

int render_create_surface()
{
if (cls.pandora && (cls.scale == 3))
{
screen = SDL_SetVideoMode(800, 480, 8, SDL_SWSURFACE);
}
else
{
screen = SDL_SetVideoMode(304*cls.scale, 192*cls.scale, 8, SDL_SWSURFACE);
}
if (cls.pandora && (cls.scale == 3))
{
screen = SDL_SetVideoMode(800, 480, 8, SDL_SWSURFACE);
}
else
{
screen = SDL_SetVideoMode(304*cls.scale, 192*cls.scale, 8, SDL_SWSURFACE);
}
if (screen == NULL)
{
return -1;
Expand Down
8 changes: 4 additions & 4 deletions src/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void copy_screen(int dest, int src)
src_surface = get_screen_ptr(masked_src);
dest_surface = get_screen_ptr(masked_dest);

LOG(("copying surface %x onto %x\n", (unsigned)src_surface, (unsigned)dest_surface));
LOG(("copying surface %x onto %x\n", (unsigned)(unsigned long)src_surface, (unsigned)(unsigned long)dest_surface));
memcpy(dest_surface, src_surface, 304*192);
}

Expand Down Expand Up @@ -175,7 +175,7 @@ void select_screen(int which)
@param which screen identifier (see comment above)
Called by script when a frame is about to complete, and rendering
is to be done before proceeding to the next frame. this will
is to be done before proceeding to the next frame. this will
convert the 4-bit framebuffer to the native video output format. it
is also possible to flip between visible and invisible buffers using
which == 0xff
Expand All @@ -187,7 +187,7 @@ void update_screen(int which)
if (which == 0xfe)
{
src = screen_visible;
}
}
else if (which == 0xff)
{
char *d1, *d2;
Expand Down Expand Up @@ -218,7 +218,7 @@ int get_selected_screen()
}

/** Returns framebuffer address of working-screen
@returns pointer to framebuffer
@returns pointer to framebuffer
*/
char *get_selected_screen_ptr()
{
Expand Down

0 comments on commit 3e5581a

Please sign in to comment.