stubout draw_img, so that the game doesn't crash

This commit is contained in:
dwsJason 2018-08-05 14:12:14 -04:00
parent cd76e114c0
commit 3e1afcb736
5 changed files with 70 additions and 2 deletions

View File

@ -111,7 +111,11 @@ static U8 *fb; /* frame buffer pointer */
void
draw_setfb(U16 x, U16 y)
{
fb = sysvid_fb + x + y * SYSVID_WIDTH;
#ifdef IIGS
fb = sysvid_fb + x + y * (SYSVID_WIDTH/2);
#else
fb = sysvid_fb + x + y * SYSVID_WIDTH;
#endif
}
@ -696,8 +700,11 @@ draw_img(img_t *i)
draw_setfb(0, 0);
if (i->ncolors > 0)
sysvid_setPalette(i->colors, i->ncolors);
#ifndef IIGS
for (k = 0; k < SYSVID_WIDTH * SYSVID_HEIGHT; k++)
fb[k] = i->pixels[k];
#endif
}

View File

@ -251,6 +251,35 @@ game_run(void)
freedata(); /* free cached data */
}
static char* game_state_strings[] =
{
#ifdef ENABLE_DEVTOOLS
"DEVTOOLS",
#endif
"XRICK",
"INIT_GAME",
"INIT_BUFFER",
"INTRO_MAIN",
"INTRO_MAP",
"PAUSE_PRESSED1",
"PAUSE_PRESSED1B",
"PAUSED",
"PAUSE_PRESSED2",
"PLAY0",
"PLAY1",
"PLAY2",
"PLAY3",
"CHAIN_SUBMAP",
"CHAIN_MAP",
"CHAIN_END",
"SCROLL_UP",
"SCROLL_DOWN",
"RESTART",
"GAMEOVER",
"GETNAME",
"EXIT"
};
/*
* Prepare frame
*
@ -263,6 +292,12 @@ frame(void)
{
while (1) {
{
printf("game_state = %s\n", game_state_strings[game_state]);
}
switch (game_state) {
@ -575,6 +610,8 @@ init(void)
{
U8 i;
printf("game.c: init(void);\n");
E_RICK_STRST(0xff);
game_lives = 6;

View File

@ -225,6 +225,9 @@ processEvent()
void
sysevt_poll(void)
{
#ifdef IIGS
printf("sysevt_poll\n");
#endif
#ifndef IIGS
while (SDL_PollEvent(&event))
processEvent();
@ -237,6 +240,9 @@ sysevt_poll(void)
void
sysevt_wait(void)
{
#ifdef IIGS
printf("sysevt_wait\n");
#endif
#ifndef IIGS
SDL_WaitEvent(&event);
processEvent();

View File

@ -105,7 +105,7 @@ sys_sleep(int s)
while (s > 0)
{
sysvid_wait_vblank();
s -= 16; // Abouy 1/60th of a second
s -= 16; // About 1/60th of a second
}
#endif
#ifndef IIGS

View File

@ -238,6 +238,12 @@ sysvid_init(void)
exit(1);
}
printf("SUCCESS\n");
// Allocate Some Direct Page memory
//directPage = NewHandle( 0x200, userid(), 0xC005, 0 );
//BlitFieldHndl = NewHandle(0x10000, userid(), 0xC014, 0);
sysvid_fb = (U8*)0x12000;
#endif
#ifndef IIGS
SDL_Surface *s;
@ -459,6 +465,7 @@ void sysvid_wait_vblank()
#ifdef IIGS
volatile const S8* VSTATUS = (S8*) 0xC019;
#if 1
// While already in vblank wait
while ((*VSTATUS & 0x80) == 0)
{
@ -468,6 +475,17 @@ void sysvid_wait_vblank()
{
// Wait for VBLANK to BEGIN
}
#else
// While already in vblank wait
while (VSTATUS[0] >= 0)
{
// Wait for VBLANK to END
}
while (VSTATUS[0] < 0)
{
// Wait for VBLANK to BEGIN
}
#endif
#endif
}