I forwent having multiple res files for SPRITE & IMAGE like your example.
Now after coming back to this, I cannot seem to recreate the same error. Now it throws ponyologo_image is undefined, even when I have specifically listed it inside GFX.res
Code: Select all
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <genesis.h>
#include "res/gfx.h"
#include "res/sound.h"
// DOC.TXT - For Documentation Help!! stored in C:\SGDK or Desktop!
// UPDATE THIS FOR EVERYTHING YOU DO!
// IF YOU FALL ASLEEP AND FORGET ALL THIS!
#define ANIM_STATIC  0
#define ANIM_SCORE   1
#define ANIM_BRONZE  2
#define ANIM_SILVER  3
#define ANIM_GOLD    4
#define ANIM_PLATIN  5
#define ANIM_INSTR   6
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define GRAVITY         FIX16(0.4)
#define MIN_POSX        FIX16(10)
#define MAX_POSX        FIX16(280)
#define MAX_POSY        FIX16(154)
#define SLIDESPEED      FIX16(6)
#define FALSE 0
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define TITLE   0 //SPLIT INTO SECTIONS TO MANAGE SUB ROUTINES BETTER
#define INTRO   1 //THIS IS GOOD PRACTICE
#define GAME    2 // NUMBER RELATES TO ORDER
#define INSTRUCTIONS 3//
#define MAX_SPRITE 16 // HOWEVER THIS SEEMS TO LIMIT WHATS AVAILABLE
//MAY HAVE TO LOOK AT SPLITTING LEVELS INTO SUBROUTINES
//I.E LOAD TITLE, FINISH GOTO GAME, FINISH GAME GOTO GAME 2 (LEVEL 2)
//LOOK AT IN FUTURE, CONCENTRATE ON
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//structure as follows,
// PLAN_A = Foreground, 1 = HP
// PLAN_B = Foreground, 0 = LP
// PLAN_B = Background, 1 = HP
// PLAN_B = Background, 0 = LP
// THIS MIMICS DEPTH PERCEPTION!
// DONT FORGET!
// WINDOW PLANE (PLAN_W??) IS STATIC AND STAYS AS HUD, NON SCROLLABLE
// After TILE_ATTR etc...
// PAL0 = Palette 0
// 0 = Priority high - 1 = Priority low
// VDP_drawImageEx(PLAN_B, &plan_b1, TILE_ATTR_FULL(PAL0, 0, FALSE, FALSE, ind), 0, 30, FALSE, TRUE);
// ind += plan_b1.tileset->numTile;
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// forward
static void disableInts(); // DECLARING INTERRUPTS OF VDP
static void enableInts();
static void joyEvent(u16 joy, u16 changed, u16 state); // JOYPAD READ
static void introJoyEvent(u16 joy, u16 changed, u16 state); // INTRODUCE JOYPAD
static void gameJoyEvent(u16 joy, u16 changed, u16 state); // READY FOR GAME, I THINK??
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// sprite structure
//Sprite allsprites[MAX_SPRITE];
//Sprite sprponyo = &allsprites[0];
//Sprite sprinstr = &allsprites[1];
Sprite sprites[MAX_SPRITE];
//Sprite sprflappy = &sprites[0];
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
fix16 camposx; // CAMERA POSITION X
fix16 camposy; // CAMERA POSITION Y
fix16 posx; // X PLACEMENT
fix16 posy; // Y PLACEMENT
fix16 movx; // MOVE POSITION X
fix16 movy; // MOVE POSITION Y
s16 xorder; // ??
s16 yorder; // ??
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int gamestate = TITLE;
int music_status;
volatile int waitflag = FALSE;
int score = 0; // SCORE TRACKER FOR LATER
int PonyoTitlePosition = 250;
char ponyoPosString;
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main()
{
//Title screen
    u16 tileIndex = TILE_USERINDEX;
    u16 ind = tileIndex;
    u16 palette[64]; //64 = 8*8 Palette
    //play VGM
    //SND_startPlay_XGM(ponyo_music.vgm);
    // screen w
    VDP_setScreenWidth320();
    VDP_setPaletteColors(0, palette_black, 64);
    //Initialise pad
    JOY_init();
    //draw the background
    VDP_drawImageEx(PLAN_B, &ponyologo_image, TILE_ATTR_FULL(PAL0, FALSE, FALSE, FALSE, tileIndex), 0, 0, FALSE, TRUE);
    ind += ponyologo_image.tileset->numTile;
    //draw ponyo large
    //HOLD OFF ON THIS FOR NOW
    //VDP_drawImageEx(PLAN_A, &gamelogo, TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, tileIndex), 7, 4, TRUE, TRUE);
    //tileIndex += gamelogo.tileset->numTile;
    //draw logo ponyo
   //VDP_drawImage(PLAN_A, ponyologo_image, TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, tileIndex), 7, 4, TRUE, TRUE);
   // tileIndex += ponyologo_image.tileset->numTile;
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //Initialize sprite engine
    //SPR_init(256);
    //Draw the title screen text
    VDP_drawText("* Press START *", 8, 12);
    VDP_drawText("By Joseph Ioannou (53K70R)", 7, 26);
    camposx = FIX16(0);
    camposy = FIX16(0);
    posx = FIX16(250);
    posy = FIX16(42);
    movx = FIX16(0);
    movy = FIX16(0);
    xorder = 0;
    yorder = 0;
    // initialize the sprite (Flappy! :D)
    //SPR_initSprite(&sprites[0], &flappy_sprite, fix16ToInt(posx), fix16ToInt(posy), TILE_ATTR(PAL0, TRUE, FALSE, FALSE));
    //SPR_update(&sprites[0], 1);
    // prepare the palette
    //memcpy(&palette[0], bga_image.palette->data, 16*2);
    //memcpy(&palette[16], ponyologo.palette->data, 16*2);
    //memcpy(&palette[32], flappy_sprite.palette->data, 16*2);
    JOY_setEventHandler(joyEvent);
 while(TRUE)
 {
   switch(gamestate)
   {
      case INTRO:
        //updateIntroAnim();
        //Clear the A Plane to remove the logo and title screen text
        VDP_clearPlan(PLAN_A, FALSE);
        //ponyo movement
        //for (flappyTitlePosition; flappyTitlePosition>0; flappyTitlePosition--)
        //{
        //   SPR_setPosition(&sprites[0], ponyoTitlePosition, fix16ToInt(posy));
        //    SPR_update(&sprites, 2);
        //    VDP_waitVSync();
        //}
        //VDP_waitVSync();
        //stop playing music
        //SND_stopPlay_VGM();
        //SPR_initSprite(&sprites[1], &ponyo_sprite, 140, 80, TILE_ATTR(PAL0, TRUE, FALSE, FALSE));
        //SPR_setAnim(&sprites[1], ANIM_INSTR);
        //SPR_update(&sprites, 2);
        VDP_waitVSync();
        gamestate = INSTRUCTIONS;
        break;
      case GAME:
        //updateGameAnim();
        SPR_setPosition(&sprites[1], -100, -100);
        VDP_drawText("Score:", 0, 0);
        //SND_stopPlay_VGM();
        //update sprites
        //disableInts();
        SPR_update(&sprites, 2);
        //enableInts();
        VDP_waitVSync();
        JOY_setEventHandler(gameJoyEvent);
        break;
      case INSTRUCTIONS:
        //updateGameAnim();
        JOY_setEventHandler(introJoyEvent);
        //update sprites
        //disableInts();
        SPR_update(&sprites, 2);
        //enableInts();
        VDP_waitVSync();
        break;
      case TITLE:
        disableInts();
        SPR_update(&sprites, 1);
        enableInts();
        VDP_waitVSync();
        break;
    }
 }
return 0;
}
static void disableInts()
{
    if (!SYS_isInInterrupt()) SYS_disableInts();
}
static void enableInts()
{
    if (!SYS_isInInterrupt()) SYS_enableInts();
}
static void introJoyEvent(u16 joy, u16 changed, u16 state)
{
    // START button state changed
    if (changed & BUTTON_START)
    {
    }
    if (changed & state & (BUTTON_A | BUTTON_B | BUTTON_C))
    {
        gamestate = GAME;
    }
}
static void gameJoyEvent(u16 joy, u16 changed, u16 state)
{
    // START button state changed
    if (changed & BUTTON_START)
    {
    }
    //if (changed & state & (BUTTON_A | BUTTON_B | BUTTON_C))
    {
        //SND_startPlayPCM_XGM(ponyo_jump, 1, SOUND_PCM_CH4);
        //SND_startPlay_VGM(ponyo_music.vgm);
    }
}
static void joyEvent(u16 joy, u16 changed, u16 state)
{
    // START button state changed
    if (changed & BUTTON_START)
    {
        gamestate = INTRO;
    }
    if (changed & state & (BUTTON_A | BUTTON_B | BUTTON_C))
    {
    }
}