You've already forked ultrasm64-2
mirror of
https://github.com/HackerN64/ultrasm64-2.git
synced 2026-01-21 10:38:08 -08:00
Make skyboxes easier to define
This commit is contained in:
@@ -10,17 +10,11 @@
|
||||
#include "game/mario_misc.h"
|
||||
#include "game/mario_actions_cutscene.h"
|
||||
|
||||
// sky background params
|
||||
#define BACKGROUND_OCEAN_SKY 0
|
||||
#define BACKGROUND_FLAMING_SKY 1
|
||||
#define BACKGROUND_UNDERWATER_CITY 2
|
||||
#define BACKGROUND_BELOW_CLOUDS 3
|
||||
#define BACKGROUND_SNOW_MOUNTAINS 4
|
||||
#define BACKGROUND_DESERT 5
|
||||
#define BACKGROUND_HAUNTED 6
|
||||
#define BACKGROUND_GREEN_SKY 7
|
||||
#define BACKGROUND_ABOVE_CLOUDS 8
|
||||
#define BACKGROUND_PURPLE_SKY 9
|
||||
enum SkyBackgroundParams {
|
||||
#define SKYBOX_ENUM
|
||||
#include "skyboxes.h"
|
||||
#undef SKYBOX_ENUM
|
||||
};
|
||||
|
||||
// geo layout macros
|
||||
|
||||
|
||||
@@ -65,16 +65,9 @@ DECLARE_LEVEL_SEGMENT(ending)
|
||||
|
||||
DECLARE_SEGMENT(segment2_mio0)
|
||||
|
||||
DECLARE_SEGMENT(water_skybox_mio0)
|
||||
DECLARE_SEGMENT(ccm_skybox_mio0)
|
||||
DECLARE_SEGMENT(clouds_skybox_mio0)
|
||||
DECLARE_SEGMENT(bitfs_skybox_mio0)
|
||||
DECLARE_SEGMENT(wdw_skybox_mio0)
|
||||
DECLARE_SEGMENT(cloud_floor_skybox_mio0)
|
||||
DECLARE_SEGMENT(ssl_skybox_mio0)
|
||||
DECLARE_SEGMENT(bbh_skybox_mio0)
|
||||
DECLARE_SEGMENT(bidw_skybox_mio0)
|
||||
DECLARE_SEGMENT(bits_skybox_mio0)
|
||||
#define SKYBOX_SYMBOLS_ROM
|
||||
#include "skyboxes.h"
|
||||
#undef SKYBOX_SYMBOLS_ROM
|
||||
|
||||
DECLARE_SEGMENT(fire_mio0)
|
||||
DECLARE_SEGMENT(spooky_mio0)
|
||||
|
||||
40
include/skyboxes.h
Normal file
40
include/skyboxes.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifdef SKYBOX_SYMBOLS
|
||||
#define DEFINE_SKYBOX(symbol, enumeration) extern SkyboxTexture symbol##_skybox_ptrlist;
|
||||
#endif
|
||||
|
||||
#ifdef SKYBOX_SYMBOLS_REFERENCE
|
||||
#define DEFINE_SKYBOX(symbol, enumeration) &symbol##_skybox_ptrlist,
|
||||
#endif
|
||||
|
||||
#ifdef SKYBOX_SYMBOLS_ROM
|
||||
#define DEFINE_SKYBOX(symbol, enumeration) \
|
||||
DECLARE_SEGMENT(symbol##_skybox_mio0)
|
||||
#endif
|
||||
|
||||
#ifdef SKYBOX_ENUM
|
||||
#define DEFINE_SKYBOX(symbol, enumeration) enumeration,
|
||||
#endif
|
||||
|
||||
#ifdef SKYBOX_LD
|
||||
#define DEFINE_SKYBOX(symbol, enumeration) MIO0_SEG(symbol##_skybox, 0x0A000000)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Defines skybox properties.
|
||||
*
|
||||
* @param symbol - Filename of the skybox used for symbol generation.
|
||||
* @param enumeration - Name used for the enum.
|
||||
*/
|
||||
|
||||
DEFINE_SKYBOX(water, BACKGROUND_OCEAN_SKY)
|
||||
DEFINE_SKYBOX(bitfs, BACKGROUND_FLAMING_SKY)
|
||||
DEFINE_SKYBOX(wdw, BACKGROUND_UNDERWATER_CITY)
|
||||
DEFINE_SKYBOX(cloud_floor, BACKGROUND_BELOW_CLOUDS)
|
||||
DEFINE_SKYBOX(ccm, BACKGROUND_SNOW_MOUNTAINS)
|
||||
DEFINE_SKYBOX(ssl, BACKGROUND_DESERT)
|
||||
DEFINE_SKYBOX(bbh, BACKGROUND_HAUNTED)
|
||||
DEFINE_SKYBOX(bidw, BACKGROUND_GREEN_SKY)
|
||||
DEFINE_SKYBOX(clouds, BACKGROUND_ABOVE_CLOUDS)
|
||||
DEFINE_SKYBOX(bits, BACKGROUND_PURPLE_SKY)
|
||||
|
||||
#undef DEFINE_SKYBOX
|
||||
18
sm64.ld
18
sm64.ld
@@ -200,11 +200,8 @@ SECTIONS
|
||||
BUILD_DIR/src/menu*.o(.text);
|
||||
BUILD_DIR/libgoddard.a:*.o(.text);
|
||||
BUILD_DIR/libgoddard.a:dynlist_proc.o(.text);
|
||||
|
||||
/* data, rodata, per file */
|
||||
BUILD_DIR/src/menu*.o(.data*);
|
||||
BUILD_DIR/src/menu*.o(.rodata*);
|
||||
/* goddard subsystem data */
|
||||
BUILD_DIR/libgoddard.a:*.o(.data*);
|
||||
BUILD_DIR/libgoddard.a:dynlist_proc.o(.data*);
|
||||
BUILD_DIR/libgoddard.a:*.o(.rodata*);
|
||||
@@ -221,7 +218,6 @@ SECTIONS
|
||||
}
|
||||
END_NOLOAD(goddard)
|
||||
|
||||
/* 0x268020 0x268020-0 [0] */
|
||||
BEGIN_SEG(intro, 0x14000000)
|
||||
{
|
||||
BUILD_DIR/levels/intro/script.o(.data);
|
||||
@@ -259,16 +255,9 @@ SECTIONS
|
||||
}
|
||||
END_SEG(scripts)
|
||||
|
||||
MIO0_SEG(water_skybox, 0x0A000000)
|
||||
MIO0_SEG(ccm_skybox, 0x0A000000)
|
||||
MIO0_SEG(clouds_skybox, 0x0A000000)
|
||||
MIO0_SEG(bitfs_skybox, 0x0A000000)
|
||||
MIO0_SEG(wdw_skybox, 0x0A000000)
|
||||
MIO0_SEG(cloud_floor_skybox, 0x0A000000)
|
||||
MIO0_SEG(ssl_skybox, 0x0A000000)
|
||||
MIO0_SEG(bbh_skybox, 0x0A000000)
|
||||
MIO0_SEG(bidw_skybox, 0x0A000000)
|
||||
MIO0_SEG(bits_skybox, 0x0A000000)
|
||||
#define SKYBOX_LD
|
||||
#include "skyboxes.h"
|
||||
#undef SKYBOX_LD
|
||||
|
||||
// Texture bins
|
||||
MIO0_SEG(fire, 0x09000000)
|
||||
@@ -293,7 +282,6 @@ SECTIONS
|
||||
#undef STUB_LEVEL
|
||||
#undef DEFINE_LEVEL
|
||||
|
||||
/* 4E9FA0-? [?] */
|
||||
BEGIN_SEG(assets, __romPos)
|
||||
{
|
||||
BUILD_DIR/assets/mario_anim_data.o(.data);
|
||||
|
||||
@@ -62,28 +62,14 @@ struct Skybox sSkyBoxInfo[2];
|
||||
|
||||
typedef const u8 *const SkyboxTexture[80];
|
||||
|
||||
extern SkyboxTexture bbh_skybox_ptrlist;
|
||||
extern SkyboxTexture bidw_skybox_ptrlist;
|
||||
extern SkyboxTexture bitfs_skybox_ptrlist;
|
||||
extern SkyboxTexture bits_skybox_ptrlist;
|
||||
extern SkyboxTexture ccm_skybox_ptrlist;
|
||||
extern SkyboxTexture cloud_floor_skybox_ptrlist;
|
||||
extern SkyboxTexture clouds_skybox_ptrlist;
|
||||
extern SkyboxTexture ssl_skybox_ptrlist;
|
||||
extern SkyboxTexture water_skybox_ptrlist;
|
||||
extern SkyboxTexture wdw_skybox_ptrlist;
|
||||
#define SKYBOX_SYMBOLS
|
||||
#include "skyboxes.h"
|
||||
#undef SKYBOX_SYMBOLS
|
||||
|
||||
SkyboxTexture *sSkyboxTextures[10] = {
|
||||
&water_skybox_ptrlist,
|
||||
&bitfs_skybox_ptrlist,
|
||||
&wdw_skybox_ptrlist,
|
||||
&cloud_floor_skybox_ptrlist,
|
||||
&ccm_skybox_ptrlist,
|
||||
&ssl_skybox_ptrlist,
|
||||
&bbh_skybox_ptrlist,
|
||||
&bidw_skybox_ptrlist,
|
||||
&clouds_skybox_ptrlist,
|
||||
&bits_skybox_ptrlist,
|
||||
SkyboxTexture *sSkyboxTextures[] = {
|
||||
#define SKYBOX_SYMBOLS_REFERENCE
|
||||
#include "skyboxes.h"
|
||||
#undef SKYBOX_SYMBOLS_REFERENCE
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user