mirror of
https://github.com/dwsJason/xrick2gs.git
synced 2025-08-15 14:27:19 +00:00
stubout draw_img, so that the game doesn't crash
This commit is contained in:
@@ -111,7 +111,11 @@ static U8 *fb; /* frame buffer pointer */
|
|||||||
void
|
void
|
||||||
draw_setfb(U16 x, U16 y)
|
draw_setfb(U16 x, U16 y)
|
||||||
{
|
{
|
||||||
|
#ifdef IIGS
|
||||||
|
fb = sysvid_fb + x + y * (SYSVID_WIDTH/2);
|
||||||
|
#else
|
||||||
fb = sysvid_fb + x + y * SYSVID_WIDTH;
|
fb = sysvid_fb + x + y * SYSVID_WIDTH;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -696,8 +700,11 @@ draw_img(img_t *i)
|
|||||||
draw_setfb(0, 0);
|
draw_setfb(0, 0);
|
||||||
if (i->ncolors > 0)
|
if (i->ncolors > 0)
|
||||||
sysvid_setPalette(i->colors, i->ncolors);
|
sysvid_setPalette(i->colors, i->ncolors);
|
||||||
|
#ifndef IIGS
|
||||||
for (k = 0; k < SYSVID_WIDTH * SYSVID_HEIGHT; k++)
|
for (k = 0; k < SYSVID_WIDTH * SYSVID_HEIGHT; k++)
|
||||||
fb[k] = i->pixels[k];
|
fb[k] = i->pixels[k];
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
37
src/game.c
37
src/game.c
@@ -251,6 +251,35 @@ game_run(void)
|
|||||||
freedata(); /* free cached data */
|
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
|
* Prepare frame
|
||||||
*
|
*
|
||||||
@@ -263,6 +292,12 @@ frame(void)
|
|||||||
{
|
{
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
|
{
|
||||||
|
printf("game_state = %s\n", game_state_strings[game_state]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch (game_state) {
|
switch (game_state) {
|
||||||
|
|
||||||
|
|
||||||
@@ -575,6 +610,8 @@ init(void)
|
|||||||
{
|
{
|
||||||
U8 i;
|
U8 i;
|
||||||
|
|
||||||
|
printf("game.c: init(void);\n");
|
||||||
|
|
||||||
E_RICK_STRST(0xff);
|
E_RICK_STRST(0xff);
|
||||||
|
|
||||||
game_lives = 6;
|
game_lives = 6;
|
||||||
|
@@ -225,6 +225,9 @@ processEvent()
|
|||||||
void
|
void
|
||||||
sysevt_poll(void)
|
sysevt_poll(void)
|
||||||
{
|
{
|
||||||
|
#ifdef IIGS
|
||||||
|
printf("sysevt_poll\n");
|
||||||
|
#endif
|
||||||
#ifndef IIGS
|
#ifndef IIGS
|
||||||
while (SDL_PollEvent(&event))
|
while (SDL_PollEvent(&event))
|
||||||
processEvent();
|
processEvent();
|
||||||
@@ -237,6 +240,9 @@ sysevt_poll(void)
|
|||||||
void
|
void
|
||||||
sysevt_wait(void)
|
sysevt_wait(void)
|
||||||
{
|
{
|
||||||
|
#ifdef IIGS
|
||||||
|
printf("sysevt_wait\n");
|
||||||
|
#endif
|
||||||
#ifndef IIGS
|
#ifndef IIGS
|
||||||
SDL_WaitEvent(&event);
|
SDL_WaitEvent(&event);
|
||||||
processEvent();
|
processEvent();
|
||||||
|
@@ -105,7 +105,7 @@ sys_sleep(int s)
|
|||||||
while (s > 0)
|
while (s > 0)
|
||||||
{
|
{
|
||||||
sysvid_wait_vblank();
|
sysvid_wait_vblank();
|
||||||
s -= 16; // Abouy 1/60th of a second
|
s -= 16; // About 1/60th of a second
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifndef IIGS
|
#ifndef IIGS
|
||||||
|
18
src/sysvid.c
18
src/sysvid.c
@@ -238,6 +238,12 @@ sysvid_init(void)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
printf("SUCCESS\n");
|
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
|
#endif
|
||||||
#ifndef IIGS
|
#ifndef IIGS
|
||||||
SDL_Surface *s;
|
SDL_Surface *s;
|
||||||
@@ -459,6 +465,7 @@ void sysvid_wait_vblank()
|
|||||||
#ifdef IIGS
|
#ifdef IIGS
|
||||||
volatile const S8* VSTATUS = (S8*) 0xC019;
|
volatile const S8* VSTATUS = (S8*) 0xC019;
|
||||||
|
|
||||||
|
#if 1
|
||||||
// While already in vblank wait
|
// While already in vblank wait
|
||||||
while ((*VSTATUS & 0x80) == 0)
|
while ((*VSTATUS & 0x80) == 0)
|
||||||
{
|
{
|
||||||
@@ -468,6 +475,17 @@ void sysvid_wait_vblank()
|
|||||||
{
|
{
|
||||||
// Wait for VBLANK to BEGIN
|
// 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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user