User Tools

Site Tools


kirby64_the_crystal_shards:levels

This is an old revision of the document!


Levels

Each level loads a struct of areas using function 0x800F78E4. I uses this structure to find the pointer to the current area in the main stage table.

Level struct (800be500):
{
/*0X0*/ U32    WORLD
/*0X4*/ U32    LEVEL
/*0X8*/ U32    AREA
/*0XC*/ U32    WARP/DIRECTION
}

The pointer to the main stage table is gotten by using this formula:

WORLD*48+LEVEL*4 loaded from offset 0x800d1f98(table of ptrs)

Each Area is then just an additional 0x24 from that level pointer.


Level List

The table at 0x000783F4 in ROM (0x800D01A4 in RAM) references data for each stage in the game. For each stage there is an array of area structs. Each array is terminated with an empty struct.

struct StageArea
{
  /*0x00*/ u32   liGeoBlockA;      // List-index of primary Geometry Block
  /*0x04*/ u32   liGeoBlockB;      // List-index of secondary Geometry Block
  /*0x08*/ u16   skyboxId;         // Skybox ID
  /*0x0A*/ u16   background color; // BG color (loaded from color table at 800D478C)
  /*0x0C*/ int   musicId;          // Music ID
  /*0x10*/ u32   biAreaSetup;      // Bank-index of area stup block 
  /*0x14*/ u16   Death Camera;     // Determines how far the camera follows kirby when falling into void/death
  /*0x16*/ u16   unk16;            // Cutscene related?
  /*0x18*/ u32   biDustSettings;   // Bank-index of Dust particle settings
  /*0x1C*/ u32   biDustImg;        // Bank-index of Dust particle image
  /*0x20*/ char *areaName;         // Pointer to developer ASCII level name
};

Area Setup Blocks

Area setup blocks define the camera settings, collisions, and object placements for areas. The high level structure is as follows (in order):

  1. HEADER
  2. UNKNOWN1
  3. UNKNOWN2
  4. HEADER2
  5. OBJECTS
struct AreaSettingsHeader
{
    /*0x00*/ u32 offsUnkown2;   // relative offset of UNKNOWN2 section
    /*0x04*/ u32 offsHeader2;   // relative offset of HEADER2 section
    /*0x08*/ u32 offsObjects;   // relative offset of OBJECTS section
};

UNKNOWN1

UNKNOWN2

HEADER2

Collision and camera related.

OBJECTS

This section defines how objects are placed in an area. It contains an array of the following struct:

struct ObjectPlacement // 0x2C bytes each
{
   /*0x00*/ u8  unk00;
   /*0x01*/ u8  unk01;
   /*0x02*/ u8  objectId;
   /*0x04*/ u8  unk04;
   /*0x05*/ u8  unk05;
   /*0x06*/ u16 unk06;
   /*....*/
   /*0x20*/ f32 scale;
   /*0x24*/ xPos;
   /*....*/
};

There is a 4-byte end marker (0x99999999) at the end of the array. The function at 0x800FC9C0 is used to spawn objects when Kirby is within range.


See also

kirby64_the_crystal_shards/levels.1579564058.txt.gz · Last modified: 2020/01/20 23:47 by jesusyoshi54