Merge branch 'master' into puppycamera2

This commit is contained in:
Fazana committed 2021-07-24 16:07:36 +01:00
commit 11af76e1a5
167 files changed
+18776 -2102

No files matched your search

@@ -126,12 +126,12 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
u8 sameSound;
u8 cmd; // a0 sp3E, EU s2
u8 cmdSemitone; // sp3D, t0
u16 sp3A; // t2, a0, a1
u16 sp3A = 0; // t2, a0, a1
f32 tuning; // f0
s32 vel; // sp30, t3
s32 vel = 0; // sp30, t3
s32 usedSemitone; // a1
f32 freqScale; // sp28, f0
f32 sp24;
f32 freqScale = 0.0f; // sp28, f0
f32 sp24 = 0.0f;
f32 temp_f12;
f32 temp_f2;
+34
View File
@@ -49,6 +49,39 @@ struct AudioSessionSettingsEU gAudioSessionPresets[] = {
// - memory used for temporary sequences
// - memory used for temporary banks
#if defined(VERSION_JP) || defined(VERSION_US)
#ifdef EXPAND_AUDIO_HEAP
struct AudioSessionSettings gAudioSessionPresets[18] = {
#ifdef VERSION_JP
{ 32000, 32, 1, 0x0800, 0x2FFF, 0x7FFF, 0x7200, 0xC000, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x0A00, 0x47FF, 0x7FFF, 0x7200, 0xC000, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x1000, 0x2FFF, 0x7FFF, 0x7200, 0xC000, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x0E00, 0x3FFF, 0x7FFF, 0x7200, 0xC000, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x0C00, 0x4FFF, 0x7FFF, 0x7200, 0xC000, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x0800, 0x2FFF, 0x7FFF, 0x7C00, 0xC400, 0x7E00, 0x5400 },
{ 32000, 32, 1, 0x0A00, 0x47FF, 0x7FFF, 0x7E00, 0xC400, 0x8800, 0x5500 },
{ 32000, 40, 1, 0x0800, 0x37FF, 0x7FFF, 0x6600, 0xAA00, 0x8000, 0x3600 },
#else
{ 32000, 32, 1, 0x0C00, 0x2FFF, 0x7FFF, 0x7400, 0xDA00, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x0A00, 0x47FF, 0x7FFF, 0x7400, 0xDA00, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x1000, 0x2FFF, 0x7FFF, 0x7400, 0xDA00, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x0E00, 0x3FFF, 0x7FFF, 0x7400, 0xDA00, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x0C00, 0x4FFF, 0x7FFF, 0x7400, 0xDA00, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x0C00, 0x2FFF, 0x7FFF, 0x8000, 0xDC00, 0x7E00, 0x5400 },
{ 32000, 32, 1, 0x0A00, 0x47FF, 0x7FFF, 0x8200, 0xDC00, 0x8800, 0x5500 },
{ 32000, 40, 1, 0x0800, 0x37FF, 0x7FFF, 0x6980, 0xC500, 0x8000, 0x3600 },
#endif
{ 27000, 32, 1, 0x0800, 0x2FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 27000, 32, 1, 0x0800, 0x3FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 27000, 32, 1, 0x1000, 0x2FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 27000, 32, 1, 0x1000, 0x3FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 27000, 32, 1, 0x0C00, 0x4FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 32000, 28, 1, 0x0800, 0x2FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 32000, 24, 1, 0x0800, 0x2FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 32000, 20, 1, 0x0800, 0x2FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 32000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
#else
struct AudioSessionSettings gAudioSessionPresets[18] = {
#ifdef VERSION_JP
{ 32000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
@@ -81,6 +114,7 @@ struct AudioSessionSettings gAudioSessionPresets[18] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
#endif
#endif
// gAudioCosineTable[k] = round((2**15 - 1) * cos(pi/2 * k / 127)). Unused.
#if defined(VERSION_JP) || defined(VERSION_US)
u16 gAudioCosineTable[128] = {
+18 -4
View File
@@ -109,6 +109,20 @@ extern u16 gUnused80226E98[0x10];
extern u32 gAudioRandom;
#ifdef EXPAND_AUDIO_HEAP
#if defined(VERSION_US) || defined(VERSION_JP)
#define EXT_AUDIO_HEAP_SIZE 0x24400
#define EXT_AUDIO_INIT_POOL_SIZE 0x8000
#else
// EU and SH versions not yet supported for extended audio heap
#define EXT_AUDIO_HEAP_SIZE 0x0
#define EXT_AUDIO_INIT_POOL_SIZE 0x0
#endif
#else
#define EXT_AUDIO_HEAP_SIZE 0x0
#define EXT_AUDIO_INIT_POOL_SIZE 0x0
#endif
#ifdef VERSION_SH
extern f32 unk_sh_data_1[];
@@ -136,12 +150,12 @@ extern OSMesgQueue *D_SH_80350FA8;
#if defined(VERSION_EU) || defined(VERSION_SH)
#define UNUSED_COUNT_80333EE8 24
#define AUDIO_HEAP_SIZE 0x2c500
#define AUDIO_INIT_POOL_SIZE 0x2c00
#define AUDIO_HEAP_SIZE (0x2c500 + EXT_AUDIO_HEAP_SIZE + EXT_AUDIO_INIT_POOL_SIZE)
#define AUDIO_INIT_POOL_SIZE (0x2c00 + EXT_AUDIO_INIT_POOL_SIZE)
#else
#define UNUSED_COUNT_80333EE8 16
#define AUDIO_HEAP_SIZE 0x31150
#define AUDIO_INIT_POOL_SIZE 0x2500
#define AUDIO_HEAP_SIZE (0x31150 + EXT_AUDIO_HEAP_SIZE + EXT_AUDIO_INIT_POOL_SIZE)
#define AUDIO_INIT_POOL_SIZE (0x2500 + EXT_AUDIO_INIT_POOL_SIZE)
#endif
#ifdef VERSION_SH
+4 -2
View File
@@ -190,6 +190,7 @@ s8 get_vibrato_pitch_change(struct VibratoState *vib) {
switch (index & 0x30) {
case 0x10:
index = 31 - index;
// fall through
case 0x00:
return vib->curve[index];
@@ -385,8 +386,8 @@ s32 adsr_update(struct AdsrState *adsr) {
adsr->state = ADSR_STATE_HANG;
break;
}
// fallthrough
}
// fall through
case ADSR_STATE_START_LOOP:
adsr->envIndex = 0;
@@ -394,11 +395,12 @@ s32 adsr_update(struct AdsrState *adsr) {
adsr->currentHiRes = adsr->current << 0x10;
#endif
adsr->state = ADSR_STATE_LOOP;
// fallthrough
#ifdef VERSION_SH
restart:
#endif
// fall through
case ADSR_STATE_LOOP:
adsr->delay = BSWAP16(adsr->envelope[adsr->envIndex].delay);
switch (adsr->delay) {
+2 -2
View File
@@ -409,9 +409,9 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
#endif
u32 nullID = -1;
UNUSED s32 i;
u8 *table;
u8 *table = NULL;
#ifndef VERSION_SH
u8 isSound;
u8 isSound = FALSE;
#endif
#if defined(VERSION_JP) || defined(VERSION_US)
u16 firstVal;
+4 -4
View File
@@ -764,8 +764,8 @@ u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount) {
}
struct AudioBank *load_banks_immediate(s32 seqId, u8 *outDefaultBank) {
void *ret;
u32 bankId;
void *ret = NULL;
u32 bankId = 0;
u16 offset;
u8 i;
@@ -945,10 +945,10 @@ void audio_init() {
// It seems boot.s doesn't clear the .bss area for audio, so do it here.
i = 0;
lim3 = ((uintptr_t) &gAudioGlobalsEndMarker - (uintptr_t) &gAudioGlobalsStartMarker) / 8;
ptr64 = &gAudioGlobalsStartMarker - 1;
ptr64 = &gAudioGlobalsStartMarker;
for (k = lim3; k >= 0; k--) {
i++;
ptr64[i] = 0;
i++;
}
#endif
+2 -2
View File
@@ -1493,7 +1493,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
u8 loBits;
u16 sp5A;
s32 sp38;
s8 value;
s8 value = 0;
s32 i;
u8 *seqData;
@@ -2235,7 +2235,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
#endif
u8 loBits;
u8 temp;
s32 value;
s32 value = 0;
s32 i;
u16 u16v;
u8 *seqData;
+8 -8
View File
@@ -35,7 +35,7 @@
aSetBuffer(pkt, 0, 0, c + DMEM_ADDR_WET_RIGHT_CH, d); \
aSaveBuffer(pkt, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.ringBuffer.right + (off)));
#define ALIGN(val, amnt) (((val) + (1 << amnt) - 1) & ~((1 << amnt) - 1))
#define AUDIO_ALIGN(val, amnt) (((val) + (1 << amnt) - 1) & ~((1 << amnt) - 1))
struct VolumeChange {
u16 sourceLeft;
@@ -379,7 +379,7 @@ u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s1
aMix(cmd++, 0, 0x8000 + gSynthesisReverbs[reverbIndex].reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH);
} else {
startPad = (item->startPos % 8u) * 2;
paddedLengthA = ALIGN(startPad + item->lengthA, 4);
paddedLengthA = AUDIO_ALIGN(startPad + item->lengthA, 4);
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED, (item->startPos - startPad / 2), DEFAULT_LEN_1CH, reverbIndex);
if (item->lengthB != 0) {
@@ -539,7 +539,7 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateI
// Same as above but upsample the previously downsampled samples used for reverb first
temp = 0; //! jesus christ
t4 = (v1->startPos & 7) * 2;
ra = ALIGN(v1->lengthA + t4, 4);
ra = AUDIO_ALIGN(v1->lengthA + t4, 4);
aSetLoadBufferPair(cmd++, 0, v1->startPos - t4 / 2);
if (v1->lengthB != 0) {
// Ring buffer wrapped
@@ -606,11 +606,11 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) {
UNUSED u8 pad7[0x0c]; // sp100
UNUSED s32 tempBufLen;
#ifdef VERSION_EU
s32 sp130; //sp128, sp104
s32 sp130 = 0; //sp128, sp104
UNUSED u32 pad9;
#else
UNUSED u32 pad9;
s32 sp130; //sp128, sp104
s32 sp130 = 0; //sp128, sp104
#endif
s32 nAdpcmSamplesProcessed; // signed required for US
s32 t0;
@@ -891,7 +891,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) {
VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->adpcmdecState));
sp130 = s2 * 2;
} else {
s5Aligned = ALIGN(s5, 5);
s5Aligned = AUDIO_ALIGN(s5, 5);
aSetBuffer(cmd++, 0, DMEM_ADDR_COMPRESSED_ADPCM_DATA + a3,
DMEM_ADDR_UNCOMPRESSED_NOTE + s5Aligned, s0 * 2);
aADPCMdec(cmd++, flags,
@@ -905,9 +905,9 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) {
aADPCMdec(cmd++, flags, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->adpcmdecState));
sp130 = s2 * 2;
} else {
aSetBuffer(cmd++, 0, DMEM_ADDR_COMPRESSED_ADPCM_DATA + a3, DMEM_ADDR_UNCOMPRESSED_NOTE + ALIGN(s5, 5), s0 * 2);
aSetBuffer(cmd++, 0, DMEM_ADDR_COMPRESSED_ADPCM_DATA + a3, DMEM_ADDR_UNCOMPRESSED_NOTE + AUDIO_ALIGN(s5, 5), s0 * 2);
aADPCMdec(cmd++, flags, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->adpcmdecState));
aDMEMMove(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + ALIGN(s5, 5) + (s2 * 2), DMEM_ADDR_UNCOMPRESSED_NOTE + s5, (nSamplesInThisIteration) * 2);
aDMEMMove(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + AUDIO_ALIGN(s5, 5) + (s2 * 2), DMEM_ADDR_UNCOMPRESSED_NOTE + s5, (nSamplesInThisIteration) * 2);
}
#endif
+4 -3
View File
@@ -2,6 +2,7 @@
#include <hvqm2dec.h>
#include "buffers.h"
#include "audio/data.h"
#ifdef HVQM
#include <hvqm/hvqm.h>
#endif
@@ -9,11 +10,11 @@
ALIGNED8 u8 gDecompressionHeap[0xD000];
#if defined(VERSION_EU)
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200) - 0x3800];
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200 + EXT_AUDIO_HEAP_SIZE + EXT_AUDIO_INIT_POOL_SIZE) - 0x3800];
#elif defined(VERSION_SH)
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200) - 0x4800];
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200 + EXT_AUDIO_HEAP_SIZE + EXT_AUDIO_INIT_POOL_SIZE) - 0x4800];
#else
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200)];
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200 + EXT_AUDIO_HEAP_SIZE + EXT_AUDIO_INIT_POOL_SIZE)];
#endif
ALIGNED8 u8 gIdleThreadStack[0x800];
+84
View File
@@ -0,0 +1,84 @@
#ifndef __EXTENDED_BOUNDS_H__
#define __EXTENDED_BOUNDS_H__
/*
Better Extended Bounds by anonymous_moose
Thanks to someone2639 for the shiftable segments patch
Thanks to Wiseguy for the Surface Pool Full error code and 4x bounds fix
0: Regular bounds
Same as vanilla sm64, boundaries are (-8192 to 8191)
16x16 collision cells.
1: 2x extended bounds
level boundaries are twice as big (-16384 to 16383)
Collision calculations remain as fast as vanilla, at the cost of using more RAM.
32x32 collision cells.
2: Regular bounds (performance)
Same boundaries as vanilla (-8192 to 8191), but with twice the amount of collision cells
Trades more RAM usage for faster collision calculations.
32x32 collision cells.
3: 4x extended bounds
level boundaries are 4 times as big (-32768 to 32767)
Collision calculations remain as fast as vanilla, at the cost of using far more RAM (16 times vanilla).
64x64 collision cells.
If you see "SURFACE POOL FULL" or "SURFACE NODE POOL FULL" in game, you should increase
SURFACE_POOL_SIZE or SURFACE_NODE_POOL_SIZE, respectively, or reduce the amount of
collision surfaces in your level.
*/
//for the static assert macro
#include "macros.h"
//set this to the extended bounds mode you want, then do "make clean".
#define EXTENDED_BOUNDS_MODE 1
//the maximum amount of collision surfaces (static and dynamic combined)
//8200 should work fine for a 2x extended stage, the vanilla value is 2300
#define SURFACE_POOL_SIZE 4000
//make this approximately (amount of collision cells) + (SURFACE_POOL_SIZE * 3)
//22000 should work fine for a 2x extended stage, the vanilla value is 7000
#define SURFACE_NODE_POOL_SIZE 12000
//don't touch the stuff past this point unless you know what you're doing!
//default value to check if the user set a proper extended bounds mode
#define LEVEL_BOUNDARY_MAX 0x0000
#if EXTENDED_BOUNDS_MODE == 0
#undef LEVEL_BOUNDARY_MAX // Undefine the old value to avoid compiler warnings
#define LEVEL_BOUNDARY_MAX 0x2000L
#define CELL_SIZE 0x400
#define WORLD_SCALE 1.f
#elif EXTENDED_BOUNDS_MODE == 1
#undef LEVEL_BOUNDARY_MAX
#define LEVEL_BOUNDARY_MAX 0x4000L
#define CELL_SIZE 0x400
#define WORLD_SCALE 2.f
#elif EXTENDED_BOUNDS_MODE == 2
#undef LEVEL_BOUNDARY_MAX
#define LEVEL_BOUNDARY_MAX 0x2000L
#define CELL_SIZE 0x200
#define WORLD_SCALE 1.f
#elif EXTENDED_BOUNDS_MODE == 3
#undef LEVEL_BOUNDARY_MAX
#define LEVEL_BOUNDARY_MAX 0x8000L
#define CELL_SIZE 0x400
#define WORLD_SCALE 4.f
#endif
STATIC_ASSERT(LEVEL_BOUNDARY_MAX != 0, "You must set a valid extended bounds mode!");
#define NUM_CELLS (2 * LEVEL_BOUNDARY_MAX / CELL_SIZE)
#define NOT_ENOUGH_ROOM_FOR_SURFACES (1 << 0)
#define NOT_ENOUGH_ROOM_FOR_NODES (1 << 1)
#endif // __EXTENDED_BOUNDS_H__
+1 -1
View File
@@ -258,7 +258,7 @@ void geo_layout_cmd_node_perspective(void) {
GraphNodeFunc frustumFunc = NULL;
s16 fov = cur_geo_cmd_s16(0x02);
s16 near = cur_geo_cmd_s16(0x04);
s16 far = cur_geo_cmd_s16(0x06);
u16 far = cur_geo_cmd_s16(0x06);
if (cur_geo_cmd_u8(0x01) != 0) {
// optional asm function
+1 -1
View File
@@ -79,7 +79,7 @@ init_graph_node_ortho_projection(struct AllocOnlyPool *pool, struct GraphNodeOrt
*/
struct GraphNodePerspective *init_graph_node_perspective(struct AllocOnlyPool *pool,
struct GraphNodePerspective *graphNode,
f32 fov, s16 near, s16 far,
f32 fov, s16 near, u16 far,
GraphNodeFunc nodeFunc, s32 unused) {
if (pool != NULL) {
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodePerspective));
+2 -2
View File
@@ -108,7 +108,7 @@ struct GraphNodePerspective
/*0x18*/ s32 unused;
/*0x1C*/ f32 fov; // horizontal field of view in degrees
/*0x20*/ s16 near; // near clipping plane
/*0x22*/ s16 far; // far clipping plane
/*0x22*/ u16 far; // far clipping plane
};
/** An entry in the master list. It is a linked list of display lists
@@ -368,7 +368,7 @@ struct GraphNodeRoot *init_graph_node_root(struct AllocOnlyPool *pool, struct Gr
s16 areaIndex, s16 x, s16 y, s16 width, s16 height);
struct GraphNodeOrthoProjection *init_graph_node_ortho_projection(struct AllocOnlyPool *pool, struct GraphNodeOrthoProjection *graphNode, f32 scale);
struct GraphNodePerspective *init_graph_node_perspective(struct AllocOnlyPool *pool, struct GraphNodePerspective *graphNode,
f32 fov, s16 near, s16 far, GraphNodeFunc nodeFunc, s32 unused);
f32 fov, s16 near, u16 far, GraphNodeFunc nodeFunc, s32 unused);
struct GraphNodeStart *init_graph_node_start(struct AllocOnlyPool *pool, struct GraphNodeStart *graphNode);
struct GraphNodeMasterList *init_graph_node_master_list(struct AllocOnlyPool *pool, struct GraphNodeMasterList *graphNode, s16 on);
struct GraphNodeLevelOfDetail *init_graph_node_render_range(struct AllocOnlyPool *pool, struct GraphNodeLevelOfDetail *graphNode,
+17 -15
View File
@@ -25,6 +25,8 @@
#include "surface_collision.h"
#include "surface_load.h"
#include "config.h"
#define CMD_GET(type, offset) (*(type *) (CMD_PROCESS_OFFSET(offset) + (u8 *) sCurrentCmd))
// These are equal
@@ -281,7 +283,7 @@ static void level_cmd_load_yay0(void) {
}
static void level_cmd_load_mario_head(void) {
#ifdef GODDARD
#ifdef KEEP_MARIO_HEAD
// TODO: Fix these hardcoded sizes
void *addr = main_pool_alloc(DOUBLE_SIZE_ON_64_BIT(0xE1000), MEMORY_POOL_LEFT);
if (addr != NULL) {
@@ -373,24 +375,24 @@ static void level_cmd_end_area(void) {
}
static void level_cmd_load_model_from_dl(void) {
s16 val1 = CMD_GET(s16, 2) & 0x0FFF;
s16 val2 = ((u16)CMD_GET(s16, 2)) >> 12;
void *val3 = CMD_GET(void *, 4);
ModelID model = CMD_GET(ModelID, 0xA);
s16 layer = CMD_GET(u16, 0x8);
void *dl_ptr = CMD_GET(void *, 4);
if (val1 < 256) {
gLoadedGraphNodes[val1] =
(struct GraphNode *) init_graph_node_display_list(sLevelPool, 0, val2, val3);
if (model < MODEL_ID_COUNT) {
gLoadedGraphNodes[model] =
(struct GraphNode *) init_graph_node_display_list(sLevelPool, 0, layer, dl_ptr);
}
sCurrentCmd = CMD_NEXT;
}
static void level_cmd_load_model_from_geo(void) {
s16 arg0 = CMD_GET(s16, 2);
void *arg1 = CMD_GET(void *, 4);
ModelID model = CMD_GET(ModelID, 2);
void *geo = CMD_GET(void *, 4);
if (arg0 < 256) {
gLoadedGraphNodes[arg0] = process_geo_layout(sLevelPool, arg1);
if (model < MODEL_ID_COUNT) {
gLoadedGraphNodes[model] = process_geo_layout(sLevelPool, geo);
}
sCurrentCmd = CMD_NEXT;
@@ -402,13 +404,13 @@ static void level_cmd_23(void) {
f32 f;
} arg2;
s16 model = CMD_GET(s16, 2) & 0x0FFF;
ModelID model = CMD_GET(s16, 2) & 0x0FFF;
s16 arg0H = ((u16)CMD_GET(s16, 2)) >> 12;
void *arg1 = CMD_GET(void *, 4);
// load an f32, but using an integer load instruction for some reason (hence the union)
arg2.i = CMD_GET(s32, 8);
if (model < 256) {
if (model < MODEL_ID_COUNT) {
// GraphNodeScale has a GraphNode at the top. This
// is being stored to the array, so cast the pointer.
gLoadedGraphNodes[model] =
@@ -426,7 +428,7 @@ static void level_cmd_init_mario(void) {
gMarioSpawnInfo->areaIndex = 0;
gMarioSpawnInfo->behaviorArg = CMD_GET(u32, 4);
gMarioSpawnInfo->behaviorScript = CMD_GET(void *, 8);
gMarioSpawnInfo->unk18 = gLoadedGraphNodes[CMD_GET(u8, 3)];
gMarioSpawnInfo->unk18 = gLoadedGraphNodes[CMD_GET(ModelID, 0x2)];
gMarioSpawnInfo->next = NULL;
sCurrentCmd = CMD_NEXT;
@@ -438,7 +440,7 @@ static void level_cmd_place_object(void) {
struct SpawnInfo *spawnInfo;
if (sCurrAreaIndex != -1 && ((CMD_GET(u8, 2) & val7) || CMD_GET(u8, 2) == 0x1F)) {
model = CMD_GET(u8, 3);
model = CMD_GET(u32, 0x18);
spawnInfo = alloc_only_pool_alloc(sLevelPool, sizeof(struct SpawnInfo));
spawnInfo->startPos[0] = CMD_GET(s16, 4);
+13 -17
View File
@@ -4,9 +4,11 @@
#include "engine/graph_node.h"
#include "math_util.h"
#include "surface_collision.h"
#include "extended_bounds.h"
#include "trig_tables.inc.c"
#include "config.h"
// Variables for a spline curve animation (used for the flight path in the grand star cutscene)
Vec4s *gSplineKeyframe;
float gSplineKeyframeFraction;
@@ -571,23 +573,17 @@ void mtxf_mul_vec3s(Mat4 mtx, Vec3s b) {
* and no crashes occur.
*/
void mtxf_to_mtx(Mtx *dest, Mat4 src) {
#ifdef AVOID_UB
// Avoid type-casting which is technically UB by calling the equivalent
// guMtxF2L function. This helps little-endian systems, as well.
guMtxF2L(src, dest);
#else
s32 asFixedPoint;
register s32 i;
register s16 *a3 = (s16 *) dest; // all integer parts stored in first 16 bytes
register s16 *t0 = (s16 *) dest + 16; // all fraction parts stored in last 16 bytes
register f32 *t1 = (f32 *) src;
Mat4 temp;
register s32 i, j;
for( i = 0; i < 4; i++ ) {
for( j = 0; j < 3; j++ ) {
temp[i][j] = src[i][j] / WORLD_SCALE;
}
temp[i][3] = src[i][3];
}
for (i = 0; i < 16; i++) {
asFixedPoint = *t1++ * (1 << 16); //! float-to-integer conversion responsible for PU crashes
*a3++ = GET_HIGH_S16_OF_32(asFixedPoint); // integer part
*t0++ = GET_LOW_S16_OF_32(asFixedPoint); // fraction part
}
#endif
guMtxF2L( temp, dest );
}
/**
+2
View File
@@ -5,6 +5,8 @@
#include "types.h"
/*
* The sine and cosine tables overlap, but "#define gCosineTable (gSineTable +
* 0x400)" doesn't give expected codegen; gSineTable and gCosineTable need to
+207 -65
View File
@@ -110,12 +110,12 @@ static s32 find_wall_collisions_from_list(struct SurfaceNode *surfaceNode,
// Determine if checking for the camera or not.
if (gCheckingSurfaceCollisionsForCamera) {
if (surf->flags & SURFACE_FLAG_NO_CAM_COLLISION) {
if (surf->flags & SURFACE_FLAG_NO_CAM_COLLISION || surf->type == SURFACE_NEW_WATER || surf->type == SURFACE_NEW_WATER_BOTTOM) {
continue;
}
} else {
// Ignore camera only surfaces.
if (surf->type == SURFACE_CAMERA_BOUNDARY) {
if (surf->type == SURFACE_CAMERA_BOUNDARY || surf->type == SURFACE_NEW_WATER || surf->type == SURFACE_NEW_WATER_BOTTOM) {
continue;
}
@@ -226,25 +226,21 @@ s32 find_wall_collisions(struct WallCollisionData *colData) {
static struct Surface *find_ceil_from_list(struct SurfaceNode *surfaceNode, s32 x, s32 y, s32 z, f32 *pheight) {
register struct Surface *surf;
register s32 x1, z1, x2, z2, x3, z3;
f32 nx, ny, nz, oo, height;
struct Surface *ceil = NULL;
ceil = NULL;
*pheight = CELL_HEIGHT_LIMIT;
// Stay in this loop until out of ceilings.
while (surfaceNode != NULL) {
surf = surfaceNode->surface;
surfaceNode = surfaceNode->next;
x1 = surf->vertex1[0];
z1 = surf->vertex1[2];
z2 = surf->vertex2[2];
x2 = surf->vertex2[0];
// Checking if point is in bounds of the triangle laterally.
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) > 0) {
continue;
}
// Slight optimization by checking these later.
x3 = surf->vertex3[0];
z3 = surf->vertex3[2];
@@ -254,49 +250,42 @@ static struct Surface *find_ceil_from_list(struct SurfaceNode *surfaceNode, s32
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) > 0) {
continue;
}
// Determine if checking for the camera or not.
if (gCheckingSurfaceCollisionsForCamera != 0) {
if (surf->flags & SURFACE_FLAG_NO_CAM_COLLISION) {
if (surf->flags & SURFACE_FLAG_NO_CAM_COLLISION || surf->type == SURFACE_NEW_WATER || surf->type == SURFACE_NEW_WATER_BOTTOM) {
continue;
}
}
// Ignore camera only surfaces.
else if (surf->type == SURFACE_CAMERA_BOUNDARY) {
else if (surf->type == SURFACE_CAMERA_BOUNDARY || surf->type == SURFACE_NEW_WATER || surf->type == SURFACE_NEW_WATER_BOTTOM) {
continue;
}
{
f32 nx = surf->normal.x;
f32 ny = surf->normal.y;
f32 nz = surf->normal.z;
f32 oo = surf->originOffset;
f32 height;
// If a wall, ignore it. Likely a remnant, should never occur.
if (ny == 0.0f) {
continue;
}
// Find the ceil height at the specific point.
height = -(x * nx + nz * z + oo) / ny;
// Checks for ceiling interaction with a 78 unit buffer.
//! (Exposed Ceilings) Because any point above a ceiling counts
// as interacting with a ceiling, ceilings far below can cause
// "invisible walls" that are really just exposed ceilings.
if (y - (height - -78.0f) > 0.0f) {
continue;
}
*pheight = height;
ceil = surf;
break;
}
nx = surf->normal.x;
ny = surf->normal.y;
nz = surf->normal.z;
oo = surf->originOffset;
// If a wall, ignore it. Likely a remnant, should never occur.
if (ny == 0.0f) {
continue;
}
// Find the ceil height at the specific point.
height = -(x * nx + nz * z + oo) / ny;
if (height > *pheight) {
continue;
}
// Checks for ceiling interaction
if (y > height) {
continue;
}
if (y >= surf->upperY) {
continue;
}
*pheight = height;
ceil = surf;
if (height == y) {
break;
}
}
//! (Surface Cucking) Since only the first ceil is returned and not the lowest,
// lower ceilings can be "cucked" by higher ceilings.
return ceil;
}
@@ -399,40 +388,33 @@ f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct FloorGeometr
static struct Surface *find_floor_from_list(struct SurfaceNode *surfaceNode, s32 x, s32 y, s32 z, f32 *pheight) {
register struct Surface *surf;
register s32 x1, z1, x2, z2, x3, z3;
f32 nx, ny, nz;
f32 oo;
f32 height;
f32 nx, ny, nz, oo, height;
struct Surface *floor = NULL;
*pheight = FLOOR_LOWER_LIMIT;
// Iterate through the list of floors until there are no more floors.
while (surfaceNode != NULL) {
surf = surfaceNode->surface;
surfaceNode = surfaceNode->next;
x1 = surf->vertex1[0];
z1 = surf->vertex1[2];
x2 = surf->vertex2[0];
z2 = surf->vertex2[2];
// Check that the point is within the triangle bounds.
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) < 0) {
continue;
}
// To slightly save on computation time, set this later.
x3 = surf->vertex3[0];
z3 = surf->vertex3[2];
if ((z2 - z) * (x3 - x2) - (x2 - x) * (z3 - z2) < 0) {
continue;
}
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) < 0) {
continue;
}
// Determine if we are checking for the camera or not.
if (gCheckingSurfaceCollisionsForCamera != 0) {
if (surf->flags & SURFACE_FLAG_NO_CAM_COLLISION) {
if (surf->flags & SURFACE_FLAG_NO_CAM_COLLISION || surf->type == SURFACE_NEW_WATER || surf->type == SURFACE_NEW_WATER_BOTTOM) {
continue;
}
}
@@ -440,31 +422,101 @@ static struct Surface *find_floor_from_list(struct SurfaceNode *surfaceNode, s32
else if (surf->type == SURFACE_CAMERA_BOUNDARY) {
continue;
}
nx = surf->normal.x;
ny = surf->normal.y;
nz = surf->normal.z;
oo = surf->originOffset;
// If a wall, ignore it. Likely a remnant, should never occur.
if (ny == 0.0f) {
continue;
}
// If a wall, ignore it. Likely a remnant, should never occur.
if (ny == 0.0f) {
continue;
}
// Find the height of the floor at a given location.
height = -(x * nx + nz * z + oo) / ny;
if (height < *pheight) {
continue;
}
// Checks for floor interaction with a 78 unit buffer.
if (y - (height + -78.0f) < 0.0f) {
if (y < (height - 78.0f)) {
continue;
}
*pheight = height;
floor = surf;
break;
if (height - 78.0f == y) {
break;
}
}
return floor;
}
static s16 check_within_triangle_bounds(s32 x, s32 z, struct Surface *surf) {
register s32 x1, z1, x2, z2, x3, z3;
x1 = surf->vertex1[0];
z1 = surf->vertex1[2];
x2 = surf->vertex2[0];
z2 = surf->vertex2[2];
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) < 0) return FALSE;
x3 = surf->vertex3[0];
z3 = surf->vertex3[2];
if ((z2 - z) * (x3 - x2) - (x2 - x) * (z3 - z2) < 0) return FALSE;
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) < 0) return FALSE;
return TRUE;
}
// Find the height of the floor at a given location
static f32 get_floor_height_at_location(s32 x, s32 z, struct Surface *surf) {
return -(x * surf->normal.x + surf->normal.z * z + surf->originOffset) / surf->normal.y;
}
/**
* Iterate through the list of water floors and find the first water floor under a given point.
*/
struct Surface *find_water_floor_from_list(struct SurfaceNode *surfaceNode, s32 x, s32 y, s32 z,
f32 *pheight) {
register struct Surface *surf;
struct Surface *floor = NULL;
struct SurfaceNode *topSurfaceNode = surfaceNode;
struct SurfaceNode *bottomSurfaceNode = surfaceNode;
f32 height = FLOOR_LOWER_LIMIT;
f32 bottomHeight = FLOOR_LOWER_LIMIT;
// Iterate through the list of water floors until there are no more water floors.
while (bottomSurfaceNode != NULL) {
f32 curBottomHeight = FLOOR_LOWER_LIMIT;
surf = bottomSurfaceNode->surface;
bottomSurfaceNode = bottomSurfaceNode->next;
if (surf->type != SURFACE_NEW_WATER_BOTTOM || !check_within_triangle_bounds(x, z, surf)) continue;
curBottomHeight = get_floor_height_at_location(x, z, surf);
if (curBottomHeight < y - 78.0f) continue;
if (curBottomHeight >= y - 78.0f) bottomHeight = curBottomHeight;
}
// Iterate through the list of water tops until there are no more water tops.
while (topSurfaceNode != NULL) {
f32 curHeight = FLOOR_LOWER_LIMIT;
surf = topSurfaceNode->surface;
topSurfaceNode = topSurfaceNode->next;
if (surf->type == SURFACE_NEW_WATER_BOTTOM || !check_within_triangle_bounds(x, z, surf)) continue;
curHeight = get_floor_height_at_location(x, z, surf);
if (bottomHeight != FLOOR_LOWER_LIMIT && curHeight > bottomHeight) continue;
if (curHeight > height) {
height = curHeight;
*pheight = curHeight;
floor = surf;
}
}
//! (Surface Cucking) Since only the first floor is returned and not the highest,
// higher floors can be "cucked" by lower floors.
return floor;
}
@@ -579,10 +631,93 @@ f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
return height;
}
/**
* Find the highest water floor under a given position and return the height.
*/
f32 find_water_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
s16 cellZ, cellX;
struct Surface *floor = NULL;
struct SurfaceNode *surfaceList;
f32 height = FLOOR_LOWER_LIMIT;
s16 x = (s16) xPos;
s16 y = (s16) yPos;
s16 z = (s16) zPos;
if (x <= -LEVEL_BOUNDARY_MAX || x >= LEVEL_BOUNDARY_MAX) {
return height;
}
if (z <= -LEVEL_BOUNDARY_MAX || z >= LEVEL_BOUNDARY_MAX) {
return height;
}
// Each level is split into cells to limit load, find the appropriate cell.
cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & NUM_CELLS_INDEX;
cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & NUM_CELLS_INDEX;
// Check for surfaces that are a part of level geometry.
surfaceList = gStaticSurfacePartition[cellZ][cellX][SPATIAL_PARTITION_WATER].next;
floor = find_water_floor_from_list(surfaceList, x, y, z, &height);
if (floor == NULL) {
height = FLOOR_LOWER_LIMIT;
} else {
*pfloor = floor;
}
return height;
}
/**************************************************
* ENVIRONMENTAL BOXES *
**************************************************/
/**
* Finds the height of water at a given location.
*/
f32 find_water_level_and_floor(f32 x, f32 z, struct Surface **pfloor) {
s32 i;
s32 numRegions;
s16 val;
f32 loX, hiX, loZ, hiZ;
f32 waterLevel = FLOOR_LOWER_LIMIT;
s16 *p = gEnvironmentRegions;
struct Surface *floor = NULL;
if (gCheckingSurfaceCollisionsForCamera) {
waterLevel = find_water_floor(x, gLakituState.pos[1], z, &floor);
} else {
waterLevel = find_water_floor(x, gMarioState->pos[1], z, &floor);
}
if (p != NULL && waterLevel == FLOOR_LOWER_LIMIT) {
numRegions = *p++;
for (i = 0; i < numRegions; i++) {
val = *p++;
loX = *p++;
loZ = *p++;
hiX = *p++;
hiZ = *p++;
// If the location is within a water box and it is a water box.
// Water is less than 50 val only, while above is gas and such.
if (loX < x && x < hiX && loZ < z && z < hiZ && val < 50) {
// Set the water height. Since this breaks, only return the first height.
waterLevel = *p;
break;
}
p++;
}
} else {
*pfloor = floor;
}
return waterLevel;
}
/**
* Finds the height of water at a given location.
*/
@@ -593,8 +728,15 @@ f32 find_water_level(f32 x, f32 z) {
f32 loX, hiX, loZ, hiZ;
f32 waterLevel = FLOOR_LOWER_LIMIT;
s16 *p = gEnvironmentRegions;
struct Surface *floor;
if (p != NULL) {
if (gCheckingSurfaceCollisionsForCamera) {
waterLevel = find_water_floor(x, gLakituState.pos[1], z, &floor);
} else {
waterLevel = find_water_floor(x, gMarioState->pos[1], z, &floor);
}
if (p != NULL && waterLevel == FLOOR_LOWER_LIMIT) {
numRegions = *p++;
for (i = 0; i < numRegions; i++) {
+2 -3
View File
@@ -5,10 +5,8 @@
#include "types.h"
// Range level area is 16384x16384 (-8192 to +8192 in x and z)
#define LEVEL_BOUNDARY_MAX 0x2000 // 8192
#include "engine/extended_bounds.h"
#define CELL_SIZE (1 << 10) // 0x400
#define CELL_HEIGHT_LIMIT 20000
#define FLOOR_LOWER_LIMIT -11000
@@ -42,6 +40,7 @@ f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil);
f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct FloorGeometry **floorGeo);
f32 find_floor_height(f32 x, f32 y, f32 z);
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor);
f32 find_water_level_and_floor(f32 x, f32 z, struct Surface **pfloor);
f32 find_water_level(f32 x, f32 z);
f32 find_poison_gas_level(f32 x, f32 z);
void debug_surface_list_info(f32 xPos, f32 zPos);
+13 -7
View File
@@ -37,6 +37,8 @@ s16 sSurfacePoolSize;
u8 unused8038EEA8[0x30];
u8 gSurfacePoolError = 0;
/**
* Allocate the part of the surface node pool to contain a surface node.
*/
@@ -49,7 +51,8 @@ static struct SurfaceNode *alloc_surface_node(void) {
//! A bounds check! If there's more surface nodes than 7000 allowed,
// we, um...
// Perhaps originally just debug feedback?
if (gSurfaceNodesAllocated >= 7000) {
if (gSurfaceNodesAllocated >= SURFACE_NODE_POOL_SIZE) {
gSurfacePoolError |= NOT_ENOUGH_ROOM_FOR_NODES;
}
return node;
@@ -68,6 +71,7 @@ static struct Surface *alloc_surface(void) {
// we, um...
// Perhaps originally just debug feedback?
if (gSurfacesAllocated >= sSurfacePoolSize) {
gSurfacePoolError |= NOT_ENOUGH_ROOM_FOR_SURFACES;
}
surface->type = 0;
@@ -89,6 +93,7 @@ static void clear_spatial_partition(SpatialPartitionCell *cells) {
(*cells)[SPATIAL_PARTITION_FLOORS].next = NULL;
(*cells)[SPATIAL_PARTITION_CEILS].next = NULL;
(*cells)[SPATIAL_PARTITION_WALLS].next = NULL;
(*cells)[SPATIAL_PARTITION_WATER].next = NULL;
cells++;
}
@@ -115,9 +120,10 @@ static void add_surface_to_cell(s16 dynamic, s16 cellX, s16 cellZ, struct Surfac
s16 priority;
s16 sortDir;
s16 listIndex;
s16 isWater = surface->type == SURFACE_NEW_WATER || surface->type == SURFACE_NEW_WATER_BOTTOM;
if (surface->normal.y > 0.01) {
listIndex = SPATIAL_PARTITION_FLOORS;
listIndex = isWater ? SPATIAL_PARTITION_WATER : SPATIAL_PARTITION_FLOORS;
sortDir = 1; // highest to lowest, then insertion order
} else if (surface->normal.y < -0.01) {
listIndex = SPATIAL_PARTITION_CEILS;
@@ -197,7 +203,7 @@ static s16 max_3(s16 a0, s16 a1, s16 a2) {
* time). This function determines the lower cell for a given x/z position.
* @param coord The coordinate to test
*/
static s16 lower_cell_index(s16 coord) {
static s16 lower_cell_index(s32 coord) {
s16 index;
// Move from range [-0x2000, 0x2000) to [0, 0x4000)
@@ -229,7 +235,7 @@ static s16 lower_cell_index(s16 coord) {
* time). This function determines the upper cell for a given x/z position.
* @param coord The coordinate to test
*/
static s16 upper_cell_index(s16 coord) {
static s16 upper_cell_index(s32 coord) {
s16 index;
// Move from range [-0x2000, 0x2000) to [0, 0x4000)
@@ -524,8 +530,8 @@ static void load_environmental_regions(s16 **data) {
* Allocate some of the main pool for surfaces (2300 surf) and for surface nodes (7000 nodes).
*/
void alloc_surface_pools(void) {
sSurfacePoolSize = 2300;
sSurfaceNodePool = main_pool_alloc(7000 * sizeof(struct SurfaceNode), MEMORY_POOL_LEFT);
sSurfacePoolSize = SURFACE_POOL_SIZE;
sSurfaceNodePool = main_pool_alloc(SURFACE_NODE_POOL_SIZE * sizeof(struct SurfaceNode), MEMORY_POOL_LEFT);
sSurfacePool = main_pool_alloc(sSurfacePoolSize * sizeof(struct Surface), MEMORY_POOL_LEFT);
gCCMEnteredSlide = 0;
@@ -589,7 +595,7 @@ u32 get_area_terrain_size(s16 *data) {
*/
void load_area_terrain(s16 index, s16 *data, s8 *surfaceRooms, s16 *macroObjects) {
s16 terrainLoadType;
s16 *vertexData;
s16 *vertexData = NULL;
UNUSED s32 unused;
// Initialize the data for this.
+5 -2
View File
@@ -6,6 +6,8 @@
#include "surface_collision.h"
#include "types.h"
extern u8 gSurfacePoolError;
#define NUM_CELLS (2 * LEVEL_BOUNDARY_MAX / CELL_SIZE)
#define NUM_CELLS_INDEX (NUM_CELLS - 1)
@@ -19,10 +21,11 @@ enum
{
SPATIAL_PARTITION_FLOORS,
SPATIAL_PARTITION_CEILS,
SPATIAL_PARTITION_WALLS
SPATIAL_PARTITION_WALLS,
SPATIAL_PARTITION_WATER
};
typedef struct SurfaceNode SpatialPartitionCell[3];
typedef struct SurfaceNode SpatialPartitionCell[4];
// Needed for bs bss reordering memes.
extern s32 unused8038BE90;
+3 -2
View File
@@ -1,5 +1,6 @@
#include <PR/ultratypes.h>
#include "config.h"
#include "prevent_bss_reordering.h"
#include "area.h"
#include "sm64.h"
@@ -24,7 +25,7 @@
#include "dialog_ids.h"
struct SpawnInfo gPlayerSpawnInfos[1];
struct GraphNode *D_8033A160[0x100];
struct GraphNode *gGraphNodePointers[MODEL_ID_COUNT];
struct Area gAreaData[8];
struct WarpTransition gWarpTransition;
@@ -37,7 +38,7 @@ s16 gMenuOptSelectIndex;
s16 gSaveOptSelectIndex;
struct SpawnInfo *gMarioSpawnInfo = &gPlayerSpawnInfos[0];
struct GraphNode **gLoadedGraphNodes = D_8033A160;
struct GraphNode **gLoadedGraphNodes = gGraphNodePointers;
struct Area *gAreas = gAreaData;
struct Area *gCurrentArea = NULL;
struct CreditsEntry *gCurrCreditsEntry = NULL;
+1 -1
View File
@@ -138,7 +138,7 @@ enum MenuOption {
extern struct GraphNode **gLoadedGraphNodes;
extern struct SpawnInfo gPlayerSpawnInfos[];
extern struct GraphNode *D_8033A160[];
extern struct GraphNode *gGraphNodePointers[MODEL_ID_COUNT];
extern struct Area gAreaData[];
extern struct WarpTransition gWarpTransition;
extern s16 gCurrCourseNum;
+3 -3
View File
@@ -58,7 +58,7 @@ struct Struct8032F34C {
s16 numBridgeSections;
s16 bridgeRelativeStartingXorZ;
s16 platformWidth;
s16 model;
ModelID model;
const void *segAddr;
};
@@ -66,7 +66,7 @@ struct Struct802C0DF0 {
u8 unk0;
u8 unk1;
u8 unk2;
u8 model;
ModelID model;
const BehaviorScript *behavior;
};
@@ -78,7 +78,7 @@ struct Struct8032F754 {
struct OpenableGrill {
s16 halfWidth;
s16 modelID;
ModelID modelID;
const Collision *collision;
};
+1 -1
View File
@@ -864,7 +864,7 @@ void bhv_boo_in_castle_loop(void) {
}
void bhv_boo_staircase(void) {
f32 targetY;
f32 targetY = 0.0f;
switch (o->oBehParams2ndByte) {
case 1:
+4 -3
View File
@@ -258,7 +258,7 @@ void bhv_free_bowling_ball_init(void) {
}
void bhv_free_bowling_ball_roll_loop(void) {
s16 collisionFlags = object_step();
/*s16 collisionFlags = */object_step();
bowling_ball_set_hitbox();
if (o->oForwardVel > 10.0f) {
@@ -266,8 +266,9 @@ void bhv_free_bowling_ball_roll_loop(void) {
cur_obj_play_sound_1(SOUND_ENV_UNKNOWN2);
}
if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) && !(collisionFlags & OBJ_COL_FLAGS_LANDED))
cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1_LOWPRIO);
/* Always false, commented out to suppress compiler warnings */
// if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) && !(collisionFlags & OBJ_COL_FLAGS_LANDED))
// cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1_LOWPRIO);
if (!is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 6000)) {
o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE;
+16 -2
View File
@@ -1,3 +1,6 @@
#include "config.h"
// bowser.c.inc
/**
* Behavior for Bowser and it's actions (Tail, Flame, Body)
*/
@@ -1480,6 +1483,10 @@ s32 bowser_check_fallen_off_stage(void) {
return FALSE;
}
#ifdef PLATFORM_DISPLACEMENT_2
struct PlatformDisplacementInfo sBowserDisplacementInfo;
#endif
/**
* Set Bowser's actions
*/
@@ -1556,11 +1563,18 @@ void bowser_free_update(void) {
struct Surface *floor;
struct Object *platform;
UNUSED f32 floorHeight;
// Platform displacement check (for BITFS)
#ifdef PLATFORM_DISPLACEMENT_2
s16 tmpOFaceAngleYaw = (s16) o->oFaceAngleYaw;
if ((platform = o->platform) != NULL) {
// NOTE: This function was at one point using '&o->oFaceAngleYaw', which is a s32 address. Should tmpOFaceAngleYaw be using the first 16 bits instead, or was that a bug?
apply_platform_displacement(&sBowserDisplacementInfo, &o->oPosX, &tmpOFaceAngleYaw, platform);
o->oFaceAngleYaw = tmpOFaceAngleYaw;
}
#else
if ((platform = o->platform) != NULL) {
apply_platform_displacement(FALSE, platform);
}
#endif
// Reset grabbed status
o->oBowserGrabbedStatus = BOWSER_GRAB_STATUS_NONE;
// Update positions and actions (default action)
+3
View File
@@ -33,6 +33,9 @@ static void fish_spawner_act_spawn(void) {
case FISH_SPAWNER_BP_FEW_CYAN:
model = MODEL_CYAN_FISH; schoolQuantity = 5; minDistToMario = 1500.0f; fishAnimation = cyan_fish_seg6_anims_0600E264;
break;
default:
return;
}
+1 -1
View File
@@ -42,7 +42,7 @@ void bhv_jrb_sliding_box_loop(void) {
struct Surface *sp38;
UNUSED Vec3f sp2C;
Vec3f sp20;
s16 sp1E;
s16 sp1E = 0;
if (o->oJrbSlidingBoxUnkF4 == NULL) {
sp3C = cur_obj_nearest_object_with_behavior(bhvInSunkenShip3);
if (sp3C != NULL) // NULL check only for assignment, not for dereference?
+6
View File
@@ -1,3 +1,4 @@
#include "config.h"
/**
* Behaviors for bhvPoleGrabbing and bhvGiantPole.
*
@@ -16,8 +17,13 @@ void bhv_pole_init(void) {
* This is equivalent to using `o->oBehParams2ndByte` according to
* `spawn_objects_from_info`.
*/
#ifdef LONGER_POLES
o->hitboxHeight = ((o->oBehParams & 0xFFFF0000) >> 16) * 10;
#else
s32 tenthHitboxHeight = o->oBehParams >> 0x10 & 0xFF;
o->hitboxHeight = tenthHitboxHeight * 10;
#endif
}
/**
+7
View File
@@ -1,3 +1,5 @@
#include "config.h"
// spawn_default_star.c.inc
static struct ObjectHitbox sCollectStarHitbox = {
@@ -17,8 +19,13 @@ void bhv_collect_star_init(void) {
u8 currentLevelStarFlags;
starId = (o->oBehParams >> 24) & 0xFF;
#ifdef GLOBAL_STAR_IDS
currentLevelStarFlags = save_file_get_star_flags(gCurrSaveFileNum - 1, (starId/7) - 1);
if (currentLevelStarFlags & (1 << (starId % 7))) {
#else
currentLevelStarFlags = save_file_get_star_flags(gCurrSaveFileNum - 1, gCurrCourseNum - 1);
if (currentLevelStarFlags & (1 << starId)) {
#endif
o->header.gfx.sharedChild = gLoadedGraphNodes[MODEL_TRANSPARENT_STAR];
} else {
o->header.gfx.sharedChild = gLoadedGraphNodes[MODEL_STAR];
@@ -1,3 +1,5 @@
#include "config.h"
/**
* This is the behavior file for the tilting inverted pyramids in BitFS/LLL.
* The object essentially just tilts and moves Mario with it.
@@ -131,7 +133,10 @@ void bhv_tilting_inverted_pyramid_loop(void) {
mx += posAfterRotation[0] - posBeforeRotation[0];
my += posAfterRotation[1] - posBeforeRotation[1];
mz += posAfterRotation[2] - posBeforeRotation[2];
#ifndef PLATFORM_DISPLACEMENT_2
set_mario_pos(mx, my, mz);
#endif
}
o->header.gfx.throwMatrix = transform;
+9
View File
@@ -1,3 +1,4 @@
#include "config.h"
// tree_particles.c.inc
void bhv_tree_snow_or_leaf_loop(void) {
@@ -33,15 +34,23 @@ void bhv_tree_snow_or_leaf_loop(void) {
void bhv_snow_leaf_particle_spawn_init(void) {
struct Object *obj; // Either snow or leaf
#ifdef TREE_PARTICLE_FIX
struct Object *nearestTree = NULL;
#endif
UNUSED s32 unused;
s32 isSnow;
f32 scale;
UNUSED s32 unused2;
gMarioObject->oActiveParticleFlags &= ~0x2000;
#ifdef TREE_PARTICLE_FIX
nearestTree = cur_obj_nearest_object_with_behavior(bhvTree);
isSnow = (nearestTree->header.gfx.sharedChild == gLoadedGraphNodes[MODEL_CCM_SNOW_TREE] || nearestTree->header.gfx.sharedChild == gLoadedGraphNodes[MODEL_SL_SNOW_TREE]);
#else
if (gCurrLevelNum == LEVEL_CCM || gCurrLevelNum == LEVEL_SL)
isSnow = 1;
else
isSnow = 0;
#endif
if (isSnow) {
if (random_float() < 0.5) {
obj = spawn_object(o, MODEL_WHITE_PARTICLE_DL, bhvTreeSnow);
+1
View File
@@ -163,6 +163,7 @@ void bhv_unagi_loop(void) {
break;
case 2:
unagi_act_2();
// fall through
case 3:
unagi_act_3();
break;
+37 -18
View File
@@ -28,6 +28,7 @@
#include "paintings.h"
#include "engine/graph_node.h"
#include "level_table.h"
#include "config.h"
#define CBUTTON_MASK (U_CBUTTONS | D_CBUTTONS | L_CBUTTONS | R_CBUTTONS)
@@ -878,21 +879,21 @@ void pan_ahead_of_player(struct Camera *c) {
vec3f_add(c->focus, pan);
}
s16 find_in_bounds_yaw_wdw_bob_thi(Vec3f pos, Vec3f origin, s16 yaw) {
switch (gCurrLevelArea) {
case AREA_WDW_MAIN:
yaw = clamp_positions_and_find_yaw(pos, origin, 4508.f, -3739.f, 4508.f, -3739.f);
break;
case AREA_BOB:
yaw = clamp_positions_and_find_yaw(pos, origin, 8000.f, -8000.f, 7050.f, -8000.f);
break;
case AREA_THI_HUGE:
yaw = clamp_positions_and_find_yaw(pos, origin, 8192.f, -8192.f, 8192.f, -8192.f);
break;
case AREA_THI_TINY:
yaw = clamp_positions_and_find_yaw(pos, origin, 2458.f, -2458.f, 2458.f, -2458.f);
break;
}
s16 find_in_bounds_yaw_wdw_bob_thi(UNUSED Vec3f pos, UNUSED Vec3f origin, s16 yaw) {
// switch (gCurrLevelArea) {
// case AREA_WDW_MAIN:
// yaw = clamp_positions_and_find_yaw(pos, origin, 4508.f, -3739.f, 4508.f, -3739.f);
// break;
// case AREA_BOB:
// yaw = clamp_positions_and_find_yaw(pos, origin, 8000.f, -8000.f, 7050.f, -8000.f);
// break;
// case AREA_THI_HUGE:
// yaw = clamp_positions_and_find_yaw(pos, origin, 8192.f, -8192.f, 8192.f, -8192.f);
// break;
// case AREA_THI_TINY:
// yaw = clamp_positions_and_find_yaw(pos, origin, 2458.f, -2458.f, 2458.f, -2458.f);
// break;
// }
return yaw;
}
@@ -1187,6 +1188,22 @@ void mode_8_directions_camera(struct Camera *c) {
s8DirModeYawOffset -= DEGREES(45);
play_sound_cbutton_side();
}
#ifdef PARALLEL_LAKITU_CAM
// extra functionality
else if (gPlayer1Controller->buttonPressed & U_JPAD) {
s8DirModeYawOffset = 0;
s8DirModeYawOffset = gMarioState->faceAngle[1]-0x8000;
}
else if (gPlayer1Controller->buttonDown & L_JPAD) {
s8DirModeYawOffset -= DEGREES(2);
}
else if (gPlayer1Controller->buttonDown & R_JPAD) {
s8DirModeYawOffset += DEGREES(2);
}
else if (gPlayer1Controller->buttonPressed & D_JPAD) {
s8DirModeYawOffset = s8DirModeYawOffset&0xE000;
}
#endif
lakitu_zoom(400.f, 0x900);
c->nextYaw = update_8_directions_camera(c, c->focus, pos);
@@ -1608,7 +1625,8 @@ s32 update_boss_fight_camera(struct Camera *c, Vec3f focus, Vec3f pos) {
switch (gCurrLevelArea) {
case AREA_BOB:
pos[1] += 125.f;
//! fall through, makes the BoB boss fight camera move up twice as high as it should
// fall through
//! makes the BoB boss fight camera move up twice as high as it should
case AREA_WF:
pos[1] += 125.f;
}
@@ -3059,8 +3077,9 @@ void update_camera(struct Camera *c) {
c->nextYaw = gLakituState.nextYaw;
c->mode = gLakituState.mode;
c->defMode = gLakituState.defMode;
#ifndef CAMERA_FIX
camera_course_processing(c);
#endif
stub_camera_3(c);
sCButtonsPressed = find_c_buttons_pressed(sCButtonsPressed, gPlayer1Controller->buttonPressed,
gPlayer1Controller->buttonDown);
@@ -5109,7 +5128,7 @@ s32 determine_dance_cutscene(UNUSED struct Camera *c) {
* @return `pullResult` or `pushResult` depending on Mario's door action
*/
u8 open_door_cutscene(u8 pullResult, u8 pushResult) {
s16 result;
s16 result = 0;
if (sMarioCamState->action == ACT_PULLING_DOOR) {
result = pullResult;
+2
View File
@@ -455,6 +455,8 @@ void envfx_set_bubble_texture(s32 mode, s16 index) {
imageArr = segmented_to_virtual(&bubble_ptr_0B006848);
frame = 0;
break;
default:
return;
}
gDPSetTextureImage(sGfxCursor++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, *(imageArr + frame));
+10 -2
View File
@@ -72,10 +72,15 @@ struct DmaHandlerList gDemoInputsBuf;
// fillers
UNUSED static u8 sfillerGameInit[0x90];
static s32 sUnusedGameInitValue = 0;
UNUSED static s32 sUnusedGameInitValue = 0;
// General timer that runs as the game starts
u32 gGlobalTimer = 0;
u8 gIsConsole;
#ifdef WIDE
u8 gWidescreen;
#endif
u8 gBorderHeight;
// Framebuffer rendering values (max 3)
u16 sRenderedFramebuffer = 0;
@@ -367,7 +372,7 @@ void render_init(void) {
} else {
gIsConsole = 1;
gBorderHeight = BORDER_HEIGHT_CONSOLE;
}
}
gGfxPool = &gGfxPools[0];
set_segment_base_addr(1, gGfxPool->buffer);
gGfxSPTask = &gGfxPool->spTask;
@@ -710,6 +715,9 @@ void thread5_game_loop(UNUSED void *arg) {
play_music(SEQ_PLAYER_SFX, SEQUENCE_ARGS(0, SEQ_SOUND_PLAYER), 0);
set_sound_mode(save_file_get_sound_mode());
#ifdef WIDE
gWidescreen = save_file_get_widescreen_mode();
#endif
render_init();
while (TRUE) {
+3
View File
@@ -42,6 +42,9 @@ extern u8 *gGfxPoolEnd;
extern struct GfxPool *gGfxPool;
extern u8 gControllerBits;
extern u8 gIsConsole;
#ifdef WIDE
extern u8 gWidescreen;
#endif
extern u8 gBorderHeight;
#ifdef EEP
extern s8 gEepromProbe;
+48 -2
View File
@@ -13,6 +13,7 @@
#include "area.h"
#include "save_file.h"
#include "print.h"
#include "engine/surface_load.h"
/* @file hud.c
* This file implements HUD rendering and power meter animations.
@@ -20,6 +21,42 @@
* cannon reticle, and the unused keys.
**/
// ------------- FPS COUNTER ---------------
// To use it, call print_fps(x,y); every frame.
#define FRAMETIME_COUNT 30
OSTime frameTimes[FRAMETIME_COUNT];
u8 curFrameTimeIndex = 0;
#include "PR/os_convert.h"
// Call once per frame
f32 calculate_and_update_fps()
{
OSTime newTime = osGetTime();
OSTime oldTime = frameTimes[curFrameTimeIndex];
frameTimes[curFrameTimeIndex] = newTime;
curFrameTimeIndex++;
if (curFrameTimeIndex >= FRAMETIME_COUNT)
curFrameTimeIndex = 0;
return ((f32)FRAMETIME_COUNT * 1000000.0f) / (s32)OS_CYCLES_TO_USEC(newTime - oldTime);
}
void print_fps(s32 x, s32 y)
{
f32 fps = calculate_and_update_fps();
char text[10];
sprintf(text, "%2.2f", fps);
print_text(x, y, text);
}
// ------------ END OF FPS COUNER -----------------
struct PowerMeterHUD {
s8 animation;
s16 x;
@@ -450,11 +487,11 @@ void render_hud(void) {
if (gCurrentArea != NULL && gCurrentArea->camera->mode == CAMERA_MODE_INSIDE_CANNON) {
render_hud_cannon_reticle();
}
#ifndef DISABLE_LIVES
if (hudDisplayFlags & HUD_DISPLAY_FLAG_LIVES) {
render_hud_mario_lives();
}
#endif
if (hudDisplayFlags & HUD_DISPLAY_FLAG_COIN_COUNT) {
render_hud_coins();
}
@@ -475,5 +512,14 @@ void render_hud(void) {
if (hudDisplayFlags & HUD_DISPLAY_FLAG_TIMER) {
render_hud_timer();
}
if (gSurfacePoolError & NOT_ENOUGH_ROOM_FOR_SURFACES)
{
print_text(10, 40, "SURFACE POOL FULL");
}
if (gSurfacePoolError & NOT_ENOUGH_ROOM_FOR_NODES)
{
print_text(10, 60, "SURFACE NODE POOL FULL");
}
}
}
+40 -1059
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -129,6 +129,7 @@ extern s8 gRedCoinsCollected;
void create_dl_identity_matrix(void);
void create_dl_translation_matrix(s8 pushOp, f32 x, f32 y, f32 z);
void create_dl_ortho_matrix(void);
void create_dl_scale_matrix(s8 pushOp, f32 x, f32 y, f32 z);
void print_generic_string(s16 x, s16 y, const u8 *str);
void print_hud_lut_string(s8 hudLUT, s16 x, s16 y, const u8 *str);
void print_menu_generic_string(s16 x, s16 y, const u8 *str);
+16 -5
View File
@@ -23,6 +23,7 @@
#include "sm64.h"
#include "sound_init.h"
#include "rumble_init.h"
#include "config.h"
#define INT_GROUND_POUND_OR_TWIRL (1 << 0) // 0x01
#define INT_PUNCH (1 << 1) // 0x02
@@ -745,11 +746,12 @@ u32 interact_coin(struct MarioState *m, UNUSED u32 interactType, struct Object *
m->healCounter += 4 * o->oDamageOrCoinValue;
o->oInteractStatus = INT_STATUS_INTERACTED;
if (COURSE_IS_MAIN_COURSE(gCurrCourseNum) && m->numCoins - o->oDamageOrCoinValue < 100
&& m->numCoins >= 100) {
#ifdef X_COIN_STAR
if (COURSE_IS_MAIN_COURSE(gCurrCourseNum) && m->numCoins - o->oDamageOrCoinValue < X_COIN_STAR
&& m->numCoins >= X_COIN_STAR) {
bhv_spawn_star_no_level_exit(6);
}
#endif
#if ENABLE_RUMBLE
if (o->oDamageOrCoinValue >= 2) {
queue_rumble_data(5, 80);
@@ -768,7 +770,11 @@ u32 interact_water_ring(struct MarioState *m, UNUSED u32 interactType, struct Ob
u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct Object *o) {
u32 starIndex;
u32 starGrabAction = ACT_STAR_DANCE_EXIT;
#ifdef NON_STOP_STARS
u32 noExit = 1;
#else
u32 noExit = (o->oInteractionSubtype & INT_SUBTYPE_NO_EXIT) != 0;
#endif
u32 grandStar = (o->oInteractionSubtype & INT_SUBTYPE_GRAND_STAR) != 0;
if (m->health >= 0x100) {
@@ -806,8 +812,11 @@ u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct O
o->oInteractStatus = INT_STATUS_INTERACTED;
m->interactObj = o;
m->usedObj = o;
#ifdef GLOBAL_STAR_IDS
starIndex = (o->oBehParams >> 24) & 0xFF;
#else
starIndex = (o->oBehParams >> 24) & 0x1F;
#endif
save_file_collect_star_or_key(m->numCoins, starIndex);
m->numStars =
@@ -1532,7 +1541,9 @@ u32 interact_pole(struct MarioState *m, UNUSED u32 interactType, struct Object *
marioObj->oMarioPoleUnk108 = 0;
marioObj->oMarioPoleYawVel = 0;
marioObj->oMarioPolePos = m->pos[1] - o->oPosY;
marioObj->oMarioPolePos = (m->pos[1] - o->oPosY) < 0
? -o->hitboxDownOffset
: (m->pos[1] - o->oPosY);
if (lowSpeed) {
return set_mario_action(m, ACT_GRAB_POLE_SLOW, 0);
+42 -17
View File
@@ -29,6 +29,8 @@
#include "course_table.h"
#include "rumble_init.h"
#include "config.h"
#define PLAY_MODE_NORMAL 0
#define PLAY_MODE_PAUSED 2
#define PLAY_MODE_CHANGE_AREA 3
@@ -490,7 +492,7 @@ void warp_level(void) {
}
void warp_credits(void) {
s32 marioAction;
s32 marioAction = 0;
switch (sWarpDest.nodeId) {
case WARP_NODE_CREDITS_START:
@@ -557,7 +559,11 @@ void check_instant_warp(void) {
gMarioState->marioObj->oPosX = gMarioState->pos[0];
gMarioState->marioObj->oPosY = gMarioState->pos[1];
gMarioState->marioObj->oPosZ = gMarioState->pos[2];
#ifdef INSTANT_WARP_OFFSET_FIX
gMarioObject->header.gfx.pos[0] = gMarioState->pos[0];
gMarioObject->header.gfx.pos[1] = gMarioState->pos[1];
gMarioObject->header.gfx.pos[2] = gMarioState->pos[2];
#endif
cameraAngle = gMarioState->area->camera->yaw;
change_area(warp->area);
@@ -736,9 +742,11 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) {
break;
case WARP_OP_DEATH:
#ifndef DISABLE_LIVES
if (m->numLives == 0) {
sDelayedWarpOp = WARP_OP_GAME_OVER;
}
#endif
sDelayedWarpTimer = 48;
sSourceWarpNodeId = WARP_NODE_DEATH;
play_transition(WARP_TRANSITION_FADE_INTO_BOWSER, 0x30, 0x00, 0x00, 0x00);
@@ -748,12 +756,17 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) {
case WARP_OP_WARP_FLOOR:
sSourceWarpNodeId = WARP_NODE_WARP_FLOOR;
if (area_get_warp_node(sSourceWarpNodeId) == NULL) {
#ifndef DISABLE_LIVES
if (m->numLives == 0) {
sDelayedWarpOp = WARP_OP_GAME_OVER;
} else {
sSourceWarpNodeId = WARP_NODE_DEATH;
}
#else
sSourceWarpNodeId = WARP_NODE_DEATH;
#endif
}
sDelayedWarpTimer = 20;
play_transition(WARP_TRANSITION_FADE_INTO_CIRCLE, 0x14, 0x00, 0x00, 0x00);
break;
@@ -1026,7 +1039,7 @@ s32 play_mode_paused(void) {
if (gDebugLevelSelect) {
fade_into_special_warp(-9, 1);
} else {
initiate_warp(LEVEL_CASTLE, 1, 0x1F, 0);
initiate_warp(EXIT_COURSE_LEVEL, EXIT_COURSE_AREA, EXIT_COURSE_NODE, 0);
fade_into_special_warp(0, 0);
gSavedCourseNum = COURSE_NONE;
}
@@ -1131,7 +1144,7 @@ UNUSED static s32 play_mode_unused(void) {
}
s32 update_level(void) {
s32 changeLevel;
s32 changeLevel = FALSE;
switch (sCurrPlayMode) {
case PLAY_MODE_NORMAL:
@@ -1190,21 +1203,30 @@ s32 init_level(void) {
if (gCurrentArea != NULL) {
reset_camera(gCurrentArea->camera);
if (gCurrDemoInput != NULL) {
set_mario_action(gMarioState, ACT_IDLE, 0);
} else if (!gDebugLevelSelect) {
if (gMarioState->action != ACT_UNINITIALIZED) {
if (save_file_exists(gCurrSaveFileNum - 1)) {
set_mario_action(gMarioState, ACT_IDLE, 0);
} else {
set_mario_action(gMarioState, ACT_INTRO_CUTSCENE, 0);
val4 = 1;
}
#ifdef PEACH_SKIP
if (gCurrDemoInput != NULL) {
set_mario_action(gMarioState, ACT_IDLE, 0);
} else if (gDebugLevelSelect == 0) {
if (gMarioState->action != ACT_UNINITIALIZED) {
set_mario_action(gMarioState, ACT_IDLE, 0);
}
}
}
#else
if (gCurrDemoInput != NULL) {
set_mario_action(gMarioState, ACT_IDLE, 0);
} else if (gDebugLevelSelect == 0) {
if (gMarioState->action != ACT_UNINITIALIZED) {
if (save_file_exists(gCurrSaveFileNum - 1)) {
set_mario_action(gMarioState, ACT_IDLE, 0);
} else {
set_mario_action(gMarioState, ACT_INTRO_CUTSCENE, 0);
val4 = 1;
}
}
}
}
#endif
if (val4 != 0) {
play_transition(WARP_TRANSITION_FADE_FROM_COLOR, 0x5A, 0xFF, 0xFF, 0xFF);
} else {
@@ -1266,8 +1288,11 @@ s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum) {
#endif
sWarpDest.type = WARP_TYPE_NOT_WARPING;
sDelayedWarpOp = WARP_OP_NONE;
#ifdef CASTLE_MUSIC_FIX
gNeverEnteredCastle = 0;
#else
gNeverEnteredCastle = !save_file_exists(gCurrSaveFileNum - 1);
#endif
gCurrLevelNum = levelNum;
gCurrCourseNum = COURSE_NONE;
gSavedCourseNum = COURSE_NONE;
+2 -2
View File
@@ -95,7 +95,7 @@ UNUSED static void spawn_macro_coin_unknown(const BehaviorScript *behavior, s16
struct LoadedPreset {
/*0x00*/ const BehaviorScript *behavior;
/*0x04*/ s16 param; // huh? why does the below function swap these.. just use the struct..
/*0x06*/ s16 model;
/*0x06*/ ModelID model;
};
#define MACRO_OBJ_Y_ROT 0
@@ -245,7 +245,7 @@ void spawn_special_objects(s16 areaIndex, s16 **specialObjList) {
s16 y;
s16 z;
s16 extraParams[4];
u8 model;
ModelID model;
u8 type;
u8 presetID;
u8 defaultParam;
+27 -3
View File
@@ -547,7 +547,7 @@ struct Surface *resolve_and_return_wall_collisions(Vec3f pos, f32 offset, f32 ra
f32 vec3f_find_ceil(Vec3f pos, f32 height, struct Surface **ceil) {
UNUSED f32 unused;
return find_ceil(pos[0], height + 80.0f, pos[2], ceil);
return find_ceil(pos[0], height + 3.0f, pos[2], ceil);
}
/**
@@ -639,6 +639,11 @@ s32 mario_floor_is_steep(struct MarioState *m) {
f32 normY;
s32 result = FALSE;
#ifdef JUMP_KICK_FIX
if (m->floor->type == SURFACE_NOT_SLIPPERY)
return FALSE;
#endif
// Interestingly, this function does not check for the
// slide terrain type. This means that steep behavior persists for
// non-slippery and slippery surfaces.
@@ -1167,6 +1172,24 @@ s32 transition_submerged_to_walking(struct MarioState *m) {
}
}
/**
* Transitions Mario from a submerged action to an airborne action.
* You may want to change these actions to fit your hack
*/
s32 transition_submerged_to_airborne(struct MarioState *m) {
set_camera_mode(m->area->camera, m->area->camera->defMode, 1);
vec3s_set(m->angleVel, 0, 0, 0);
if (m->heldObj == NULL) {
if (m->input & INPUT_A_DOWN) return set_mario_action(m, ACT_DIVE, 0);
else return set_mario_action(m, ACT_FREEFALL, 0);
} else {
if (m->input & INPUT_A_DOWN) return set_mario_action(m, ACT_HOLD_JUMP, 0);
else return set_mario_action(m, ACT_HOLD_FREEFALL, 0);
}
}
/**
* This is the transition function typically for entering a submerged action for a
* non-submerged action. This also applies the water surface camera preset.
@@ -1175,7 +1198,8 @@ s32 set_water_plunge_action(struct MarioState *m) {
m->forwardVel = m->forwardVel / 4.0f;
m->vel[1] = m->vel[1] / 2.0f;
m->pos[1] = m->waterLevel - 100;
// !BUG: Causes waterbox upwarp
// m->pos[1] = m->waterLevel - 100;
m->faceAngle[2] = 0;
@@ -1329,7 +1353,7 @@ void update_mario_geometry_inputs(struct MarioState *m) {
m->floorHeight = find_floor(m->pos[0], m->pos[1], m->pos[2], &m->floor);
}
m->ceilHeight = vec3f_find_ceil(&m->pos[0], m->floorHeight, &m->ceil);
m->ceilHeight = vec3f_find_ceil(m->pos, m->pos[1], &m->ceil);
gasLevel = find_poison_gas_level(m->pos[0], m->pos[2]);
m->waterLevel = find_water_level(m->pos[0], m->pos[2]);
+1
View File
@@ -46,6 +46,7 @@ s32 hurt_and_set_mario_action(struct MarioState *m, u32 action, u32 actionArg, s
s32 check_common_action_exits(struct MarioState *m);
s32 check_common_hold_action_exits(struct MarioState *m);
s32 transition_submerged_to_walking(struct MarioState *m);
s32 transition_submerged_to_airborne(struct MarioState *m);
s32 set_water_plunge_action(struct MarioState *m);
s32 execute_mario_action(UNUSED struct Object *o);
void init_mario(void);
+18 -7
View File
@@ -14,6 +14,8 @@
#include "save_file.h"
#include "rumble_init.h"
#include "config.h"
void play_flip_sounds(struct MarioState *m, s16 frame1, s16 frame2, s16 frame3) {
s32 animFrame = m->marioObj->header.gfx.animInfo.animFrame;
if (animFrame == frame1 || animFrame == frame2 || animFrame == frame3) {
@@ -61,6 +63,9 @@ s32 lava_boost_on_wall(struct MarioState *m) {
s32 check_fall_damage(struct MarioState *m, u32 hardFallAction) {
f32 fallHeight;
f32 damageHeight;
#ifdef NO_FALL_DAMAGE
return FALSE;
#endif
fallHeight = m->peakHeight - m->pos[1];
@@ -523,7 +528,7 @@ s32 act_backflip(struct MarioState *m) {
}
s32 act_freefall(struct MarioState *m) {
s32 animation;
s32 animation = 0;
if (m->input & INPUT_B_PRESSED) {
return set_mario_action(m, ACT_DIVE, 0);
@@ -1031,7 +1036,7 @@ s32 act_burning_fall(struct MarioState *m) {
}
s32 act_crazy_box_bounce(struct MarioState *m) {
f32 minSpeed;
f32 minSpeed = 0.0f;
if (m->actionTimer == 0) {
switch (m->actionArg) {
@@ -1311,7 +1316,7 @@ s32 act_air_hit_wall(struct MarioState *m) {
mario_drop_held_object(m);
}
if (++(m->actionTimer) <= 2) {
if (++(m->actionTimer) <= FIRSTY_LAST_FRAME) {
if (m->input & INPUT_A_PRESSED) {
m->vel[1] = 52.0f;
m->faceAngle[1] += 0x8000;
@@ -1337,10 +1342,15 @@ s32 act_air_hit_wall(struct MarioState *m) {
return set_mario_action(m, ACT_SOFT_BONK, 0);
}
#ifdef AVOID_UB
/*#ifdef AVOID_UB
return
#endif
#endif*/
#if FIRSTY_LAST_FRAME > 1
set_mario_animation(m, MARIO_ANIM_START_WALLKICK);
m->marioObj->header.gfx.angle[1] = atan2s(m->wall->normal.z, m->wall->normal.x);
#endif
return FALSE;
//! Missing return statement. The returned value is the result of the call
// to set_mario_animation. In practice, this value is nonzero.
@@ -2061,13 +2071,14 @@ s32 check_common_airborne_cancels(struct MarioState *m) {
}
s32 mario_execute_airborne_action(struct MarioState *m) {
u32 cancel;
u32 cancel = FALSE;
if (check_common_airborne_cancels(m)) {
return TRUE;
}
#ifndef NO_FALL_DAMAGE_SOUND
play_far_fall_sound(m);
#endif
/* clang-format off */
switch (m->action) {
+11 -5
View File
@@ -17,6 +17,8 @@
#include "level_table.h"
#include "rumble_init.h"
#include "config.h"
#define POLE_NONE 0
#define POLE_TOUCHED_FLOOR 1
#define POLE_FELL_OFF 2
@@ -308,7 +310,7 @@ s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos) {
m->wall = resolve_and_return_wall_collisions(nextPos, 50.0f, 50.0f);
floorHeight = find_floor(nextPos[0], nextPos[1], nextPos[2], &floor);
ceilHeight = vec3f_find_ceil(nextPos, floorHeight, &ceil);
ceilHeight = vec3f_find_ceil(nextPos, nextPos[1], &ceil);
if (floor == NULL) {
return HANG_HIT_CEIL_OR_OOB;
@@ -345,7 +347,7 @@ s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos) {
s32 update_hang_moving(struct MarioState *m) {
s32 stepResult;
Vec3f nextPos;
f32 maxSpeed = 4.0f;
f32 maxSpeed = HANGING_SPEED;
m->forwardVel += 1.0f;
if (m->forwardVel > maxSpeed) {
@@ -353,7 +355,11 @@ s32 update_hang_moving(struct MarioState *m) {
}
m->faceAngle[1] =
#ifdef TIGHTER_HANGING_CONTROLS
m->intendedYaw;
#else
m->intendedYaw - approach_s32((s16)(m->intendedYaw - m->faceAngle[1]), 0, 0x800, 0x800);
#endif
m->slideYaw = m->faceAngle[1];
m->slideVelX = m->forwardVel * sins(m->faceAngle[1]);
@@ -550,11 +556,11 @@ s32 act_ledge_grab(struct MarioState *m) {
if (m->actionTimer < 10) {
m->actionTimer++;
}
#ifndef NO_FALSE_LEDGEGRABS
if (m->floor->normal.y < 0.9063078f) {
return let_go_of_ledge(m);
}
#endif
if (m->input & (INPUT_Z_PRESSED | INPUT_OFF_FLOOR)) {
return let_go_of_ledge(m);
}
@@ -854,7 +860,7 @@ s32 check_common_automatic_cancels(struct MarioState *m) {
}
s32 mario_execute_automatic_action(struct MarioState *m) {
s32 cancel;
s32 cancel = FALSE;
if (check_common_automatic_cancels(m)) {
return TRUE;
+9 -1
View File
@@ -13,6 +13,8 @@
#include "behavior_data.h"
#include "rumble_init.h"
#include "config.h"
struct LandingAction {
s16 numFrames;
s16 unk02;
@@ -384,8 +386,13 @@ void update_shell_speed(struct MarioState *m) {
m->forwardVel = 64.0f;
}
#ifdef SUPER_RESPONSIVE_CONTROLS
m->faceAngle[1] = m->intendedYaw;
#else
m->faceAngle[1] =
m->intendedYaw - approach_s32((s16)(m->intendedYaw - m->faceAngle[1]), 0, 0x800, 0x800);
#endif
apply_slope_accel(m);
}
@@ -1285,6 +1292,7 @@ s32 act_crawling(struct MarioState *m) {
mario_set_forward_vel(m, 10.0f);
}
//! Possibly unintended missing break
// fall through
case GROUND_STEP_NONE:
align_with_floor(m);
@@ -1845,7 +1853,7 @@ s32 act_hold_freefall_land(struct MarioState *m) {
}
s32 act_long_jump_land(struct MarioState *m) {
#ifdef VERSION_SH
#if defined (VERSION_SH) || defined(DISABLE_BLJ)
// BLJ (Backwards Long Jump) speed build up fix, crushing SimpleFlips's dreams since July 1997
if (m->forwardVel < 0.0f) {
m->forwardVel = 0.0f;
+3 -3
View File
@@ -37,7 +37,7 @@ s32 mario_update_punch_sequence(struct MarioState *m) {
switch (m->actionArg) {
case 0:
play_sound(SOUND_MARIO_PUNCH_YAH, m->marioObj->header.gfx.cameraToObject);
// Fall-through:
// fall through
case 1:
set_mario_animation(m, MARIO_ANIM_FIRST_PUNCH);
if (is_anim_past_end(m)) {
@@ -77,7 +77,7 @@ s32 mario_update_punch_sequence(struct MarioState *m) {
case 3:
play_sound(SOUND_MARIO_PUNCH_WAH, m->marioObj->header.gfx.cameraToObject);
// Fall-through:
// fall through
case 4:
set_mario_animation(m, MARIO_ANIM_SECOND_PUNCH);
if (is_anim_past_end(m)) {
@@ -456,7 +456,7 @@ s32 check_common_object_cancels(struct MarioState *m) {
}
s32 mario_execute_object_action(struct MarioState *m) {
s32 cancel;
s32 cancel = FALSE;
if (check_common_object_cancels(m)) {
return TRUE;
+1 -1
View File
@@ -180,7 +180,7 @@ void play_anim_sound(struct MarioState *m, u32 actionState, s32 animFrame, u32 s
s32 act_start_sleeping(struct MarioState *m) {
#ifndef VERSION_JP
s32 animFrame;
s32 animFrame = 0;
#endif
if (check_common_idle_cancels(m)) {
+7 -2
View File
@@ -76,7 +76,7 @@ static u32 perform_water_full_step(struct MarioState *m, Vec3f nextPos) {
wall = resolve_and_return_wall_collisions(nextPos, 10.0f, 110.0f);
floorHeight = find_floor(nextPos[0], nextPos[1], nextPos[2], &floor);
ceilHeight = vec3f_find_ceil(nextPos, floorHeight, &ceil);
ceilHeight = vec3f_find_ceil(nextPos, nextPos[1], &ceil);
if (floor == NULL) {
return WATER_STEP_CANCELLED;
@@ -1500,7 +1500,12 @@ static s32 act_hold_metal_water_fall_land(struct MarioState *m) {
static s32 check_common_submerged_cancels(struct MarioState *m) {
if (m->pos[1] > m->waterLevel - 80) {
if (m->waterLevel - 80 > m->floorHeight) {
m->pos[1] = m->waterLevel - 80;
if (m->pos[1] - (m->waterLevel - 80) < 50) {
m->pos[1] = m->waterLevel - 80; // lock mario to top if the falloff isn't big enough
} else {
// m->pos[1] = m->waterLevel - 80; //! BUG: Downwarp swimming out of waterfalls
return transition_submerged_to_airborne(m);
}
} else {
//! If you press B to throw the shell, there is a ~5 frame window
// where your held object is the shell, but you are not in the
+3 -1
View File
@@ -25,6 +25,8 @@
#include "skybox.h"
#include "sound_init.h"
#include "config.h"
#define TOAD_STAR_1_REQUIREMENT 12
#define TOAD_STAR_2_REQUIREMENT 25
#define TOAD_STAR_3_REQUIREMENT 35
@@ -79,7 +81,7 @@ struct GraphNodeObject gMirrorMario; // copy of Mario's geo node for drawing mi
// (message NPC related things, the Mario head geo, and Mario geo
// functions)
#ifdef GODDARD
#ifdef KEEP_MARIO_HEAD
/**
* Geo node script that draws Mario's head on the title screen.
*/
+2 -1
View File
@@ -5,11 +5,12 @@
#include "macros.h"
#include "types.h"
#include "config.h"
extern struct GraphNodeObject gMirrorMario;
extern struct MarioBodyState gBodyStates[2];
#ifdef GODDARD
#ifdef KEEP_MARIO_HEAD
Gfx *geo_draw_mario_head_goddard(s32 callContext, struct GraphNode *node, Mat4 *c);
#endif
void bhv_toad_message_loop(void);
+13 -4
View File
@@ -9,6 +9,8 @@
#include "interaction.h"
#include "mario_step.h"
#include "config.h"
static s16 sMovingSandSpeeds[] = { 12, 8, 4, 0 };
struct Surface gWaterSurfacePseudoFloor = {
@@ -268,7 +270,7 @@ static s32 perform_ground_quarter_step(struct MarioState *m, Vec3f nextPos) {
upperWall = resolve_and_return_wall_collisions(nextPos, 60.0f, 50.0f);
floorHeight = find_floor(nextPos[0], nextPos[1], nextPos[2], &floor);
ceilHeight = vec3f_find_ceil(nextPos, floorHeight, &ceil);
ceilHeight = vec3f_find_ceil(nextPos, nextPos[1], &ceil);
waterLevel = find_water_level(nextPos[0], nextPos[2]);
@@ -402,11 +404,11 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr
lowerWall = resolve_and_return_wall_collisions(nextPos, 30.0f, 50.0f);
floorHeight = find_floor(nextPos[0], nextPos[1], nextPos[2], &floor);
ceilHeight = vec3f_find_ceil(nextPos, floorHeight, &ceil);
ceilHeight = vec3f_find_ceil(nextPos, nextPos[1], &ceil);
waterLevel = find_water_level(nextPos[0], nextPos[2]);
m->wall = NULL;
//m->wall = NULL;
//! The water pseudo floor is not referenced when your intended qstep is
// out of bounds, so it won't detect you as landing.
@@ -448,8 +450,12 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr
m->vel[1] = 0.0f;
//! Uses referenced ceiling instead of ceil (ceiling hang upwarp)
#ifdef HANGING_FIX
if (m->ceil != NULL && m->ceil->type == SURFACE_HANGABLE) {
#else
if ((stepArg & AIR_STEP_CHECK_HANG) && m->ceil != NULL
&& m->ceil->type == SURFACE_HANGABLE) {
#endif
return AIR_STEP_GRABBED_CEILING;
}
@@ -490,8 +496,11 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr
if (m->wall->type == SURFACE_BURNING) {
return AIR_STEP_HIT_LAVA_WALL;
}
#ifdef WALLKICKS_46_DEGREES
if (wallDYaw < -0x5F00 || wallDYaw > 0x5700) {
#else
if (wallDYaw < -0x6000 || wallDYaw > 0x6000) {
#endif
m->flags |= MARIO_UNKNOWN_30;
return AIR_STEP_HIT_WALL;
}
+2
View File
@@ -969,6 +969,8 @@ Gfx *geo_movtex_update_horizontal(s32 callContext, struct GraphNode *node, UNUSE
case MOVTEX_TREADMILL_SMALL:
movtexVerts = segmented_to_virtual(ttc_movtex_tris_small_surface_treadmill);
break;
default:
return NULL;
}
update_moving_texture_offset(movtexVerts, MOVTEX_ATTR_COLORED_S);
}
+14 -4
View File
@@ -394,7 +394,8 @@ s16 obj_angle_to_object(struct Object *obj1, struct Object *obj2) {
s16 obj_turn_toward_object(struct Object *obj, struct Object *target, s16 angleIndex, s16 turnAmount) {
f32 a, b, c, d;
UNUSED s32 unused;
s16 targetAngle, startAngle;
s16 targetAngle = 0;
s16 startAngle;
switch (angleIndex) {
case O_MOVE_ANGLE_PITCH_INDEX:
@@ -1825,7 +1826,7 @@ void cur_obj_move_standard(s16 steepSlopeAngleDegrees) {
}
}
static s32 cur_obj_within_12k_bounds(void) {
UNUSED static s32 cur_obj_within_12k_bounds(void) {
if (o->oPosX < -12000.0f || 12000.0f < o->oPosX) {
return FALSE;
}
@@ -1842,12 +1843,10 @@ static s32 cur_obj_within_12k_bounds(void) {
}
void cur_obj_move_using_vel_and_gravity(void) {
if (cur_obj_within_12k_bounds()) {
o->oPosX += o->oVelX;
o->oPosZ += o->oVelZ;
o->oVelY += o->oGravity; //! No terminal velocity
o->oPosY += o->oVelY;
}
}
void cur_obj_move_using_fvel_and_gravity(void) {
@@ -2913,3 +2912,14 @@ void cur_obj_spawn_star_at_y_offset(f32 targetX, f32 targetY, f32 targetZ, f32 o
o->oPosY = objectPosY;
}
#endif
// Extra functions for ultrasm64-extbounds
void obj_set_model(struct Object *obj, s32 modelID) {
obj->header.gfx.sharedChild = gLoadedGraphNodes[modelID];
}
s32 obj_has_model(struct Object *obj, u16 modelID) {
return (obj->header.gfx.sharedChild == gLoadedGraphNodes[modelID]);
}
// End of ultrasm64-extbounds stuff
+6 -1
View File
@@ -55,7 +55,7 @@ struct SpawnParticlesInfo
{
/*0x00*/ s8 behParam;
/*0x01*/ s8 count;
/*0x02*/ u8 model;
/*0x02*/ ModelID model;
/*0x03*/ s8 offsetY;
/*0x04*/ s8 forwardVelBase;
/*0x05*/ s8 forwardVelRange;
@@ -298,4 +298,9 @@ void cur_obj_spawn_loot_blue_coin(void);
void cur_obj_spawn_star_at_y_offset(f32 targetX, f32 targetY, f32 targetZ, f32 offsetY);
#endif
// Extra functions for ultrasm64-extbounds
void obj_set_model(struct Object *obj, s32 modelID);
s32 obj_has_model(struct Object *obj, u16 modelID);
// End of ultrasm64-extbounds stuff
#endif // OBJECT_HELPERS_H
+2 -2
View File
@@ -188,7 +188,7 @@ s8 sObjectListUpdateOrder[] = { OBJ_LIST_SPAWNER,
struct ParticleProperties {
u32 particleFlag;
u32 activeParticleFlag;
u8 model;
ModelID model;
const BehaviorScript *behavior;
};
@@ -495,7 +495,7 @@ void spawn_objects_from_info(UNUSED s32 unused, struct SpawnInfo *spawnInfo) {
object->respawnInfoType = RESPAWN_INFO_TYPE_32;
object->respawnInfo = &spawnInfo->behaviorArg;
if (spawnInfo->behaviorArg & 0x01) {
if (object->behavior == segmented_to_virtual(bhvMario)) {
gMarioObject = object;
geo_make_first_child(&object->header.gfx.node);
}
+1 -1
View File
@@ -1019,7 +1019,7 @@ Gfx *display_painting_rippling(struct Painting *painting) {
s16 *neighborTris = segmented_to_virtual(seg2_painting_mesh_neighbor_tris);
s16 numVtx = mesh[0];
s16 numTris = mesh[numVtx * 3 + 1];
Gfx *dlist;
Gfx *dlist = NULL;
// Generate the mesh and its lighting data
painting_generate_mesh(painting, mesh, numVtx);
+147 -9
View File
@@ -8,6 +8,9 @@
#include "object_list_processor.h"
#include "platform_displacement.h"
#include "types.h"
#include "sm64.h"
#include "config.h"
u16 D_8032FEC0 = 0;
@@ -83,7 +86,143 @@ void set_mario_pos(f32 x, f32 y, f32 z) {
gMarioStates[0].pos[1] = y;
gMarioStates[0].pos[2] = z;
}
#ifdef PLATFORM_DISPLACEMENT_2
static struct PlatformDisplacementInfo sMarioDisplacementInfo;
static Vec3f sMarioAmountDisplaced;
extern s32 gGlobalTimer;
/**
* Upscale or downscale a vector by another vector.
*/
static void scale_vec3f(Vec3f dst, Vec3f src, Vec3f scale, u32 doInverted) {
if (doInverted) {
dst[0] = src[0] / scale[0];
dst[1] = src[1] / scale[1];
dst[2] = src[2] / scale[2];
} else {
dst[0] = src[0] * scale[0];
dst[1] = src[1] * scale[1];
dst[2] = src[2] * scale[2];
}
}
/**
* Apply one frame of platform displacement to Mario or an object using the given
* platform.
*/
void apply_platform_displacement(struct PlatformDisplacementInfo *displaceInfo, Vec3f pos, s16 *yaw, struct Object *platform) {
Vec3f platformPos;
Vec3f posDifference;
Vec3f yawVec;
Vec3f scaledPos;
// Determine how much Mario turned on his own since last frame
s16 yawDifference = *yaw - displaceInfo->prevYaw;
// Avoid a crash if the platform unloaded its collision while stood on
if (platform->header.gfx.throwMatrix == NULL) return;
vec3f_copy(platformPos, (*platform->header.gfx.throwMatrix)[3]);
// Determine how far Mario moved on his own since last frame
vec3f_copy(posDifference, pos);
vec3f_sub(posDifference, displaceInfo->prevPos);
if ((platform == displaceInfo->prevPlatform) && (gGlobalTimer == displaceInfo->prevTimer + 1)) {
// Transform from relative positions to world positions
scale_vec3f(scaledPos, displaceInfo->prevTransformedPos, platform->header.gfx.scale, FALSE);
linear_mtxf_mul_vec3f(*platform->header.gfx.throwMatrix, pos, scaledPos);
// Add on how much Mario moved in the previous frame
vec3f_add(pos, posDifference);
// Calculate new yaw
linear_mtxf_mul_vec3f(*platform->header.gfx.throwMatrix, yawVec, displaceInfo->prevTransformedYawVec);
*yaw = atan2s(yawVec[2], yawVec[0]) + yawDifference;
} else {
// First frame of standing on the platform, don't calculate a new position
vec3f_sub(pos, platformPos);
}
// Transform from world positions to relative positions for use next frame
linear_mtxf_transpose_mul_vec3f(*platform->header.gfx.throwMatrix, scaledPos, pos);
scale_vec3f(displaceInfo->prevTransformedPos, scaledPos, platform->header.gfx.scale, TRUE);
vec3f_add(pos, platformPos);
// If the object is Mario, set inertia
if (pos == gMarioState->pos) {
vec3f_copy(sMarioAmountDisplaced, pos);
vec3f_sub(sMarioAmountDisplaced, displaceInfo->prevPos);
vec3f_sub(sMarioAmountDisplaced, posDifference);
// Make sure inertia isn't set on the first frame otherwise the previous value isn't cleared
if ((platform != displaceInfo->prevPlatform) || (gGlobalTimer != displaceInfo->prevTimer + 1)) {
vec3f_set(sMarioAmountDisplaced, 0.f, 0.f, 0.f);
}
}
// Update info for next frame
// Update position
vec3f_copy(displaceInfo->prevPos, pos);
// Set yaw info
vec3f_set(yawVec, sins(*yaw), 0, coss(*yaw));
linear_mtxf_transpose_mul_vec3f(*platform->header.gfx.throwMatrix, displaceInfo->prevTransformedYawVec, yawVec);
displaceInfo->prevYaw = *yaw;
// Update platform and timer
displaceInfo->prevPlatform = platform;
displaceInfo->prevTimer = gGlobalTimer;
}
// Doesn't change in the code, set this to FALSE if you don't want inertia
u8 gDoInertia = TRUE;
static u8 sShouldApplyInertia = FALSE;
static u8 sInertiaFirstFrame = FALSE;
/**
* Apply inertia based on Mario's last platform.
*/
static void apply_mario_inertia(void) {
// On the first frame of leaving the ground, boost Mario's y velocity
if (sInertiaFirstFrame) {
gMarioState->vel[1] += sMarioAmountDisplaced[1];
}
// Apply sideways inertia
gMarioState->pos[0] += sMarioAmountDisplaced[0];
gMarioState->pos[2] += sMarioAmountDisplaced[2];
// Drag
sMarioAmountDisplaced[0] *= 0.97f;
sMarioAmountDisplaced[2] *= 0.97f;
// Stop applying inertia once Mario has landed, or when ground pounding
if (!(gMarioState->action & ACT_FLAG_AIR) || (gMarioState->action == ACT_GROUND_POUND)) {
sShouldApplyInertia = FALSE;
}
}
/**
* Apply platform displacement or inertia if required.
*/
void apply_mario_platform_displacement(void) {
struct Object *platform;
platform = gMarioPlatform;
if (!(gTimeStopState & TIME_STOP_ACTIVE) && gMarioObject != NULL) {
if (platform != NULL) {
apply_platform_displacement(&sMarioDisplacementInfo, gMarioState->pos, &gMarioState->faceAngle[1], platform);
sShouldApplyInertia = TRUE;
sInertiaFirstFrame = TRUE;
} else if (sShouldApplyInertia && gDoInertia) {
apply_mario_inertia();
sInertiaFirstFrame = FALSE;
}
}
}
#else
/**
* Apply one frame of platform rotation to Mario or an object using the given
* platform. If isMario is false, use gCurrentObject.
@@ -124,11 +263,9 @@ void apply_platform_displacement(u32 isMario, struct Object *platform) {
unused1 = rotation[0];
unused2 = rotation[2];
unused3 = platform->oFaceAngleYaw;
if (isMario) {
gMarioStates[0].faceAngle[1] += rotation[1];
}
if (isMario) {
gMarioStates[0].faceAngle[1] += rotation[1];
}
platformPosX = platform->oPosX;
platformPosY = platform->oPosY;
platformPosZ = platform->oPosZ;
@@ -150,12 +287,10 @@ void apply_platform_displacement(u32 isMario, struct Object *platform) {
mtxf_rotate_zxy_and_translate(displaceMatrix, currentObjectOffset, rotation);
linear_mtxf_mul_vec3f(displaceMatrix, newObjectOffset, relativeOffset);
x = platformPosX + newObjectOffset[0];
y = platformPosY + newObjectOffset[1];
z = platformPosZ + newObjectOffset[2];
}
if (isMario) {
set_mario_pos(x, y, z);
} else {
@@ -165,9 +300,10 @@ void apply_platform_displacement(u32 isMario, struct Object *platform) {
}
}
/**
* If Mario's platform is not null, apply platform displacement.
*/
* If Mario's platform is not null, apply platform displacement.
*/
void apply_mario_platform_displacement(void) {
struct Object *platform = gMarioPlatform;
@@ -175,6 +311,8 @@ void apply_mario_platform_displacement(void) {
apply_platform_displacement(TRUE, platform);
}
}
#endif
#ifndef VERSION_JP
/**
+16 -1
View File
@@ -5,10 +5,25 @@
#include "types.h"
#include "config.h"
#ifdef PLATFORM_DISPLACEMENT_2
struct PlatformDisplacementInfo {
Vec3f prevPos;
Vec3f prevTransformedPos;
Vec3f prevTransformedYawVec;
s16 prevYaw;
struct Object *prevPlatform;
s32 prevTimer;
};
#endif
void update_mario_platform(void);
void get_mario_pos(f32 *x, f32 *y, f32 *z);
void set_mario_pos(f32 x, f32 y, f32 z);
void apply_platform_displacement(u32 isMario, struct Object *platform);
#ifdef PLATFORM_DISPLACEMENT_2
void apply_platform_displacement(struct PlatformDisplacementInfo *displaceInfo, Vec3f pos, s16 *yaw, struct Object *platform);
#else
void apply_platform_displacement(u32 isMario, struct Object *platform);
#endif
void apply_mario_platform_displacement(void);
#ifndef VERSION_JP
void clear_mario_platform(void);
+93 -19
View File
@@ -10,6 +10,12 @@
#include "rendering_graph_node.h"
#include "shadow.h"
#include "sm64.h"
#include "game_init.h"
#include "engine/extended_bounds.h"
#include "config.h"
#define WIDESCREEN
/**
* This file contains the code that processes the scene graph for rendering.
@@ -39,6 +45,7 @@
s16 gMatStackIndex;
Mat4 gMatStack[32];
Mtx *gMatStackFixed[32];
f32 aspect;
/**
* Animation nodes have state in global variables, so this struct captures
@@ -72,6 +79,52 @@ struct RenderModeContainer {
};
/* Rendermode settings for cycle 1 for all 8 layers. */
#ifdef DISABLE_AA
struct RenderModeContainer renderModeTable_1Cycle[2] = { { {
G_RM_OPA_SURF,
G_RM_AA_OPA_SURF,
G_RM_AA_OPA_SURF,
G_RM_AA_OPA_SURF,
G_RM_AA_TEX_EDGE,
G_RM_AA_XLU_SURF,
G_RM_AA_XLU_SURF,
G_RM_AA_XLU_SURF,
} },
{ {
/* z-buffered */
G_RM_ZB_OPA_SURF,
G_RM_ZB_OPA_SURF,
G_RM_ZB_OPA_DECAL,
G_RM_AA_ZB_OPA_INTER,
G_RM_AA_ZB_TEX_EDGE,
G_RM_ZB_XLU_SURF,
G_RM_ZB_XLU_DECAL,
G_RM_AA_ZB_XLU_INTER,
} } };
/* Rendermode settings for cycle 2 for all 8 layers. */
struct RenderModeContainer renderModeTable_2Cycle[2] = { { {
G_RM_OPA_SURF2,
G_RM_AA_OPA_SURF2,
G_RM_AA_OPA_SURF2,
G_RM_AA_OPA_SURF2,
G_RM_AA_TEX_EDGE2,
G_RM_AA_XLU_SURF2,
G_RM_AA_XLU_SURF2,
G_RM_AA_XLU_SURF2,
} },
{ {
/* z-buffered */
G_RM_ZB_OPA_SURF2,
G_RM_ZB_OPA_SURF2,
G_RM_ZB_OPA_DECAL2,
G_RM_AA_ZB_OPA_INTER2,
G_RM_AA_ZB_TEX_EDGE2,
G_RM_ZB_XLU_SURF2,
G_RM_ZB_XLU_DECAL2,
G_RM_AA_ZB_XLU_INTER2,
} } };
#else
struct RenderModeContainer renderModeTable_1Cycle[2] = { { {
G_RM_OPA_SURF,
G_RM_AA_OPA_SURF,
@@ -116,6 +169,7 @@ struct RenderModeContainer renderModeTable_2Cycle[2] = { { {
G_RM_AA_ZB_XLU_DECAL2,
G_RM_AA_ZB_XLU_INTER2,
} } };
#endif
struct GraphNodeRoot *gCurGraphNodeRoot = NULL;
struct GraphNodeMasterList *gCurGraphNodeMasterList = NULL;
@@ -242,14 +296,22 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
if (node->fnNode.node.children != NULL) {
u16 perspNorm;
Mtx *mtx = alloc_display_list(sizeof(*mtx));
#ifdef WIDE
if (gWidescreen){
if (gCurrLevelNum == 0x01) {
aspect = 1.33333f;
} else {
aspect = 1.775f;
}
}
else{
aspect = 1.33333f;
}
#else
aspect = 1.33333f;
#endif
#ifdef VERSION_EU
f32 aspect = ((f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height) * 1.1f;
#else
f32 aspect = (f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height;
#endif
guPerspective(mtx, &perspNorm, node->fov, aspect, node->near, node->far, 1.0f);
guPerspective(mtx, &perspNorm, node->fov, aspect, node->near / WORLD_SCALE, node->far / WORLD_SCALE, 1.0f);
gSPPerspNormalize(gDisplayListHead++, perspNorm);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH);
@@ -267,17 +329,18 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
* range of this node.
*/
static void geo_process_level_of_detail(struct GraphNodeLevelOfDetail *node) {
#ifdef GBI_FLOATS
Mtx *mtx = gMatStackFixed[gMatStackIndex];
s16 distanceFromCam = (s32) -mtx->m[3][2]; // z-component of the translation column
f32 distanceFromCam;
#ifdef AUTO_LOD
if (gIsConsole) {
distanceFromCam = -gMatStack[gMatStackIndex][3][2];
} else {
distanceFromCam = 50;
}
#else
// The fixed point Mtx type is defined as 16 longs, but it's actually 16
// shorts for the integer parts followed by 16 shorts for the fraction parts
Mtx *mtx = gMatStackFixed[gMatStackIndex];
s16 distanceFromCam = -GET_HIGH_S16_OF_32(mtx->m[1][3]); // z-component of the translation column
distanceFromCam = -gMatStack[gMatStackIndex][3][2];
#endif
if (node->minDistance <= distanceFromCam && distanceFromCam < node->maxDistance) {
if ((f32)node->minDistance <= distanceFromCam && distanceFromCam < (f32)node->maxDistance) {
if (node->node.children != 0) {
geo_process_node_and_siblings(node->node.children);
}
@@ -304,6 +367,17 @@ static void geo_process_switch(struct GraphNodeSwitchCase *node) {
}
}
static void make_roll_matrix(Mtx *mtx, s16 angle) {
Mat4 temp;
mtxf_identity(temp);
temp[0][0] = coss(angle);
temp[0][1] = sins(angle);
temp[1][0] = -temp[0][1];
temp[1][1] = temp[0][0];
guMtxF2L(temp, mtx);
}
/**
* Process a camera node.
*/
@@ -315,7 +389,7 @@ static void geo_process_camera(struct GraphNodeCamera *node) {
if (node->fnNode.func != NULL) {
node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node, gMatStack[gMatStackIndex]);
}
mtxf_rotate_xy(rollMtx, node->rollScreen);
make_roll_matrix(rollMtx, node->rollScreen);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(rollMtx), G_MTX_PROJECTION | G_MTX_MUL | G_MTX_NOPUSH);
@@ -696,7 +770,7 @@ static void geo_process_shadow(struct GraphNodeShadow *node) {
gMatStackFixed[gMatStackIndex] = mtx;
if (gShadowAboveWaterOrLava == TRUE) {
geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(shadowList), 4);
} else if (gMarioOnIceOrCarpet == 1) {
} else if (gMarioOnIceOrCarpet == 1 || gShadowAboveCustomWater == 1) {
geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(shadowList), 5);
} else {
geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(shadowList), 6);
@@ -755,7 +829,7 @@ static s32 obj_is_in_view(struct GraphNodeObject *node, Mat4 matrix) {
// ! @bug The aspect ratio is not accounted for. When the fov value is 45,
// the horizontal effective fov is actually 60 degrees, so you can see objects
// visibly pop in or out at the edge of the screen.
halfFov = (gCurGraphNodeCamFrustum->fov / 2.0f + 1.0f) * 32768.0f / 180.0f + 0.5f;
halfFov = ((gCurGraphNodeCamFrustum->fov*aspect) / 2.0f + 1.0f) * 32768.0f / 180.0f + 0.5f;
hScreenEdge = -matrix[3][2] * sins(halfFov) / coss(halfFov);
// -matrix[3][2] is the depth, which gets multiplied by tan(halfFov) to get
+26 -1
View File
@@ -11,6 +11,7 @@
#include "level_table.h"
#include "course_table.h"
#include "rumble_init.h"
#include "config.h"
#ifdef SRAM
#include "sram.h"
#endif
@@ -413,8 +414,13 @@ void save_file_reload(void) {
void save_file_collect_star_or_key(s16 coinScore, s16 starIndex) {
s32 fileIndex = gCurrSaveFileNum - 1;
s32 courseIndex = gCurrCourseNum - 1;
#ifdef GLOBAL_STAR_IDS
s32 starByte = (starIndex / 7) - 1;
s32 starFlag = 1 << (starIndex % 7);
#else
s32 starFlag = 1 << starIndex;
#endif
UNUSED s32 flags = save_file_get_flags();
gLastCompletedCourseNum = courseIndex + 1;
@@ -456,9 +462,15 @@ void save_file_collect_star_or_key(s16 coinScore, s16 starIndex) {
break;
default:
#ifdef GLOBAL_STAR_IDS
if (!(save_file_get_star_flags(fileIndex, starByte) & starFlag)) {
save_file_set_star_flags(fileIndex, starByte, starFlag);
}
#else
if (!(save_file_get_star_flags(fileIndex, courseIndex) & starFlag)) {
save_file_set_star_flags(fileIndex, courseIndex, starFlag);
}
#endif
break;
}
}
@@ -617,6 +629,19 @@ void save_file_set_sound_mode(u16 mode) {
save_main_menu_data();
}
#ifdef WIDE
u8 save_file_get_widescreen_mode(void) {
return gSaveBuffer.menuData[0].wideMode;
}
void save_file_set_widescreen_mode(u8 mode) {
gSaveBuffer.menuData[0].wideMode = mode;
gMainMenuDataModified = TRUE;
save_main_menu_data();
}
#endif
u16 save_file_get_sound_mode(void) {
return gSaveBuffer.menuData[0].soundMode;
}
+7
View File
@@ -59,6 +59,9 @@ struct MainMenuSaveData
// on the high score screen.
u32 coinScoreAges[NUM_SAVE_FILES];
u8 soundMode: 2;
#ifdef WIDE
u8 wideMode: 1;
#endif
#ifdef VERSION_EU
u8 language: 2;
@@ -160,6 +163,10 @@ void save_file_set_cap_pos(s16 x, s16 y, s16 z);
s32 save_file_get_cap_pos(Vec3s capPos);
void save_file_set_sound_mode(u16 mode);
u16 save_file_get_sound_mode(void);
#ifdef WIDE
u8 save_file_get_widescreen_mode(void);
void save_file_set_widescreen_mode(u8 mode);
#endif
void save_file_move_cap_to_default_location(void);
void disable_warp_checkpoint(void);
+1 -1
View File
@@ -30,7 +30,7 @@ s32 set_and_reset_transition_fade_timer(s8 fadeTimer, u8 transTime) {
}
u8 set_transition_color_fade_alpha(s8 fadeType, s8 fadeTimer, u8 transTime) {
u8 time;
u8 time = 0;
switch (fadeType) {
case 0:
+36 -15
View File
@@ -102,6 +102,7 @@ shadowRectangle rectangles[2] = {
// See shadow.h for documentation.
s8 gShadowAboveWaterOrLava;
s8 gShadowAboveCustomWater;
s8 gMarioOnIceOrCarpet;
s8 sMarioOnFlyingCarpet;
s16 sSurfaceTypeBelowShadow;
@@ -177,14 +178,15 @@ u8 dim_shadow_with_distance(u8 solidity, f32 distFromFloor) {
* Return the water level below a shadow, or 0 if the water level is below
* -10,000.
*/
f32 get_water_level_below_shadow(struct Shadow *s) {
f32 waterLevel = find_water_level(s->parentX, s->parentZ);
f32 get_water_level_below_shadow(struct Shadow *s, struct Surface **waterFloor) {
f32 waterLevel = find_water_level_and_floor(s->parentX, s->parentZ, waterFloor);
if (waterLevel < FLOOR_LOWER_LIMIT_SHADOW) {
return 0;
} else if (s->parentY >= waterLevel && s->floorHeight <= waterLevel) {
gShadowAboveWaterOrLava = TRUE;
return waterLevel;
}
return waterLevel;
//! @bug Missing return statement. This compiles to return `waterLevel`
//! incidentally.
#ifdef AVOID_UB
@@ -204,6 +206,7 @@ s8 init_shadow(struct Shadow *s, f32 xPos, f32 yPos, f32 zPos, s16 shadowScale,
f32 waterLevel;
f32 floorSteepness;
struct FloorGeometry *floorGeometry;
struct Surface *waterFloor = NULL;
s->parentX = xPos;
s->parentY = yPos;
@@ -211,18 +214,33 @@ s8 init_shadow(struct Shadow *s, f32 xPos, f32 yPos, f32 zPos, s16 shadowScale,
s->floorHeight = find_floor_height_and_data(s->parentX, s->parentY, s->parentZ, &floorGeometry);
if (gEnvironmentRegions != 0) {
waterLevel = get_water_level_below_shadow(s);
}
waterLevel = get_water_level_below_shadow(s, &waterFloor);
// if (gEnvironmentRegions != 0) {
// waterLevel = get_water_level_below_shadow(s);
// }
if (gShadowAboveWaterOrLava) {
//! @bug Use of potentially undefined variable `waterLevel`
s->floorHeight = waterLevel;
// Assume that the water is flat.
s->floorNormalX = 0;
s->floorNormalY = 1.0;
s->floorNormalZ = 0;
s->floorOriginOffset = -waterLevel;
if (waterFloor != NULL) {
s->floorNormalX = waterFloor->normal.x;
s->floorNormalY = waterFloor->normal.y;
s->floorNormalZ = waterFloor->normal.z;
s->floorOriginOffset = waterFloor->originOffset;
gShadowAboveWaterOrLava = FALSE;
gShadowAboveCustomWater = TRUE;
s->solidity = 200;
} else {
gShadowAboveCustomWater = FALSE;
// Assume that the water is flat.
s->floorNormalX = 0;
s->floorNormalY = 1.0;
s->floorNormalZ = 0;
s->floorOriginOffset = -waterLevel;
}
} else {
// Don't draw a shadow if the floor is lower than expected possible,
// or if the y-normal is negative (an unexpected result).
@@ -292,7 +310,8 @@ void make_shadow_vertex_at_xyz(Vtx *vertices, s8 index, f32 relX, f32 relY, f32
s16 vtxX = round_float(relX);
s16 vtxY = round_float(relY);
s16 vtxZ = round_float(relZ);
s16 textureX, textureY;
s16 textureX = 0;
s16 textureY = 0;
switch (shadowVertexType) {
case SHADOW_WITH_9_VERTS:
@@ -527,9 +546,6 @@ s8 correct_shadow_solidity_for_animations(s32 isLuigi, u8 initialSolidity, struc
s16 animFrame;
switch (isLuigi) {
case 0:
player = gMarioObject;
break;
case 1:
/**
* This is evidence of a removed second player, likely Luigi.
@@ -541,6 +557,10 @@ s8 correct_shadow_solidity_for_animations(s32 isLuigi, u8 initialSolidity, struc
*/
player = gLuigiObject;
break;
case 0:
default:
player = gMarioObject;
break;
}
animFrame = player->header.gfx.animInfo.animFrame;
@@ -594,7 +614,7 @@ Gfx *create_shadow_player(f32 xPos, f32 yPos, f32 zPos, s16 shadowScale, u8 soli
Vtx *verts;
Gfx *displayList;
struct Shadow shadow;
s8 ret;
s8 ret = 0;
s32 i;
// Update global variables about whether Mario is on a flying carpet.
@@ -856,6 +876,7 @@ Gfx *create_shadow_below_xyz(f32 xPos, f32 yPos, f32 zPos, s16 shadowScale, u8 s
find_floor(xPos, yPos, zPos, &pfloor);
gShadowAboveWaterOrLava = FALSE;
gShadowAboveCustomWater = FALSE;
gMarioOnIceOrCarpet = 0;
sMarioOnFlyingCarpet = 0;
if (pfloor != NULL) {
+1
View File
@@ -38,6 +38,7 @@ extern s16 sSurfaceTypeBelowShadow;
* Flag for if the current shadow is above water or lava.
*/
extern s8 gShadowAboveWaterOrLava;
extern s8 gShadowAboveCustomWater;
/**
* Flag for if Mario is on ice or a flying carpet.
+9 -9
View File
@@ -60,7 +60,7 @@ struct Skybox {
struct Skybox sSkyBoxInfo[2];
typedef const u8 *const SkyboxTexture[80];
typedef const u8 *const SkyboxTexture[80 * SKYBOX_SIZE];
extern SkyboxTexture bbh_skybox_ptrlist;
extern SkyboxTexture bidw_skybox_ptrlist;
@@ -108,21 +108,21 @@ u8 sSkyboxColors[][3] = {
* The tile's width in world space.
* By default, two full tiles can fit in the screen.
*/
#define SKYBOX_TILE_WIDTH (SCREEN_WIDTH / 2)
#define SKYBOX_TILE_WIDTH (SCREEN_WIDTH / (2 * SKYBOX_SIZE))
/**
* The tile's height in world space.
* By default, two full tiles can fit in the screen.
*/
#define SKYBOX_TILE_HEIGHT (SCREEN_HEIGHT / 2)
#define SKYBOX_TILE_HEIGHT (SCREEN_HEIGHT / (2 * SKYBOX_SIZE))
/**
* The horizontal length of the skybox tilemap in tiles.
*/
#define SKYBOX_COLS (10)
#define SKYBOX_COLS (10 * SKYBOX_SIZE)
/**
* The vertical length of the skybox tilemap in tiles.
*/
#define SKYBOX_ROWS (8)
#define SKYBOX_ROWS (8 * SKYBOX_SIZE)
/**
@@ -165,7 +165,7 @@ s32 calculate_skybox_scaled_y(s8 player, UNUSED f32 fov) {
// Since pitch can be negative, and the tile grid starts 1 octant above the camera's focus, add
// 5 octants to the y position
s32 scaledY = roundedY + 5 * SKYBOX_TILE_HEIGHT;
s32 scaledY = roundedY + (5 * SKYBOX_SIZE) * SKYBOX_TILE_HEIGHT;
if (scaledY > SKYBOX_HEIGHT) {
scaledY = SKYBOX_HEIGHT;
@@ -221,8 +221,8 @@ void draw_skybox_tile_grid(Gfx **dlist, s8 background, s8 player, s8 colorIndex)
s32 row;
s32 col;
for (row = 0; row < 3; row++) {
for (col = 0; col < 3; col++) {
for (row = 0; row < (3 * SKYBOX_SIZE); row++) {
for (col = 0; col < (3 * SKYBOX_SIZE); col++) {
s32 tileIndex = sSkyBoxInfo[player].upperLeftTile + row * SKYBOX_COLS + col;
const u8 *const texture =
(*(SkyboxTexture *) segmented_to_virtual(sSkyboxTextures[background]))[tileIndex];
@@ -265,7 +265,7 @@ void *create_skybox_ortho_matrix(s8 player) {
*/
Gfx *init_skybox_display_list(s8 player, s8 background, s8 colorIndex) {
s32 dlCommandCount = 5 + (3 * 3) * 7; // 5 for the start and end, plus 9 skybox tiles
void *skybox = alloc_display_list(dlCommandCount * sizeof(Gfx));
void *skybox = alloc_display_list(dlCommandCount * sizeof(Gfx) * sqr(SKYBOX_SIZE));
Gfx *dlist = skybox;
if (skybox == NULL) {
+2
View File
@@ -12,6 +12,8 @@
#define ABS(val) (((val) < 0 ? (-(val)) : (val)))
#define SQ(val) ((val) * (val))
#ifndef ALIGN
#define ALIGN(VAL_, ALIGNMENT_) (((VAL_) + ((ALIGNMENT_) - 1)) & ~((ALIGNMENT_) - 1))
#endif
#endif // GD_MACROS_H
+1 -1
View File
@@ -668,7 +668,7 @@ void func_80190574(s32 a0, struct ObjJoint *a1, struct ObjJoint *a2, f32 x, f32
UNUSED u32 pad268;
UNUSED u32 sp264 = 0;
UNUSED u32 sp258[3]; // unused vec?
struct GdVec3f sp24C;
struct GdVec3f sp24C = {0, 0, 0};
struct GdVec3f sp240;
UNUSED u32 pad238[2];
s32 sp234; // i?
+1 -1
View File
@@ -21,7 +21,7 @@
*/
// bss
static char sDefSettingsMenuStr[0x100];
UNUSED static char sDefSettingsMenuStr[0x100];
static struct GdVec3f sStaticVec;
UNUSED static struct GdVec3f unusedVec;
static struct ObjGadget *sCurGadgetPtr;
+3 -3
View File
@@ -153,7 +153,7 @@ static s32 sLightId;
static Hilite sHilites[600];
static struct GdVec3f D_801BD758;
static struct GdVec3f D_801BD768; // had to migrate earlier
static u32 D_801BD774;
UNUSED static u32 D_801BD774;
static struct GdObj *sMenuGadgets[9]; // @ 801BD778; d_obj ptr storage? menu?
static struct ObjView *sDebugViews[2]; // Seems to be a list of ObjViews for displaying debug info
static struct GdDisplayList *sStaticDl; // @ 801BD7A8
@@ -171,7 +171,7 @@ static LookAt D_801BE7D0[3];
static OSMesgQueue D_801BE830; // controller msg queue
static OSMesg D_801BE848[10];
UNUSED static u32 unref_801be870[16];
static OSMesgQueue D_801BE8B0;
UNUSED static OSMesgQueue D_801BE8B0;
static OSMesgQueue sGdDMAQueue; // @ 801BE8C8
UNUSED static u32 unref_801be8e0[25];
static OSMesg sGdMesgBuf[1]; // @ 801BE944
@@ -205,7 +205,7 @@ static s32 D_801A86BC = 1;
static s32 D_801A86C0 = 0; // gd_dl id for something?
UNUSED static u32 unref_801a86C4 = 10;
static s32 sMtxParamType = G_MTX_PROJECTION;
static struct GdVec3f D_801A86CC = { 1.0f, 1.0f, 1.0f };
UNUSED static struct GdVec3f D_801A86CC = { 1.0f, 1.0f, 1.0f };
static struct ObjView *sActiveView = NULL; // @ 801A86D8 current view? used when drawing dl
static struct ObjView *sScreenView = NULL; // @ 801A86DC
static struct ObjView *D_801A86E0 = NULL;
File diff suppressed because it is too large. Load diff
+35 -2
View File
@@ -20,6 +20,7 @@
#include "star_select.h"
#include "text_strings.h"
#include "prevent_bss_reordering.h"
#include "game/game_init.h"
/**
* @file star_select.c
@@ -52,7 +53,8 @@ static s8 sSelectableStarIndex = 0;
// Act Selector menu timer that keeps counting until you choose an act.
static s32 sActSelectorMenuTimer = 0;
#ifdef WIDE
#endif
/**
* Act Selector Star Type Loop Action
* Defines a select type for a star in the act selector.
@@ -92,8 +94,20 @@ void bhv_act_selector_star_type_loop(void) {
void render_100_coin_star(u8 stars) {
if (stars & (1 << 6)) {
// If the 100 coin star has been collected, create a new star selector next to the coin score.
#ifdef WIDE
if (gWidescreen){
sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
bhvActSelectorStarType, ((370*4.0f)/3), 24, -300, 0, 0, 0);
}
else{
sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
bhvActSelectorStarType, 370, 24, -300, 0, 0, 0);
}
#else
sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
bhvActSelectorStarType, 370, 24, -300, 0, 0, 0);
#endif
sStarSelectorModels[6]->oStarSelectorSize = 0.8;
sStarSelectorModels[6]->oStarSelectorType = STAR_SELECTOR_100_COINS;
}
@@ -147,12 +161,31 @@ void bhv_act_selector_init(void) {
}
// Render star selector objects
#ifdef WIDE
if (gWidescreen) {
for (i = 0; i < sVisibleStars; i++) {
sStarSelectorModels[i] =
spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
(((75 + sVisibleStars * -75 + i * 152)*4.0f)/3), 248, -300, 0, 0, 0);
sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
}
}
else {
for (i = 0; i < sVisibleStars; i++) {
sStarSelectorModels[i] =
spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
75 + sVisibleStars * -75 + i * 152, 248, -300, 0, 0, 0);
sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
}
}
#else
for (i = 0; i < sVisibleStars; i++) {
sStarSelectorModels[i] =
spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
75 + sVisibleStars * -75 + i * 152, 248, -300, 0, 0, 0);
75 + sVisibleStars * -75 + i * 152, 248, -300, 0, 0, 0);
sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
}
#endif
render_100_coin_star(stars);
}
+1 -1
View File
@@ -229,7 +229,7 @@ s32 intro_play_its_a_me_mario(void) {
* Returns a level ID after their criteria is met.
*/
s32 lvl_intro_update(s16 arg, UNUSED s32 unusedArg) {
s32 retVar;
s32 retVar = 0;
switch (arg) {
case LVL_INTRO_PLAY_ITS_A_ME_MARIO:
+2
View File
@@ -0,0 +1,2 @@
build/*
+45
View File
@@ -0,0 +1,45 @@
# Makefile for s2d_engine.a
TARGET = libs2d_engine.a
default: all
BUILD_DIR ?= build
DUMMY != mkdir -p $(BUILD_DIR)
C_FILES = $(wildcard ./*.c)
O_FILES = $(foreach file,$(C_FILES),$(BUILD_DIR)/$(file:.c=.o))
CROSS := mips-linux-gnu-
CC = $(CROSS)gcc
AR = $(CROSS)ar
INCLUDE_BASE := ../../
I_DIRS = src include/n64/PR include/n64 include/libc include .
FULL_I_DIRS = $(addprefix $(INCLUDE_BASE),$(I_DIRS))
I_FLAGS = $(foreach i,$(FULL_I_DIRS),-I$(i))
TARGET_CFLAGS = -nostdinc -I include/libc -DTARGET_N64 -DF3DEX_GBI_2 -DNON_MATCHING -DAVOID_UB
CFLAGS := -Wall $(TARGET_CFLAGS) $(I_FLAGS) -fno-stack-protector -march=vr4300 -mtune=vr4300 -mfix4300 -mabi=32 -mno-shared -G 0 -fno-PIC -mno-abicalls -fno-zero-initialized-in-bss -fno-toplevel-reorder -Wno-missing-braces
all: $(BUILD_DIR)/$(TARGET)
clean:
rm -r build/
COPY_DIR := none
ifneq ($(MAKECMDGOALS),clean)
ifeq ($(COPY_DIR),none)
$(error S2DEX Text Engine: No COPY_DIR defined!)
endif
endif
$(BUILD_DIR)/$(TARGET): $(O_FILES)
$(AR) rcs -o $@ $(O_FILES)
cp $@ $(COPY_DIR)
$(BUILD_DIR)/%.o: %.c
$(CC) -c $(CFLAGS) -o $@ $<
print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true
+54
View File
@@ -0,0 +1,54 @@
# S2DEX Text Engine
## How to "Install"
- Clone this repo into a folder in your SM64 decomp or homebrew repo
- Include that folder in your makefile's `SRC_DIRS`
- Add that folder to the linker script (`sm64.ld`) or specfile
- Wherever you're including your font (I use actors/group0.c for SM64), insert:
```c
#include "src/s2d_engine/config.h"
#include FONT_C_FILE
```
- You're ready to use S2DEX Text Engine!
## Simple Usage (Sample Program)
```c
#include "s2d_engine/init.h"
#include "s2d_engine/s2d_draw.h"
#include "s2d_engine/s2d_print.h"
char myString[] = "This is a " SCALE "200" "test string!\n"
"Supports a bunch of standard " ROTATE "-36" "escape characters!\n"
"\tIncluding " COLOR "255 0 0 0" "Colorful text!\n"
COLOR "255 255 255 0" DROPSHADOW "And look at these shadows!";
// ...
void render_game(void) {
// do game rendering and stuff
// ...
// initialized S2DEX; only needed once before all prints
s2d_init();
// Allows you to print from anywhere in the game
// as long as this is run directly afterwards
s2d_handle_deferred();
// reloads the original microcode; only needed once after all prints
s2d_stop();
}
void some_actor_function(void) {
s2d_print_deferred(50, 50, myString); // It's that easy!
}
```
## Command Usage
(All numbers must be in base 10)
- `SCALE "N"` - Scales text by an percentage (`25` for 25%, `200` for 200%, `-50` for upside down at 50%, etc.)
- `TRANSLATE "X Y"` - Moves the rest of the string to the specified X and Y position
- `COLOR "R G B A"` - Sets the text color to the specified value
- `DROPSHADOW` - Toggles a drop shadow that shares the color of the current text
- `ROTATE "N"` - (Deprecated due to plugin incompatibility) Rotates each glyph by N degrees (Can be negative, useful for italics)
+98
View File
@@ -0,0 +1,98 @@
#include <ultra64.h>
#ifndef S2D_CONFIG_H
#define S2D_CONFIG_H
/**
* SET YOUR FONT NAME HERE
*/
#ifndef FONTNAME
#define FONTNAME impact
#endif
/***********
* Helpful defines to change
***********/
#define BASE_SCALE 1.0f
/******************************
*
* ONLY CHANGE THE BELOW CONTENTS IF YOU'RE DEVELOPING
* FOR A GAME THAT ISN'T SM64
*
*****************************/
// magic macros and font header inclusion
#define GLUE(a, b) a##b
#define GLUE2(a, b) GLUE(a, b)
#define STR(x) #x
#define STR2(x) STR(x)
#define __headername(hd) fonts/hd.h
#define __fontinclude(f) src/s2d_engine/fonts/f.c
#define _FONT_HEADER STR2(__headername(FONTNAME))
#define FONT_C_FILE STR2(__fontinclude(FONTNAME))
#include _FONT_HEADER
// get your font symbols defined here
#define s2d_font GLUE2(FONTNAME, _obj)
#define s2d_dropshadow GLUE2(FONTNAME, _obj_dropshadow)
#define s2d_tex GLUE2(FONTNAME, _tex)
#define s2d_kerning_table GLUE2(FONTNAME, _kerning_table)
extern char s2d_kerning_table[];
// Debug: bypass custom matrix setup
#define s2d_mat GLUE2(FONTNAME, _mtx)
// Homebrew users: use this to rename your gdl head
#define gdl_head gDisplayListHead
extern Gfx *gdl_head;
#include "src/game/game_init.h"
#define CONTROLLER_INPUT gPlayer1Controller->buttonPressed
#define CONTROLLER_HELD_INPUT gPlayer1Controller->buttonDown
// Other games/Homebrew users: change these values
// an allocator function of the format void *alloc(size_t bytes)
#define alloc alloc_display_list
extern void *alloc(size_t);
// your init functions for the RDP/RSP
#define my_rdp_init my_rdp_init
#define my_rsp_init my_rsp_init
extern void my_rsp_init(void);
extern void my_rdp_init(void);
// The frame timer that is used to time s2d_type_print
#define s2d_timer gGlobalTimer
extern u32 s2d_timer;
// The equivalent vsprintf in your game (defaults to libultra _Printf)
#define vsprintf(dst, str, fmt, args) _Printf(proutSprintf, dst, fmt, args)
extern char *proutSprintf(char *dst, const char *src, size_t count);
// tab glyph width and height
#define TAB_WIDTH_H TEX_WIDTH * 2
#define TAB_WIDTH_V TEX_WIDTH / 2
// Set these to optimize s2d texture "cache"
#define TEX_WIDTH 16
#define TEX_HEIGHT 16
#define TEX_BITDEPTH 8
#define seg2virt segmented_to_virtual
#define IS_RUNNING_ON_EMULATOR (IO_READ(DPC_PIPEBUSY_REG) == 0)
// Texture resolution (pixels on the texture per pixel on the framebuffer)
#define TEX_RES 1
#define _NUM_CACHE (4096 / (TEX_WIDTH * TEX_HEIGHT * (TEX_BITDEPTH / 8)))
#endif
+15
View File
@@ -0,0 +1,15 @@
#ifndef DEBUG_H
#define DEBUG_H
// #define init_cond (CONTROLLER_HELD_INPUT & R_CBUTTONS)
// #define tex_cond (CONTROLLER_HELD_INPUT & D_CBUTTONS)
// #define mtx_cond (CONTROLLER_HELD_INPUT & L_TRIG)
// #define spr_cond (CONTROLLER_HELD_INPUT & U_JPAD)
// #define deinit_cond (CONTROLLER_HELD_INPUT & U_CBUTTONS)
#define tex_cond (1)
#define mtx_cond (1)
#define spr_cond (1)
#define init_cond (1)
#define deinit_cond (1)
#endif
+92
View File
@@ -0,0 +1,92 @@
#include "config.h"
#include <ultra64.h>
#include "mtx.h"
#include "debug.h"
#include "s2d_draw.h"
#define s(sprite) ((uObjSprite *)seg2virt(&sprite))
#define t(texture) ((uObjTxtr *)seg2virt(&texture))
void f3d_rdp_init(void) {
gDPPipeSync(gdl_head++);
gDPSetCycleType(gdl_head++, G_CYC_1CYCLE);
gDPSetRenderMode(gdl_head++, G_RM_XLU_SPRITE, G_RM_XLU_SPRITE2);
gDPSetTextureLUT(gdl_head++, G_TT_NONE);
gDPSetTexturePersp(gdl_head++, G_TP_NONE);
gDPSetCombineLERP(gdl_head++,
0, 0, 0, ENVIRONMENT,
0, 0, 0, TEXEL0,
0, 0, 0, ENVIRONMENT,
0, 0, 0, TEXEL0
);
}
void setup_f3d_texture(int idx) {
gDPPipeSync(gdl_head++);
gDPSetEnvColor(gdl_head++, s2d_red, s2d_green, s2d_blue, s2d_alpha);
gDPLoadTextureBlock(
gdl_head++,
t(s2d_tex[idx])->block.image,
s(s2d_font)->s.imageFmt,
G_IM_SIZ_8b,
s(s2d_font)->s.imageW >> 5,
s(s2d_font)->s.imageH >> 5,
s(s2d_font)->s.imagePal,
G_TX_WRAP,
G_TX_WRAP,
G_TX_NOMASK,
G_TX_NOMASK,
G_TX_NOLOD,
G_TX_NOLOD);
gDPLoadSync(gdl_head++);
}
#define CLAMP_0(x) ((x < 0) ? 0 : x)
void texrect(int x, int y, float scale) {
#define qs510(n) ((s16)((n)*0x0400))
gSPScisTextureRectangle (
gdl_head++,
x << 2,
y << 2,
(u32)(x + ((f32) ((s(s2d_font)->s.imageW >> 5) - 1) * scale)) << 2,
(u32)(y + ((f32) ((s(s2d_font)->s.imageH >> 5) - 1) * scale)) << 2,
G_TX_RENDERTILE,
0,
0,
qs510(1.0f / myScale), qs510(1.0f / myScale));
}
void draw_f3d_dropshadow(char c, int x, int y, uObjMtx *ds) {
setup_f3d_texture(c);
if (s2d_red != 0
&& s2d_green != 0
&& s2d_blue != 0
) {
gDPPipeSync(gdl_head++);
gDPSetEnvColor(gdl_head++,
CLAMP_0(s2d_red - 100),
CLAMP_0(s2d_green - 100),
CLAMP_0(s2d_blue - 100),
s2d_alpha);
texrect(x, y, myScale);
gDPPipeSync(gdl_head++);
gDPSetEnvColor(gdl_head++, s2d_red, s2d_green, s2d_blue, s2d_alpha);
}
}
void draw_f3d_glyph(char c, int x, int y, uObjMtx *mt) {
setup_f3d_texture(c);
texrect(x, y, myScale);
gDPPipeSync(gdl_head++);
}
#undef s
#undef t
+32
View File
@@ -0,0 +1,32 @@
#include <ultra64.h>
// jk i dont think this file is needed lol
// update: it was needed :(
// update 2: gu.h already has macros for this :(
// hopefully I'll only need s15.16
// ^ clueless
// Q to float
// To convert a number from Qm.n format to floating point:
// Convert the number to floating point as if it were an integer, in other words remove the binary point
// Multiply by 2^−n
f32 qtof(int q, int decimal_n) {
f32 mul = (1.0f / (float) (1 << decimal_n));
return ((float)q) * mul;
}
// Float to Q
// To convert a number from floating point to Qm.n format:
// Multiply the floating point number by 2^n
// Round to the nearest integer
int ftoq(f32 f, int decimal_n) {
f *= (float) (1 << decimal_n);
return (int)f;
}
+5
View File
@@ -0,0 +1,5 @@
#include <ultra64.h>
extern f32 qtof(int q);
extern int ftoq(f32 f);
File diff suppressed because it is too large. Load diff
+136
View File
@@ -0,0 +1,136 @@
#include <PR/ultratypes.h>
#include <PR/gs2dex.h>
extern uObjTxtr comicsans_tex[];
extern uObjMtx comicsans_mtx;
extern uObjSprite comicsans_obj;
extern void call_comicsans_sprite_dl(int idx, int x, int y, uObjMtx *buffer, int buf_idx);
extern u8 comicsans_tex_0[];
extern u8 comicsans_tex_1[];
extern u8 comicsans_tex_2[];
extern u8 comicsans_tex_3[];
extern u8 comicsans_tex_4[];
extern u8 comicsans_tex_5[];
extern u8 comicsans_tex_6[];
extern u8 comicsans_tex_7[];
extern u8 comicsans_tex_8[];
extern u8 comicsans_tex_9[];
extern u8 comicsans_tex_10[];
extern u8 comicsans_tex_11[];
extern u8 comicsans_tex_12[];
extern u8 comicsans_tex_13[];
extern u8 comicsans_tex_14[];
extern u8 comicsans_tex_15[];
extern u8 comicsans_tex_16[];
extern u8 comicsans_tex_17[];
extern u8 comicsans_tex_18[];
extern u8 comicsans_tex_19[];
extern u8 comicsans_tex_20[];
extern u8 comicsans_tex_21[];
extern u8 comicsans_tex_22[];
extern u8 comicsans_tex_23[];
extern u8 comicsans_tex_24[];
extern u8 comicsans_tex_25[];
extern u8 comicsans_tex_26[];
extern u8 comicsans_tex_27[];
extern u8 comicsans_tex_28[];
extern u8 comicsans_tex_29[];
extern u8 comicsans_tex_30[];
extern u8 comicsans_tex_31[];
extern u8 comicsans_tex_32[];
extern u8 comicsans_tex_33[];
extern u8 comicsans_tex_34[];
extern u8 comicsans_tex_35[];
extern u8 comicsans_tex_36[];
extern u8 comicsans_tex_37[];
extern u8 comicsans_tex_38[];
extern u8 comicsans_tex_39[];
extern u8 comicsans_tex_40[];
extern u8 comicsans_tex_41[];
extern u8 comicsans_tex_42[];
extern u8 comicsans_tex_43[];
extern u8 comicsans_tex_44[];
extern u8 comicsans_tex_45[];
extern u8 comicsans_tex_46[];
extern u8 comicsans_tex_47[];
extern u8 comicsans_tex_48[];
extern u8 comicsans_tex_49[];
extern u8 comicsans_tex_50[];
extern u8 comicsans_tex_51[];
extern u8 comicsans_tex_52[];
extern u8 comicsans_tex_53[];
extern u8 comicsans_tex_54[];
extern u8 comicsans_tex_55[];
extern u8 comicsans_tex_56[];
extern u8 comicsans_tex_57[];
extern u8 comicsans_tex_58[];
extern u8 comicsans_tex_59[];
extern u8 comicsans_tex_60[];
extern u8 comicsans_tex_61[];
extern u8 comicsans_tex_62[];
extern u8 comicsans_tex_63[];
extern u8 comicsans_tex_64[];
extern u8 comicsans_tex_65[];
extern u8 comicsans_tex_66[];
extern u8 comicsans_tex_67[];
extern u8 comicsans_tex_68[];
extern u8 comicsans_tex_69[];
extern u8 comicsans_tex_70[];
extern u8 comicsans_tex_71[];
extern u8 comicsans_tex_72[];
extern u8 comicsans_tex_73[];
extern u8 comicsans_tex_74[];
extern u8 comicsans_tex_75[];
extern u8 comicsans_tex_76[];
extern u8 comicsans_tex_77[];
extern u8 comicsans_tex_78[];
extern u8 comicsans_tex_79[];
extern u8 comicsans_tex_80[];
extern u8 comicsans_tex_81[];
extern u8 comicsans_tex_82[];
extern u8 comicsans_tex_83[];
extern u8 comicsans_tex_84[];
extern u8 comicsans_tex_85[];
extern u8 comicsans_tex_86[];
extern u8 comicsans_tex_87[];
extern u8 comicsans_tex_88[];
extern u8 comicsans_tex_89[];
extern u8 comicsans_tex_90[];
extern u8 comicsans_tex_91[];
extern u8 comicsans_tex_92[];
extern u8 comicsans_tex_93[];
extern u8 comicsans_tex_94[];
extern u8 comicsans_tex_95[];
extern u8 comicsans_tex_96[];
extern u8 comicsans_tex_97[];
extern u8 comicsans_tex_98[];
extern u8 comicsans_tex_99[];
extern u8 comicsans_tex_100[];
extern u8 comicsans_tex_101[];
extern u8 comicsans_tex_102[];
extern u8 comicsans_tex_103[];
extern u8 comicsans_tex_104[];
extern u8 comicsans_tex_105[];
extern u8 comicsans_tex_106[];
extern u8 comicsans_tex_107[];
extern u8 comicsans_tex_108[];
extern u8 comicsans_tex_109[];
extern u8 comicsans_tex_110[];
extern u8 comicsans_tex_111[];
extern u8 comicsans_tex_112[];
extern u8 comicsans_tex_113[];
extern u8 comicsans_tex_114[];
extern u8 comicsans_tex_115[];
extern u8 comicsans_tex_116[];
extern u8 comicsans_tex_117[];
extern u8 comicsans_tex_118[];
extern u8 comicsans_tex_119[];
extern u8 comicsans_tex_120[];
extern u8 comicsans_tex_121[];
extern u8 comicsans_tex_122[];
extern u8 comicsans_tex_123[];
extern u8 comicsans_tex_124[];
extern u8 comicsans_tex_125[];
extern u8 comicsans_tex_126[];
extern u8 comicsans_tex_127[];
extern uObjSprite comicsans_obj_dropshadow;
File diff suppressed because it is too large. Load diff
+136
View File
@@ -0,0 +1,136 @@
#include <PR/ultratypes.h>
#include <PR/gs2dex.h>
extern uObjTxtr delfino_tex[];
extern uObjMtx delfino_mtx;
extern uObjSprite delfino_obj;
extern void call_delfino_sprite_dl(int idx, int x, int y, uObjMtx *buffer, int buf_idx);
extern u8 delfino_tex_0[];
extern u8 delfino_tex_1[];
extern u8 delfino_tex_2[];
extern u8 delfino_tex_3[];
extern u8 delfino_tex_4[];
extern u8 delfino_tex_5[];
extern u8 delfino_tex_6[];
extern u8 delfino_tex_7[];
extern u8 delfino_tex_8[];
extern u8 delfino_tex_9[];
extern u8 delfino_tex_10[];
extern u8 delfino_tex_11[];
extern u8 delfino_tex_12[];
extern u8 delfino_tex_13[];
extern u8 delfino_tex_14[];
extern u8 delfino_tex_15[];
extern u8 delfino_tex_16[];
extern u8 delfino_tex_17[];
extern u8 delfino_tex_18[];
extern u8 delfino_tex_19[];
extern u8 delfino_tex_20[];
extern u8 delfino_tex_21[];
extern u8 delfino_tex_22[];
extern u8 delfino_tex_23[];
extern u8 delfino_tex_24[];
extern u8 delfino_tex_25[];
extern u8 delfino_tex_26[];
extern u8 delfino_tex_27[];
extern u8 delfino_tex_28[];
extern u8 delfino_tex_29[];
extern u8 delfino_tex_30[];
extern u8 delfino_tex_31[];
extern u8 delfino_tex_32[];
extern u8 delfino_tex_33[];
extern u8 delfino_tex_34[];
extern u8 delfino_tex_35[];
extern u8 delfino_tex_36[];
extern u8 delfino_tex_37[];
extern u8 delfino_tex_38[];
extern u8 delfino_tex_39[];
extern u8 delfino_tex_40[];
extern u8 delfino_tex_41[];
extern u8 delfino_tex_42[];
extern u8 delfino_tex_43[];
extern u8 delfino_tex_44[];
extern u8 delfino_tex_45[];
extern u8 delfino_tex_46[];
extern u8 delfino_tex_47[];
extern u8 delfino_tex_48[];
extern u8 delfino_tex_49[];
extern u8 delfino_tex_50[];
extern u8 delfino_tex_51[];
extern u8 delfino_tex_52[];
extern u8 delfino_tex_53[];
extern u8 delfino_tex_54[];
extern u8 delfino_tex_55[];
extern u8 delfino_tex_56[];
extern u8 delfino_tex_57[];
extern u8 delfino_tex_58[];
extern u8 delfino_tex_59[];
extern u8 delfino_tex_60[];
extern u8 delfino_tex_61[];
extern u8 delfino_tex_62[];
extern u8 delfino_tex_63[];
extern u8 delfino_tex_64[];
extern u8 delfino_tex_65[];
extern u8 delfino_tex_66[];
extern u8 delfino_tex_67[];
extern u8 delfino_tex_68[];
extern u8 delfino_tex_69[];
extern u8 delfino_tex_70[];
extern u8 delfino_tex_71[];
extern u8 delfino_tex_72[];
extern u8 delfino_tex_73[];
extern u8 delfino_tex_74[];
extern u8 delfino_tex_75[];
extern u8 delfino_tex_76[];
extern u8 delfino_tex_77[];
extern u8 delfino_tex_78[];
extern u8 delfino_tex_79[];
extern u8 delfino_tex_80[];
extern u8 delfino_tex_81[];
extern u8 delfino_tex_82[];
extern u8 delfino_tex_83[];
extern u8 delfino_tex_84[];
extern u8 delfino_tex_85[];
extern u8 delfino_tex_86[];
extern u8 delfino_tex_87[];
extern u8 delfino_tex_88[];
extern u8 delfino_tex_89[];
extern u8 delfino_tex_90[];
extern u8 delfino_tex_91[];
extern u8 delfino_tex_92[];
extern u8 delfino_tex_93[];
extern u8 delfino_tex_94[];
extern u8 delfino_tex_95[];
extern u8 delfino_tex_96[];
extern u8 delfino_tex_97[];
extern u8 delfino_tex_98[];
extern u8 delfino_tex_99[];
extern u8 delfino_tex_100[];
extern u8 delfino_tex_101[];
extern u8 delfino_tex_102[];
extern u8 delfino_tex_103[];
extern u8 delfino_tex_104[];
extern u8 delfino_tex_105[];
extern u8 delfino_tex_106[];
extern u8 delfino_tex_107[];
extern u8 delfino_tex_108[];
extern u8 delfino_tex_109[];
extern u8 delfino_tex_110[];
extern u8 delfino_tex_111[];
extern u8 delfino_tex_112[];
extern u8 delfino_tex_113[];
extern u8 delfino_tex_114[];
extern u8 delfino_tex_115[];
extern u8 delfino_tex_116[];
extern u8 delfino_tex_117[];
extern u8 delfino_tex_118[];
extern u8 delfino_tex_119[];
extern u8 delfino_tex_120[];
extern u8 delfino_tex_121[];
extern u8 delfino_tex_122[];
extern u8 delfino_tex_123[];
extern u8 delfino_tex_124[];
extern u8 delfino_tex_125[];
extern u8 delfino_tex_126[];
extern u8 delfino_tex_127[];
extern uObjSprite delfino_obj_dropshadow;
File diff suppressed because it is too large. Load diff
+136
View File
@@ -0,0 +1,136 @@
#include <PR/ultratypes.h>
#include <PR/gs2dex.h>
extern uObjTxtr impact_tex[];
extern uObjMtx impact_mtx;
extern uObjSprite impact_obj;
extern void call_impact_sprite_dl(int idx, int x, int y, uObjMtx *buffer, int buf_idx);
extern u8 impact_tex_0[];
extern u8 impact_tex_1[];
extern u8 impact_tex_2[];
extern u8 impact_tex_3[];
extern u8 impact_tex_4[];
extern u8 impact_tex_5[];
extern u8 impact_tex_6[];
extern u8 impact_tex_7[];
extern u8 impact_tex_8[];
extern u8 impact_tex_9[];
extern u8 impact_tex_10[];
extern u8 impact_tex_11[];
extern u8 impact_tex_12[];
extern u8 impact_tex_13[];
extern u8 impact_tex_14[];
extern u8 impact_tex_15[];
extern u8 impact_tex_16[];
extern u8 impact_tex_17[];
extern u8 impact_tex_18[];
extern u8 impact_tex_19[];
extern u8 impact_tex_20[];
extern u8 impact_tex_21[];
extern u8 impact_tex_22[];
extern u8 impact_tex_23[];
extern u8 impact_tex_24[];
extern u8 impact_tex_25[];
extern u8 impact_tex_26[];
extern u8 impact_tex_27[];
extern u8 impact_tex_28[];
extern u8 impact_tex_29[];
extern u8 impact_tex_30[];
extern u8 impact_tex_31[];
extern u8 impact_tex_32[];
extern u8 impact_tex_33[];
extern u8 impact_tex_34[];
extern u8 impact_tex_35[];
extern u8 impact_tex_36[];
extern u8 impact_tex_37[];
extern u8 impact_tex_38[];
extern u8 impact_tex_39[];
extern u8 impact_tex_40[];
extern u8 impact_tex_41[];
extern u8 impact_tex_42[];
extern u8 impact_tex_43[];
extern u8 impact_tex_44[];
extern u8 impact_tex_45[];
extern u8 impact_tex_46[];
extern u8 impact_tex_47[];
extern u8 impact_tex_48[];
extern u8 impact_tex_49[];
extern u8 impact_tex_50[];
extern u8 impact_tex_51[];
extern u8 impact_tex_52[];
extern u8 impact_tex_53[];
extern u8 impact_tex_54[];
extern u8 impact_tex_55[];
extern u8 impact_tex_56[];
extern u8 impact_tex_57[];
extern u8 impact_tex_58[];
extern u8 impact_tex_59[];
extern u8 impact_tex_60[];
extern u8 impact_tex_61[];
extern u8 impact_tex_62[];
extern u8 impact_tex_63[];
extern u8 impact_tex_64[];
extern u8 impact_tex_65[];
extern u8 impact_tex_66[];
extern u8 impact_tex_67[];
extern u8 impact_tex_68[];
extern u8 impact_tex_69[];
extern u8 impact_tex_70[];
extern u8 impact_tex_71[];
extern u8 impact_tex_72[];
extern u8 impact_tex_73[];
extern u8 impact_tex_74[];
extern u8 impact_tex_75[];
extern u8 impact_tex_76[];
extern u8 impact_tex_77[];
extern u8 impact_tex_78[];
extern u8 impact_tex_79[];
extern u8 impact_tex_80[];
extern u8 impact_tex_81[];
extern u8 impact_tex_82[];
extern u8 impact_tex_83[];
extern u8 impact_tex_84[];
extern u8 impact_tex_85[];
extern u8 impact_tex_86[];
extern u8 impact_tex_87[];
extern u8 impact_tex_88[];
extern u8 impact_tex_89[];
extern u8 impact_tex_90[];
extern u8 impact_tex_91[];
extern u8 impact_tex_92[];
extern u8 impact_tex_93[];
extern u8 impact_tex_94[];
extern u8 impact_tex_95[];
extern u8 impact_tex_96[];
extern u8 impact_tex_97[];
extern u8 impact_tex_98[];
extern u8 impact_tex_99[];
extern u8 impact_tex_100[];
extern u8 impact_tex_101[];
extern u8 impact_tex_102[];
extern u8 impact_tex_103[];
extern u8 impact_tex_104[];
extern u8 impact_tex_105[];
extern u8 impact_tex_106[];
extern u8 impact_tex_107[];
extern u8 impact_tex_108[];
extern u8 impact_tex_109[];
extern u8 impact_tex_110[];
extern u8 impact_tex_111[];
extern u8 impact_tex_112[];
extern u8 impact_tex_113[];
extern u8 impact_tex_114[];
extern u8 impact_tex_115[];
extern u8 impact_tex_116[];
extern u8 impact_tex_117[];
extern u8 impact_tex_118[];
extern u8 impact_tex_119[];
extern u8 impact_tex_120[];
extern u8 impact_tex_121[];
extern u8 impact_tex_122[];
extern u8 impact_tex_123[];
extern u8 impact_tex_124[];
extern u8 impact_tex_125[];
extern u8 impact_tex_126[];
extern u8 impact_tex_127[];
extern uObjSprite impact_obj_dropshadow;
File diff suppressed because it is too large. Load diff
+136
View File
@@ -0,0 +1,136 @@
#include <PR/ultratypes.h>
#include <PR/gs2dex.h>
extern uObjTxtr papyrus_tex[];
extern uObjMtx papyrus_mtx;
extern uObjSprite papyrus_obj;
extern void call_papyrus_sprite_dl(int idx, int x, int y, uObjMtx *buffer, int buf_idx);
extern u8 papyrus_tex_0[];
extern u8 papyrus_tex_1[];
extern u8 papyrus_tex_2[];
extern u8 papyrus_tex_3[];
extern u8 papyrus_tex_4[];
extern u8 papyrus_tex_5[];
extern u8 papyrus_tex_6[];
extern u8 papyrus_tex_7[];
extern u8 papyrus_tex_8[];
extern u8 papyrus_tex_9[];
extern u8 papyrus_tex_10[];
extern u8 papyrus_tex_11[];
extern u8 papyrus_tex_12[];
extern u8 papyrus_tex_13[];
extern u8 papyrus_tex_14[];
extern u8 papyrus_tex_15[];
extern u8 papyrus_tex_16[];
extern u8 papyrus_tex_17[];
extern u8 papyrus_tex_18[];
extern u8 papyrus_tex_19[];
extern u8 papyrus_tex_20[];
extern u8 papyrus_tex_21[];
extern u8 papyrus_tex_22[];
extern u8 papyrus_tex_23[];
extern u8 papyrus_tex_24[];
extern u8 papyrus_tex_25[];
extern u8 papyrus_tex_26[];
extern u8 papyrus_tex_27[];
extern u8 papyrus_tex_28[];
extern u8 papyrus_tex_29[];
extern u8 papyrus_tex_30[];
extern u8 papyrus_tex_31[];
extern u8 papyrus_tex_32[];
extern u8 papyrus_tex_33[];
extern u8 papyrus_tex_34[];
extern u8 papyrus_tex_35[];
extern u8 papyrus_tex_36[];
extern u8 papyrus_tex_37[];
extern u8 papyrus_tex_38[];
extern u8 papyrus_tex_39[];
extern u8 papyrus_tex_40[];
extern u8 papyrus_tex_41[];
extern u8 papyrus_tex_42[];
extern u8 papyrus_tex_43[];
extern u8 papyrus_tex_44[];
extern u8 papyrus_tex_45[];
extern u8 papyrus_tex_46[];
extern u8 papyrus_tex_47[];
extern u8 papyrus_tex_48[];
extern u8 papyrus_tex_49[];
extern u8 papyrus_tex_50[];
extern u8 papyrus_tex_51[];
extern u8 papyrus_tex_52[];
extern u8 papyrus_tex_53[];
extern u8 papyrus_tex_54[];
extern u8 papyrus_tex_55[];
extern u8 papyrus_tex_56[];
extern u8 papyrus_tex_57[];
extern u8 papyrus_tex_58[];
extern u8 papyrus_tex_59[];
extern u8 papyrus_tex_60[];
extern u8 papyrus_tex_61[];
extern u8 papyrus_tex_62[];
extern u8 papyrus_tex_63[];
extern u8 papyrus_tex_64[];
extern u8 papyrus_tex_65[];
extern u8 papyrus_tex_66[];
extern u8 papyrus_tex_67[];
extern u8 papyrus_tex_68[];
extern u8 papyrus_tex_69[];
extern u8 papyrus_tex_70[];
extern u8 papyrus_tex_71[];
extern u8 papyrus_tex_72[];
extern u8 papyrus_tex_73[];
extern u8 papyrus_tex_74[];
extern u8 papyrus_tex_75[];
extern u8 papyrus_tex_76[];
extern u8 papyrus_tex_77[];
extern u8 papyrus_tex_78[];
extern u8 papyrus_tex_79[];
extern u8 papyrus_tex_80[];
extern u8 papyrus_tex_81[];
extern u8 papyrus_tex_82[];
extern u8 papyrus_tex_83[];
extern u8 papyrus_tex_84[];
extern u8 papyrus_tex_85[];
extern u8 papyrus_tex_86[];
extern u8 papyrus_tex_87[];
extern u8 papyrus_tex_88[];
extern u8 papyrus_tex_89[];
extern u8 papyrus_tex_90[];
extern u8 papyrus_tex_91[];
extern u8 papyrus_tex_92[];
extern u8 papyrus_tex_93[];
extern u8 papyrus_tex_94[];
extern u8 papyrus_tex_95[];
extern u8 papyrus_tex_96[];
extern u8 papyrus_tex_97[];
extern u8 papyrus_tex_98[];
extern u8 papyrus_tex_99[];
extern u8 papyrus_tex_100[];
extern u8 papyrus_tex_101[];
extern u8 papyrus_tex_102[];
extern u8 papyrus_tex_103[];
extern u8 papyrus_tex_104[];
extern u8 papyrus_tex_105[];
extern u8 papyrus_tex_106[];
extern u8 papyrus_tex_107[];
extern u8 papyrus_tex_108[];
extern u8 papyrus_tex_109[];
extern u8 papyrus_tex_110[];
extern u8 papyrus_tex_111[];
extern u8 papyrus_tex_112[];
extern u8 papyrus_tex_113[];
extern u8 papyrus_tex_114[];
extern u8 papyrus_tex_115[];
extern u8 papyrus_tex_116[];
extern u8 papyrus_tex_117[];
extern u8 papyrus_tex_118[];
extern u8 papyrus_tex_119[];
extern u8 papyrus_tex_120[];
extern u8 papyrus_tex_121[];
extern u8 papyrus_tex_122[];
extern u8 papyrus_tex_123[];
extern u8 papyrus_tex_124[];
extern u8 papyrus_tex_125[];
extern u8 papyrus_tex_126[];
extern u8 papyrus_tex_127[];
extern uObjSprite papyrus_obj_dropshadow;
File diff suppressed because it is too large. Load diff
+136
View File
@@ -0,0 +1,136 @@
#include <PR/ultratypes.h>
#include <PR/gs2dex.h>
extern uObjTxtr timesnewroman_tex[];
extern uObjMtx timesnewroman_mtx;
extern uObjSprite timesnewroman_obj;
extern void call_timesnewroman_sprite_dl(int idx, int x, int y, uObjMtx *buffer, int buf_idx);
extern u8 timesnewroman_tex_0[];
extern u8 timesnewroman_tex_1[];
extern u8 timesnewroman_tex_2[];
extern u8 timesnewroman_tex_3[];
extern u8 timesnewroman_tex_4[];
extern u8 timesnewroman_tex_5[];
extern u8 timesnewroman_tex_6[];
extern u8 timesnewroman_tex_7[];
extern u8 timesnewroman_tex_8[];
extern u8 timesnewroman_tex_9[];
extern u8 timesnewroman_tex_10[];
extern u8 timesnewroman_tex_11[];
extern u8 timesnewroman_tex_12[];
extern u8 timesnewroman_tex_13[];
extern u8 timesnewroman_tex_14[];
extern u8 timesnewroman_tex_15[];
extern u8 timesnewroman_tex_16[];
extern u8 timesnewroman_tex_17[];
extern u8 timesnewroman_tex_18[];
extern u8 timesnewroman_tex_19[];
extern u8 timesnewroman_tex_20[];
extern u8 timesnewroman_tex_21[];
extern u8 timesnewroman_tex_22[];
extern u8 timesnewroman_tex_23[];
extern u8 timesnewroman_tex_24[];
extern u8 timesnewroman_tex_25[];
extern u8 timesnewroman_tex_26[];
extern u8 timesnewroman_tex_27[];
extern u8 timesnewroman_tex_28[];
extern u8 timesnewroman_tex_29[];
extern u8 timesnewroman_tex_30[];
extern u8 timesnewroman_tex_31[];
extern u8 timesnewroman_tex_32[];
extern u8 timesnewroman_tex_33[];
extern u8 timesnewroman_tex_34[];
extern u8 timesnewroman_tex_35[];
extern u8 timesnewroman_tex_36[];
extern u8 timesnewroman_tex_37[];
extern u8 timesnewroman_tex_38[];
extern u8 timesnewroman_tex_39[];
extern u8 timesnewroman_tex_40[];
extern u8 timesnewroman_tex_41[];
extern u8 timesnewroman_tex_42[];
extern u8 timesnewroman_tex_43[];
extern u8 timesnewroman_tex_44[];
extern u8 timesnewroman_tex_45[];
extern u8 timesnewroman_tex_46[];
extern u8 timesnewroman_tex_47[];
extern u8 timesnewroman_tex_48[];
extern u8 timesnewroman_tex_49[];
extern u8 timesnewroman_tex_50[];
extern u8 timesnewroman_tex_51[];
extern u8 timesnewroman_tex_52[];
extern u8 timesnewroman_tex_53[];
extern u8 timesnewroman_tex_54[];
extern u8 timesnewroman_tex_55[];
extern u8 timesnewroman_tex_56[];
extern u8 timesnewroman_tex_57[];
extern u8 timesnewroman_tex_58[];
extern u8 timesnewroman_tex_59[];
extern u8 timesnewroman_tex_60[];
extern u8 timesnewroman_tex_61[];
extern u8 timesnewroman_tex_62[];
extern u8 timesnewroman_tex_63[];
extern u8 timesnewroman_tex_64[];
extern u8 timesnewroman_tex_65[];
extern u8 timesnewroman_tex_66[];
extern u8 timesnewroman_tex_67[];
extern u8 timesnewroman_tex_68[];
extern u8 timesnewroman_tex_69[];
extern u8 timesnewroman_tex_70[];
extern u8 timesnewroman_tex_71[];
extern u8 timesnewroman_tex_72[];
extern u8 timesnewroman_tex_73[];
extern u8 timesnewroman_tex_74[];
extern u8 timesnewroman_tex_75[];
extern u8 timesnewroman_tex_76[];
extern u8 timesnewroman_tex_77[];
extern u8 timesnewroman_tex_78[];
extern u8 timesnewroman_tex_79[];
extern u8 timesnewroman_tex_80[];
extern u8 timesnewroman_tex_81[];
extern u8 timesnewroman_tex_82[];
extern u8 timesnewroman_tex_83[];
extern u8 timesnewroman_tex_84[];
extern u8 timesnewroman_tex_85[];
extern u8 timesnewroman_tex_86[];
extern u8 timesnewroman_tex_87[];
extern u8 timesnewroman_tex_88[];
extern u8 timesnewroman_tex_89[];
extern u8 timesnewroman_tex_90[];
extern u8 timesnewroman_tex_91[];
extern u8 timesnewroman_tex_92[];
extern u8 timesnewroman_tex_93[];
extern u8 timesnewroman_tex_94[];
extern u8 timesnewroman_tex_95[];
extern u8 timesnewroman_tex_96[];
extern u8 timesnewroman_tex_97[];
extern u8 timesnewroman_tex_98[];
extern u8 timesnewroman_tex_99[];
extern u8 timesnewroman_tex_100[];
extern u8 timesnewroman_tex_101[];
extern u8 timesnewroman_tex_102[];
extern u8 timesnewroman_tex_103[];
extern u8 timesnewroman_tex_104[];
extern u8 timesnewroman_tex_105[];
extern u8 timesnewroman_tex_106[];
extern u8 timesnewroman_tex_107[];
extern u8 timesnewroman_tex_108[];
extern u8 timesnewroman_tex_109[];
extern u8 timesnewroman_tex_110[];
extern u8 timesnewroman_tex_111[];
extern u8 timesnewroman_tex_112[];
extern u8 timesnewroman_tex_113[];
extern u8 timesnewroman_tex_114[];
extern u8 timesnewroman_tex_115[];
extern u8 timesnewroman_tex_116[];
extern u8 timesnewroman_tex_117[];
extern u8 timesnewroman_tex_118[];
extern u8 timesnewroman_tex_119[];
extern u8 timesnewroman_tex_120[];
extern u8 timesnewroman_tex_121[];
extern u8 timesnewroman_tex_122[];
extern u8 timesnewroman_tex_123[];
extern u8 timesnewroman_tex_124[];
extern u8 timesnewroman_tex_125[];
extern u8 timesnewroman_tex_126[];
extern u8 timesnewroman_tex_127[];
extern uObjSprite timesnewroman_obj_dropshadow;
File diff suppressed because it is too large. Load diff
+136
View File
@@ -0,0 +1,136 @@
#include <PR/ultratypes.h>
#include <PR/gs2dex.h>
extern uObjTxtr ubuntu_tex[];
extern uObjMtx ubuntu_mtx;
extern uObjSprite ubuntu_obj;
extern void call_ubuntu_sprite_dl(int idx, int x, int y, uObjMtx *buffer, int buf_idx);
extern u8 ubuntu_tex_0[];
extern u8 ubuntu_tex_1[];
extern u8 ubuntu_tex_2[];
extern u8 ubuntu_tex_3[];
extern u8 ubuntu_tex_4[];
extern u8 ubuntu_tex_5[];
extern u8 ubuntu_tex_6[];
extern u8 ubuntu_tex_7[];
extern u8 ubuntu_tex_8[];
extern u8 ubuntu_tex_9[];
extern u8 ubuntu_tex_10[];
extern u8 ubuntu_tex_11[];
extern u8 ubuntu_tex_12[];
extern u8 ubuntu_tex_13[];
extern u8 ubuntu_tex_14[];
extern u8 ubuntu_tex_15[];
extern u8 ubuntu_tex_16[];
extern u8 ubuntu_tex_17[];
extern u8 ubuntu_tex_18[];
extern u8 ubuntu_tex_19[];
extern u8 ubuntu_tex_20[];
extern u8 ubuntu_tex_21[];
extern u8 ubuntu_tex_22[];
extern u8 ubuntu_tex_23[];
extern u8 ubuntu_tex_24[];
extern u8 ubuntu_tex_25[];
extern u8 ubuntu_tex_26[];
extern u8 ubuntu_tex_27[];
extern u8 ubuntu_tex_28[];
extern u8 ubuntu_tex_29[];
extern u8 ubuntu_tex_30[];
extern u8 ubuntu_tex_31[];
extern u8 ubuntu_tex_32[];
extern u8 ubuntu_tex_33[];
extern u8 ubuntu_tex_34[];
extern u8 ubuntu_tex_35[];
extern u8 ubuntu_tex_36[];
extern u8 ubuntu_tex_37[];
extern u8 ubuntu_tex_38[];
extern u8 ubuntu_tex_39[];
extern u8 ubuntu_tex_40[];
extern u8 ubuntu_tex_41[];
extern u8 ubuntu_tex_42[];
extern u8 ubuntu_tex_43[];
extern u8 ubuntu_tex_44[];
extern u8 ubuntu_tex_45[];
extern u8 ubuntu_tex_46[];
extern u8 ubuntu_tex_47[];
extern u8 ubuntu_tex_48[];
extern u8 ubuntu_tex_49[];
extern u8 ubuntu_tex_50[];
extern u8 ubuntu_tex_51[];
extern u8 ubuntu_tex_52[];
extern u8 ubuntu_tex_53[];
extern u8 ubuntu_tex_54[];
extern u8 ubuntu_tex_55[];
extern u8 ubuntu_tex_56[];
extern u8 ubuntu_tex_57[];
extern u8 ubuntu_tex_58[];
extern u8 ubuntu_tex_59[];
extern u8 ubuntu_tex_60[];
extern u8 ubuntu_tex_61[];
extern u8 ubuntu_tex_62[];
extern u8 ubuntu_tex_63[];
extern u8 ubuntu_tex_64[];
extern u8 ubuntu_tex_65[];
extern u8 ubuntu_tex_66[];
extern u8 ubuntu_tex_67[];
extern u8 ubuntu_tex_68[];
extern u8 ubuntu_tex_69[];
extern u8 ubuntu_tex_70[];
extern u8 ubuntu_tex_71[];
extern u8 ubuntu_tex_72[];
extern u8 ubuntu_tex_73[];
extern u8 ubuntu_tex_74[];
extern u8 ubuntu_tex_75[];
extern u8 ubuntu_tex_76[];
extern u8 ubuntu_tex_77[];
extern u8 ubuntu_tex_78[];
extern u8 ubuntu_tex_79[];
extern u8 ubuntu_tex_80[];
extern u8 ubuntu_tex_81[];
extern u8 ubuntu_tex_82[];
extern u8 ubuntu_tex_83[];
extern u8 ubuntu_tex_84[];
extern u8 ubuntu_tex_85[];
extern u8 ubuntu_tex_86[];
extern u8 ubuntu_tex_87[];
extern u8 ubuntu_tex_88[];
extern u8 ubuntu_tex_89[];
extern u8 ubuntu_tex_90[];
extern u8 ubuntu_tex_91[];
extern u8 ubuntu_tex_92[];
extern u8 ubuntu_tex_93[];
extern u8 ubuntu_tex_94[];
extern u8 ubuntu_tex_95[];
extern u8 ubuntu_tex_96[];
extern u8 ubuntu_tex_97[];
extern u8 ubuntu_tex_98[];
extern u8 ubuntu_tex_99[];
extern u8 ubuntu_tex_100[];
extern u8 ubuntu_tex_101[];
extern u8 ubuntu_tex_102[];
extern u8 ubuntu_tex_103[];
extern u8 ubuntu_tex_104[];
extern u8 ubuntu_tex_105[];
extern u8 ubuntu_tex_106[];
extern u8 ubuntu_tex_107[];
extern u8 ubuntu_tex_108[];
extern u8 ubuntu_tex_109[];
extern u8 ubuntu_tex_110[];
extern u8 ubuntu_tex_111[];
extern u8 ubuntu_tex_112[];
extern u8 ubuntu_tex_113[];
extern u8 ubuntu_tex_114[];
extern u8 ubuntu_tex_115[];
extern u8 ubuntu_tex_116[];
extern u8 ubuntu_tex_117[];
extern u8 ubuntu_tex_118[];
extern u8 ubuntu_tex_119[];
extern u8 ubuntu_tex_120[];
extern u8 ubuntu_tex_121[];
extern u8 ubuntu_tex_122[];
extern u8 ubuntu_tex_123[];
extern u8 ubuntu_tex_124[];
extern u8 ubuntu_tex_125[];
extern u8 ubuntu_tex_126[];
extern u8 ubuntu_tex_127[];
extern uObjSprite ubuntu_obj_dropshadow;
+24
View File
@@ -0,0 +1,24 @@
#include <ultra64.h>
#include <PR/gs2dex.h>
#include "config.h"
#include "init.h"
#include "debug.h"
#include "s2d_error.h"
void s2d_init(void) {
s2d_error_y = TEX_HEIGHT;
if (IS_RUNNING_ON_EMULATOR)
gSPLoadUcode(gdl_head++, s2d_text, s2d_data);
}
void s2d_stop(void) {
if (IS_RUNNING_ON_EMULATOR) {
gSPLoadUcode(gdl_head++, zex_text, zex_data);
if deinit_cond {
my_rdp_init();
my_rsp_init();
}
}
s2d_reset_defer_index();
}
+14
View File
@@ -0,0 +1,14 @@
#include <ultra64.h>
#include <PR/gs2dex.h>
#include "config.h"
#define s2d_text gspS2DEX2_fifoTextStart
#define s2d_data gspS2DEX2_fifoDataStart
#define zex_text gspF3DZEX2_PosLight_fifoTextStart
#define zex_data gspF3DZEX2_PosLight_fifoDataStart
extern void s2d_init(void);
extern void s2d_stop(void);
+95
View File
@@ -0,0 +1,95 @@
#include <ultra64.h>
#include <PR/gs2dex.h>
#include <PR/gu.h>
#include "config.h"
#define ftoq FTOFIX32
#define qtof FIX32TOF
#define qu510(n) ((u16)((n)*0x0400))
void mat2_dst_mul(uObjMtx *dst, uObjMtx *m1, uObjMtx *m2) {
dst->m.A = ftoq((qtof(m1->m.A) * qtof(m2->m.A)) + (qtof(m1->m.B) * qtof(m2->m.C)));
dst->m.B = ftoq((qtof(m1->m.A) * qtof(m2->m.B)) + (qtof(m1->m.B) * qtof(m2->m.D)));
dst->m.C = ftoq((qtof(m1->m.C) * qtof(m2->m.A)) + (qtof(m1->m.D) * qtof(m2->m.C)));
dst->m.D = ftoq((qtof(m1->m.C) * qtof(m2->m.B)) + (qtof(m1->m.D) * qtof(m2->m.D)));
}
void mat2_dst_add(uObjMtx *dst, uObjMtx *m1, uObjMtx *m2) {
dst->m.A = (m1->m.A + m2->m.A);
dst->m.B = (m1->m.B + m2->m.B);
dst->m.C = (m1->m.C + m2->m.C);
dst->m.D = (m1->m.D + m2->m.D);
}
void mat2_copy(uObjMtx *dst, uObjMtx *src) {
dst->m.A = src->m.A;
dst->m.B = src->m.B;
dst->m.C = src->m.C;
dst->m.D = src->m.D;
dst->m.X = src->m.X;
dst->m.Y = src->m.Y;
dst->m.BaseScaleX = src->m.BaseScaleX;
dst->m.BaseScaleY = src->m.BaseScaleY;
}
void mat2_ident(uObjMtx *dst, float scale) {
dst->m.A = FTOFIX32(scale);
dst->m.D = FTOFIX32(scale);
dst->m.B = 0;
dst->m.C = 0;
dst->m.X = 0;
dst->m.Y = 0;
dst->m.BaseScaleX = qu510(scale);
dst->m.BaseScaleY = qu510(scale);
}
// cos -sin sin cos
void mat2_rotate(uObjMtx *dst, f32 degrees) {
dst->m.A = ftoq(cosf(degrees));
dst->m.B = ftoq(sinf(degrees));
dst->m.C = ftoq(-sinf(degrees));
dst->m.D = ftoq(cosf(degrees));
}
void mat2_mul(uObjMtx *m1, uObjMtx *m2) {
mat2_dst_mul(m1, m1, m2);
}
void mat2_add(uObjMtx *m1, uObjMtx *m2) {
mat2_dst_mul(m1, m1, m2);
}
void mat2_scale(uObjMtx *dst, int scale) {
dst->m.A *= scale;
dst->m.D *= scale;
dst->m.BaseScaleX *= scale;
dst->m.BaseScaleY *= scale;
}
#define FTOFIX16(x) (long)((x) * (float)(1 << 2))
#define FIX16TOF(x) ((float)(x) * (1.0f / (float)(1 << 2)))
void mat2_translate(uObjMtx *m, int x, int y) {
m->m.X = x<<2;
m->m.Y = y<<2;
}
void mat2_translate_vec(uObjMtx *m, f32 degrees, f32 mag) {
m->m.X += FTOFIX16(mag * cosf(degrees));
m->m.Y += FTOFIX16(mag * sinf(degrees));
}
typedef float Mat4[4][4];
void gu_to_gs2dex(uObjMtx *m1, Mat4 m2) {
m1->m.A = m1->m.BaseScaleX = FTOFIX32(m2[0][0]);
m1->m.B = FTOFIX32(m2[0][1]);
m1->m.C = FTOFIX32(m2[1][0]);
m1->m.D = m1->m.BaseScaleY = FTOFIX32(m2[1][1]);
m1->m.X = FTOFIX16(m2[3][0]);
m1->m.Y = FTOFIX16(m2[3][1]);
}
+25
View File
@@ -0,0 +1,25 @@
#include <ultra64.h>
#include <PR/gs2dex.h>
#include <PR/gu.h>
// #include "stack.h"
typedef float Mat4[4][4];
extern void mat2_dst_mul(uObjMtx *dst, uObjMtx *m1, uObjMtx *m2);
extern void mat2_dst_add(uObjMtx *dst, uObjMtx *m1, uObjMtx *m2);
extern void mat2_ident(uObjMtx *dst, float scale);
extern void mat2_mul(uObjMtx *m1, uObjMtx *m2);
extern void mat2_add(uObjMtx *m1, uObjMtx *m2);
extern void mat2_scale(uObjMtx *dst, int scale);
extern void get_final_mat(uObjMtx *dst);
extern void mat2_translate(uObjMtx *m, int x, int y);
extern void mat2_rotate(uObjMtx *dst, f32 degrees);
extern void mat2_translate_vec(uObjMtx *m, f32 degrees, f32 mag);
+39
View File
@@ -0,0 +1,39 @@
#include "config.h"
#include "s2d_error.h"
#include "s2d_print.h"
#define S2D_BUFFERSIZE 100
struct s2d_pos {
int x;
int y;
};
static struct s2d_pos s2d_positions[S2D_BUFFERSIZE];
static char *s2d_charBuffer[S2D_BUFFERSIZE];
static int s2d_charBuffer_index = 0;
void s2d_reset_defer_index(void) {
s2d_charBuffer_index = 0;
}
// TODO: these DO NOT work
// pls debug :)
void s2d_print_deferred(int x, int y, const char *str) {
s2d_charBuffer[s2d_charBuffer_index] = str;
s2d_positions[s2d_charBuffer_index].x = x;
s2d_positions[s2d_charBuffer_index].y = y;
s2d_charBuffer_index++;
}
void s2d_handle_deferred(void) {
for (int i = 0; i < s2d_charBuffer_index; i++) {
s2d_print_alloc(
s2d_positions[i].x,
s2d_positions[i].y,
ALIGN_LEFT,
s2d_charBuffer[i]
);
}
}
Loaded 100 of 167 files, more files were not shown because too many files have changed in this diff. Show more