Refresh 11

This commit is contained in:
n64
2020-07-04 11:18:55 -04:00
parent 05c7d7031c
commit 9214dddabc
47 changed files with 489 additions and 290 deletions

11
CHANGES
View File

@@ -1,3 +1,14 @@
Refresh 11
1.) (HEAD -> master, origin/master, origin/HEAD) Make geo_process_level_of_detail endian-independent (#1049)
2.) Label oMoveFlags and slight cleanup. (#1046)
3.) Avoid UB in synthesis_resample_and_mix_reverb (#1048)
4.) Change some void * to correct type (#1047)
5.) Remove oPathedWaypointsS16 and convert all paths to Trajectory struct. (#1045)
6.) Mr Blizzard documentation, Tox Box Unks (#1042)
7.) Pipe input to textconv. (#1041)
8.) Remove erroneous long double casts from audiofile.cpp (#1039)
9.) Replace fixed dialogID in play_dialog_sound to DIALOG_COUNT (#1040)
Refresh #10.1
1.) Diff update (#1033)
2.) Fix texture dimensions for exclamation boxes (#1034)

View File

@@ -395,12 +395,10 @@ endif
endif
$(BUILD_DIR)/text/%/define_courses.inc.c: text/define_courses.inc.c text/%/courses.h
$(CPP) $(VERSION_CFLAGS) $< -o $@ -I text/$*/
$(TEXTCONV) charmap.txt $@ $@
$(CPP) $(VERSION_CFLAGS) $< -o - -I text/$*/ | $(TEXTCONV) charmap.txt - $@
$(BUILD_DIR)/text/%/define_text.inc.c: text/define_text.inc.c text/%/courses.h text/%/dialogs.h
$(CPP) $(VERSION_CFLAGS) $< -o $@ -I text/$*/
$(TEXTCONV) charmap.txt $@ $@
$(CPP) $(VERSION_CFLAGS) $< -o - -I text/$*/ | $(TEXTCONV) charmap.txt - $@
RSP_DIRS := $(BUILD_DIR)/rsp
ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(ASM_DIRS) $(GODDARD_SRC_DIRS) $(ULTRA_SRC_DIRS) $(ULTRA_ASM_DIRS) $(ULTRA_BIN_DIRS) $(BIN_DIRS) $(TEXTURE_DIRS) $(TEXT_DIRS) $(SOUND_SAMPLE_DIRS) $(addprefix levels/,$(LEVEL_DIRS)) include) $(MIO0_DIR) $(addprefix $(MIO0_DIR)/,$(VERSION)) $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/sequences/$(VERSION) $(RSP_DIRS)

View File

@@ -80,30 +80,22 @@
#define OBJ_MOVE_UNDERWATER_OFF_GROUND (1 << 5) // 0x0020
#define OBJ_MOVE_UNDERWATER_ON_GROUND (1 << 6) // 0x0040
#define OBJ_MOVE_IN_AIR (1 << 7) // 0x0080
#define OBJ_MOVE_8 (1 << 8) // 0x0100
#define OBJ_MOVE_OUT_SCOPE (1 << 8) // 0x0100
#define OBJ_MOVE_HIT_WALL (1 << 9) // 0x0200
#define OBJ_MOVE_HIT_EDGE (1 << 10) // 0x0400
#define OBJ_MOVE_ABOVE_LAVA (1 << 11) // 0x0800
#define OBJ_MOVE_LEAVING_WATER (1 << 12) // 0x1000
#define OBJ_MOVE_13 (1 << 13) // 0x2000
#define OBJ_MOVE_BOUNCE (1 << 13) // 0x2000
#ifndef VERSION_JP
#define OBJ_MOVE_ABOVE_DEATH_BARRIER (1 << 14) // 0x4000
#endif
#define OBJ_MOVE_MASK_ON_GROUND (OBJ_MOVE_LANDED | OBJ_MOVE_ON_GROUND)
#define OBJ_MOVE_MASK_33 0x33
#define OBJ_MOVE_MASK_IN_WATER (\
OBJ_MOVE_ENTERED_WATER |\
OBJ_MOVE_AT_WATER_SURFACE |\
OBJ_MOVE_UNDERWATER_OFF_GROUND |\
OBJ_MOVE_UNDERWATER_ON_GROUND)
#define OBJ_MOVE_MASK_HIT_WALL_OR_IN_WATER \
(OBJ_MOVE_HIT_WALL | OBJ_MOVE_MASK_IN_WATER)
#define OBJ_MOVE_MASK_NOT_AIR (\
OBJ_MOVE_LANDED |\
OBJ_MOVE_ON_GROUND |\
OBJ_MOVE_AT_WATER_SURFACE |\
OBJ_MOVE_UNDERWATER_ON_GROUND)
/* oActiveParticleFlags */
#define ACTIVE_PARTICLE_DUST (1 << 0) // 0x00000001
@@ -971,4 +963,18 @@
#define BOWSER_PUZZLE_ACT_WAIT_FOR_COMPLETE 1
#define BOWSER_PUZZLE_ACT_DONE 2
/* Mr Blizzard */
/* oAction */
#define MR_BLIZZARD_ACT_SPAWN_SNOWBALL 0
#define MR_BLIZZARD_ACT_HIDE_UNHIDE 1
#define MR_BLIZZARD_ACT_RISE_FROM_GROUND 2
#define MR_BLIZZARD_ACT_ROTATE 3
#define MR_BLIZZARD_ACT_THROW_SNOWBALL 4
#define MR_BLIZZARD_ACT_BURROW 5
#define MR_BLIZZARD_ACT_DEATH 6
#define MR_BLIZZARD_ACT_JUMP 7
/* oBehParams2ndByte */
#define MR_BLIZZARD_STYPE_NO_CAP 0
#define MR_BLIZZARD_STYPE_JUMPING 1
#endif // OBJECT_CONSTANTS_H

View File

@@ -136,8 +136,6 @@
#define /*0x1C4*/ oDeathSound OBJECT_FIELD_S32(0x4F)
/* Pathed (see obj_follow_path) */
// TODO: These two 0x0FC fields need merged, one is data and one is a C struct.
#define /*0x0FC*/ oPathedWaypointsS16 OBJECT_FIELD_VPTR(0x1D)
#define /*0x0FC*/ oPathedStartWaypoint OBJECT_FIELD_WAYPOINT(0x1D)
#define /*0x100*/ oPathedPrevWaypoint OBJECT_FIELD_WAYPOINT(0x1E)
#define /*0x104*/ oPathedPrevWaypointFlags OBJECT_FIELD_S32(0x1F)
@@ -966,8 +964,8 @@
#define /*0x110*/ oToadMessageState OBJECT_FIELD_S32(0x22)
/* Tox Box */
#define /*0x1AC*/ oToxBoxUnk1AC OBJECT_FIELD_VPTR(0x49)
#define /*0x1B0*/ oToxBoxUnk1B0 OBJECT_FIELD_S32(0x4A)
#define /*0x1AC*/ oToxBoxMovementPattern OBJECT_FIELD_VPTR(0x49)
#define /*0x1B0*/ oToxBoxMovementStep OBJECT_FIELD_S32(0x4A)
/* TTC Rotating Solid */
#define /*0x0F4*/ oTTCRotatingSolidNumTurns OBJECT_FIELD_S32(0x1B)

View File

@@ -131,7 +131,7 @@ struct GraphNodeObject
/*0x2C*/ Vec3f scale;
/*0x38*/ struct GraphNodeObject_sub unk38;
/*0x4C*/ struct SpawnInfo *unk4C;
/*0x50*/ void *throwMatrix; // matrix ptr
/*0x50*/ Mat4 *throwMatrix; // matrix ptr
/*0x54*/ Vec3f cameraToObject;
};

View File

@@ -2120,7 +2120,7 @@ void func_80320A4C(u8 bankIndex, u8 arg1) {
void play_dialog_sound(u8 dialogID) {
u8 speaker;
if (dialogID >= 170) {
if (dialogID >= DIALOG_COUNT) {
dialogID = 0;
}

View File

@@ -10,8 +10,8 @@
#define DMEM_ADDR_TEMP 0x0
#define DMEM_ADDR_UNCOMPRESSED_NOTE 0x180
#define DMEM_ADDR_ADPCM_RESAMPLED 0x20
#define DMEM_ADDR_ADPCM_RESAMPLED2 0x160
#define DMEM_ADDR_RESAMPLED 0x20
#define DMEM_ADDR_RESAMPLED2 0x160
#define DMEM_ADDR_NOTE_PAN_TEMP 0x200
#define DMEM_ADDR_STEREO_STRONG_TEMP_DRY 0x200
#define DMEM_ADDR_STEREO_STRONG_TEMP_WET 0x340
@@ -99,14 +99,14 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
// Touches both left and right since they are adjacent in memory
osInvalDCache(item->toDownsampleLeft, DEFAULT_LEN_2CH);
for (srcPos = 0, dstPos = 0; dstPos < item->lengths[0] / 2;
for (srcPos = 0, dstPos = 0; dstPos < item->lengthA / 2;
srcPos += reverb->downsampleRate, dstPos++) {
reverb->ringBuffer.left[item->startPos + dstPos] =
item->toDownsampleLeft[srcPos];
reverb->ringBuffer.right[item->startPos + dstPos] =
item->toDownsampleRight[srcPos];
}
for (dstPos = 0; dstPos < item->lengths[1] / 2; srcPos += reverb->downsampleRate, dstPos++) {
for (dstPos = 0; dstPos < item->lengthB / 2; srcPos += reverb->downsampleRate, dstPos++) {
reverb->ringBuffer.left[dstPos] = item->toDownsampleLeft[srcPos];
reverb->ringBuffer.right[dstPos] = item->toDownsampleRight[srcPos];
}
@@ -118,14 +118,14 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
excessiveSamples = (nSamples + reverb->nextRingBufferPos) - reverb->bufSizePerChannel;
if (excessiveSamples < 0) {
// There is space in the ring buffer before it wraps around
item->lengths[0] = nSamples * 2;
item->lengths[1] = 0;
item->lengthA = nSamples * 2;
item->lengthB = 0;
item->startPos = (s32) reverb->nextRingBufferPos;
reverb->nextRingBufferPos += nSamples;
} else {
// Ring buffer wrapped around
item->lengths[0] = (nSamples - excessiveSamples) * 2;
item->lengths[1] = excessiveSamples * 2;
item->lengthA = (nSamples - excessiveSamples) * 2;
item->lengthB = excessiveSamples * 2;
item->startPos = reverb->nextRingBufferPos;
reverb->nextRingBufferPos = excessiveSamples;
}
@@ -150,14 +150,14 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex) {
// Touches both left and right since they are adjacent in memory
osInvalDCache(item->toDownsampleLeft, DEFAULT_LEN_2CH);
for (srcPos = 0, dstPos = 0; dstPos < item->lengths[0] / 2;
for (srcPos = 0, dstPos = 0; dstPos < item->lengthA / 2;
srcPos += gReverbDownsampleRate, dstPos++) {
gSynthesisReverb.ringBuffer.left[dstPos + item->startPos] =
item->toDownsampleLeft[srcPos];
gSynthesisReverb.ringBuffer.right[dstPos + item->startPos] =
item->toDownsampleRight[srcPos];
}
for (dstPos = 0; dstPos < item->lengths[1] / 2; srcPos += gReverbDownsampleRate, dstPos++) {
for (dstPos = 0; dstPos < item->lengthB / 2; srcPos += gReverbDownsampleRate, dstPos++) {
gSynthesisReverb.ringBuffer.left[dstPos] = item->toDownsampleLeft[srcPos];
gSynthesisReverb.ringBuffer.right[dstPos] = item->toDownsampleRight[srcPos];
}
@@ -168,8 +168,8 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex) {
numSamplesAfterDownsampling = chunkLen / gReverbDownsampleRate;
if (((numSamplesAfterDownsampling + gSynthesisReverb.nextRingBufferPos) - gSynthesisReverb.bufSizePerChannel) < 0) {
// There is space in the ring buffer before it wraps around
item->lengths[0] = numSamplesAfterDownsampling * 2;
item->lengths[1] = 0;
item->lengthA = numSamplesAfterDownsampling * 2;
item->lengthB = 0;
item->startPos = (s32) gSynthesisReverb.nextRingBufferPos;
gSynthesisReverb.nextRingBufferPos += numSamplesAfterDownsampling;
} else {
@@ -177,8 +177,8 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex) {
excessiveSamples =
(numSamplesAfterDownsampling + gSynthesisReverb.nextRingBufferPos) - gSynthesisReverb.bufSizePerChannel;
nSamples = numSamplesAfterDownsampling - excessiveSamples;
item->lengths[0] = nSamples * 2;
item->lengths[1] = excessiveSamples * 2;
item->lengthA = nSamples * 2;
item->lengthB = excessiveSamples * 2;
item->startPos = gSynthesisReverb.nextRingBufferPos;
gSynthesisReverb.nextRingBufferPos = excessiveSamples;
}
@@ -348,33 +348,33 @@ u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
#ifdef VERSION_EU
u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s16 updateIndex) {
struct ReverbRingBufferItem *item;
s16 temp_t9; // sp5a
s16 sp58; // sp58
s16 startPad;
s16 paddedLengthA;
item = &gSynthesisReverbs[reverbIndex].items[gSynthesisReverbs[reverbIndex].curFrame][updateIndex];
aClearBuffer(cmd++, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH);
if (gSynthesisReverbs[reverbIndex].downsampleRate == 1) {
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengths[0], reverbIndex);
if (item->lengths[1] != 0) {
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH + item->lengths[0], 0, item->lengths[1], reverbIndex);
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengthA, reverbIndex);
if (item->lengthB != 0) {
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH + item->lengthA, 0, item->lengthB, reverbIndex);
}
aSetBuffer(cmd++, 0, 0, 0, DEFAULT_LEN_2CH);
aMix(cmd++, 0, 0x7fff, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH);
aMix(cmd++, 0, 0x8000 + gSynthesisReverbs[reverbIndex].reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH);
} else {
temp_t9 = (item->startPos % 8u) * 2;
sp58 = ALIGN(item->lengths[0] + (sp58=temp_t9), 4);
startPad = (item->startPos % 8u) * 2;
paddedLengthA = ALIGN(startPad + item->lengthA, 4);
cmd = synthesis_load_reverb_ring_buffer(cmd, 0x20, (item->startPos - temp_t9 / 2), DEFAULT_LEN_1CH, reverbIndex);
if (item->lengths[1] != 0) {
cmd = synthesis_load_reverb_ring_buffer(cmd, 0x20 + sp58, 0, DEFAULT_LEN_1CH - sp58, reverbIndex);
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED, (item->startPos - startPad / 2), DEFAULT_LEN_1CH, reverbIndex);
if (item->lengthB != 0) {
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED + paddedLengthA, 0, DEFAULT_LEN_1CH - paddedLengthA, reverbIndex);
}
aSetBuffer(cmd++, 0, temp_t9 + DMEM_ADDR_ADPCM_RESAMPLED, DMEM_ADDR_WET_LEFT_CH, bufLen * 2);
aSetBuffer(cmd++, 0, DMEM_ADDR_RESAMPLED + startPad, DMEM_ADDR_WET_LEFT_CH, bufLen * 2);
aResample(cmd++, gSynthesisReverbs[reverbIndex].resampleFlags, gSynthesisReverbs[reverbIndex].resampleRate, VIRTUAL_TO_PHYSICAL2(gSynthesisReverbs[reverbIndex].resampleStateLeft));
aSetBuffer(cmd++, 0, temp_t9 + DMEM_ADDR_ADPCM_RESAMPLED2, DMEM_ADDR_WET_RIGHT_CH, bufLen * 2);
aSetBuffer(cmd++, 0, DMEM_ADDR_RESAMPLED2 + startPad, DMEM_ADDR_WET_RIGHT_CH, bufLen * 2);
aResample(cmd++, gSynthesisReverbs[reverbIndex].resampleFlags, gSynthesisReverbs[reverbIndex].resampleRate, VIRTUAL_TO_PHYSICAL2(gSynthesisReverbs[reverbIndex].resampleStateRight));
aSetBuffer(cmd++, 0, 0, 0, DEFAULT_LEN_2CH);
@@ -396,10 +396,10 @@ u64 *synthesis_save_reverb_samples(u64 *cmdBuf, s16 reverbIndex, s16 updateIndex
}
if (reverb->downsampleRate == 1) {
// Put the oldest samples in the ring buffer into the wet channels
cmd = cmdBuf = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengths[0], reverbIndex);
if (item->lengths[1] != 0) {
cmd = cmdBuf = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengthA, reverbIndex);
if (item->lengthB != 0) {
// Ring buffer wrapped
cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH + item->lengths[0], 0, item->lengths[1], reverbIndex);
cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH + item->lengthA, 0, item->lengthB, reverbIndex);
cmdBuf = cmd;
}
} else {
@@ -512,9 +512,9 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateI
if (gReverbDownsampleRate == 1) {
// Put the oldest samples in the ring buffer into the wet channels
aSetLoadBufferPair(cmd++, 0, v1->startPos);
if (v1->lengths[1] != 0) {
if (v1->lengthB != 0) {
// Ring buffer wrapped
aSetLoadBufferPair(cmd++, v1->lengths[0], 0);
aSetLoadBufferPair(cmd++, v1->lengthA, 0);
temp = 0;
}
@@ -531,9 +531,9 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, u32 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->lengths[0] + t4, 4);
ra = ALIGN(v1->lengthA + t4, 4);
aSetLoadBufferPair(cmd++, 0, v1->startPos - t4 / 2);
if (v1->lengths[1] != 0) {
if (v1->lengthB != 0) {
// Ring buffer wrapped
aSetLoadBufferPair(cmd++, ra, 0);
//! We need an empty statement (even an empty ';') here to make the function match (because IDO).
@@ -552,10 +552,10 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateI
}
cmd = synthesis_process_notes(aiBuf, bufLen, cmd);
if (gReverbDownsampleRate == 1) {
aSetSaveBufferPair(cmd++, 0, v1->lengths[0], v1->startPos);
if (v1->lengths[1] != 0) {
aSetSaveBufferPair(cmd++, 0, v1->lengthA, v1->startPos);
if (v1->lengthB != 0) {
// Ring buffer wrapped
aSetSaveBufferPair(cmd++, v1->lengths[0], v1->lengths[1], 0);
aSetSaveBufferPair(cmd++, v1->lengthA, v1->lengthB, 0);
}
} else {
// Downsampling is done later by CPU when RSP is done, therefore we need to have double
@@ -966,26 +966,26 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) {
case 2:
switch (curPart) {
case 0:
aSetBuffer(cmd++, 0, DMEM_ADDR_UNCOMPRESSED_NOTE + sp130, DMEM_ADDR_ADPCM_RESAMPLED, samplesLenAdjusted + 4);
aSetBuffer(cmd++, 0, DMEM_ADDR_UNCOMPRESSED_NOTE + sp130, DMEM_ADDR_RESAMPLED, samplesLenAdjusted + 4);
#ifdef VERSION_EU
aResample(cmd++, A_INIT, 0xff60, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->dummyResampleState));
#else
aResample(cmd++, A_INIT, 0xff60, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->dummyResampleState));
#endif
resampledTempLen = samplesLenAdjusted + 4;
noteSamplesDmemAddrBeforeResampling = DMEM_ADDR_ADPCM_RESAMPLED + 4;
noteSamplesDmemAddrBeforeResampling = DMEM_ADDR_RESAMPLED + 4;
#ifdef VERSION_EU
if (noteSubEu->finished != FALSE) {
#else
if (note->finished != FALSE) {
#endif
aClearBuffer(cmd++, DMEM_ADDR_ADPCM_RESAMPLED + resampledTempLen, samplesLenAdjusted + 0x10);
aClearBuffer(cmd++, DMEM_ADDR_RESAMPLED + resampledTempLen, samplesLenAdjusted + 0x10);
}
break;
case 1:
aSetBuffer(cmd++, 0, DMEM_ADDR_UNCOMPRESSED_NOTE + sp130,
DMEM_ADDR_ADPCM_RESAMPLED2,
DMEM_ADDR_RESAMPLED2,
samplesLenAdjusted + 8);
#ifdef VERSION_EU
aResample(cmd++, A_INIT, 0xff60,
@@ -996,8 +996,8 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) {
VIRTUAL_TO_PHYSICAL2(
note->synthesisBuffers->dummyResampleState));
#endif
aDMEMMove(cmd++, DMEM_ADDR_ADPCM_RESAMPLED2 + 4,
DMEM_ADDR_ADPCM_RESAMPLED + resampledTempLen,
aDMEMMove(cmd++, DMEM_ADDR_RESAMPLED2 + 4,
DMEM_ADDR_RESAMPLED + resampledTempLen,
samplesLenAdjusted + 4);
break;
}

View File

@@ -19,7 +19,8 @@ struct ReverbRingBufferItem
s16 *toDownsampleLeft;
s16 *toDownsampleRight; // data pointed to by left and right are adjacent in memory
s32 startPos; // start pos in ring buffer
s16 lengths[2]; // first length in ring buffer (max until end) and second length in ring buffer (from pos 0)
s16 lengthA; // first length in ring buffer (from startPos, at most until end)
s16 lengthB; // second length in ring buffer (from pos 0)
}; // size = 0x14
struct SynthesisReverb

View File

@@ -116,7 +116,7 @@ struct GraphNodePerspective
*/
struct DisplayListNode
{
void *transform;
Mtx *transform;
void *displayList;
struct DisplayListNode *next;
};
@@ -184,7 +184,7 @@ struct GraphNodeCamera
} config;
/*0x1C*/ Vec3f pos;
/*0x28*/ Vec3f focus;
/*0x34*/ void *matrixPtr; // pointer to look-at matrix of this camera as a Mat4
/*0x34*/ Mat4 *matrixPtr; // pointer to look-at matrix of this camera as a Mat4
/*0x38*/ s16 roll; // roll in look at matrix. Doesn't account for light direction unlike rollScreen.
/*0x3A*/ s16 rollScreen; // rolls screen while keeping the light direction consistent
};

View File

@@ -19,6 +19,7 @@
#include "game_init.h"
#include "ingame_menu.h"
#include "interaction.h"
#include "level_misc_macros.h"
#include "level_table.h"
#include "level_update.h"
#include "levels/bob/header.h"
@@ -173,7 +174,7 @@ Gfx *geo_move_mario_part_from_parent(s32 run, UNUSED struct GraphNode *node, Mat
if (run == TRUE) {
sp1C = (struct Object *) gCurGraphNodeObject;
if (sp1C == gMarioObject && sp1C->prevObj != NULL) {
create_transformation_from_matrices(sp20, mtx, gCurGraphNodeCamera->matrixPtr);
create_transformation_from_matrices(sp20, mtx, *gCurGraphNodeCamera->matrixPtr);
obj_update_pos_from_parent_transformation(sp20, sp1C->prevObj);
obj_set_gfx_pos_from_pos(sp1C->prevObj);
}

View File

@@ -273,7 +273,7 @@ static s32 boo_update_during_death(void) {
o->oBooTargetOpacity = 0;
}
if (o->oTimer > 30 || o->oMoveFlags & 0x200) {
if (o->oTimer > 30 || o->oMoveFlags & OBJ_MOVE_HIT_WALL) {
spawn_mist_particles();
o->oBooDeathStatus = BOO_DEATH_STATUS_DEAD;

View File

@@ -9,7 +9,7 @@ void bhv_bouncing_fireball_flame_loop(void) {
o->oAnimState = random_float() * 10.0f;
o->oVelY = 30.0f;
}
if (o->oMoveFlags & 1)
if (o->oMoveFlags & OBJ_MOVE_LANDED)
o->oAction++;
break;
case 1:
@@ -17,7 +17,7 @@ void bhv_bouncing_fireball_flame_loop(void) {
o->oVelY = 50.0f;
o->oForwardVel = 30.0f;
}
if (o->oMoveFlags & (0x40 | 0x10 | 0x2) && o->oTimer > 100)
if (o->oMoveFlags & (OBJ_MOVE_UNDERWATER_ON_GROUND | OBJ_MOVE_AT_WATER_SURFACE | OBJ_MOVE_ON_GROUND) && o->oTimer > 100)
obj_mark_for_deletion(o);
break;
}

View File

@@ -12,19 +12,32 @@ static struct ObjectHitbox sBowlingBallHitbox = {
/* hurtboxHeight: */ 0,
};
// TODO: these are likely Waypoint structs
static s16 D_803315B4[] = { 0x0000, 0xED4E, 0x0065, 0xF78A, 0x0001, 0xEC78, 0x0051, 0xF53F, 0x0002,
0xEC50, 0x0021, 0xF0FA, 0x0003, 0xEC9A, 0x0026, 0xEC9A, 0x0004, 0xF053,
0xFEFD, 0xECE3, 0x0005, 0xF5F3, 0xFC05, 0xED54, 0x0006, 0xFBE3, 0xFA89,
0xED3A, 0x0007, 0x02F8, 0xF99B, 0xED1F, 0x0008, 0x0B32, 0xF801, 0xECEA,
0x0009, 0x0D3A, 0xE66E, 0xED1F, 0xFFFF, 0x0000 };
static Trajectory sThiHugeMetalBallTraj[] = {
TRAJECTORY_POS(0, /*pos*/ -4786, 101, -2166),
TRAJECTORY_POS(1, /*pos*/ -5000, 81, -2753),
TRAJECTORY_POS(2, /*pos*/ -5040, 33, -3846),
TRAJECTORY_POS(3, /*pos*/ -4966, 38, -4966),
TRAJECTORY_POS(4, /*pos*/ -4013, -259, -4893),
TRAJECTORY_POS(5, /*pos*/ -2573, -1019, -4780),
TRAJECTORY_POS(6, /*pos*/ -1053, -1399, -4806),
TRAJECTORY_POS(7, /*pos*/ 760, -1637, -4833),
TRAJECTORY_POS(8, /*pos*/ 2866, -2047, -4886),
TRAJECTORY_POS(9, /*pos*/ 3386, -6546, -4833),
TRAJECTORY_END(),
};
// TODO: these are likely Waypoint structs
static s16 D_80331608[] = { 0x0000, 0xFA3C, 0x001D, 0xFD58, 0x0001, 0xFA2C, 0x000E, 0xFBD0,
0x0002, 0xFA24, 0x0003, 0xFACD, 0x0003, 0xFAA2, 0xFFEF, 0xFA09,
0x0004, 0xFB66, 0xFFAD, 0xFA28, 0x0005, 0xFEDC, 0xFE58, 0xFA6F,
0x0006, 0x00FA, 0xFE15, 0xFA67, 0x0007, 0x035E, 0xFD9B, 0xFA57,
0x0008, 0x0422, 0xF858, 0xFA57, 0xFFFF, 0x0000 };
static Trajectory sThiTinyMetalBallTraj[] = {
TRAJECTORY_POS(0, /*pos*/ -1476, 29, -680),
TRAJECTORY_POS(1, /*pos*/ -1492, 14, -1072),
TRAJECTORY_POS(2, /*pos*/ -1500, 3, -1331),
TRAJECTORY_POS(3, /*pos*/ -1374, -17, -1527),
TRAJECTORY_POS(4, /*pos*/ -1178, -83, -1496),
TRAJECTORY_POS(5, /*pos*/ -292, -424, -1425),
TRAJECTORY_POS(6, /*pos*/ 250, -491, -1433),
TRAJECTORY_POS(7, /*pos*/ 862, -613, -1449),
TRAJECTORY_POS(8, /*pos*/ 1058, -1960, -1449),
TRAJECTORY_END(),
};
void bhv_bowling_ball_init(void) {
o->oGravity = 5.5f;
@@ -42,23 +55,23 @@ void bowling_ball_set_hitbox(void) {
void bowling_ball_set_waypoints(void) {
switch (o->oBehParams2ndByte) {
case BBALL_BP_STYPE_BOB_UPPER:
o->oPathedWaypointsS16 = segmented_to_virtual(bob_seg7_metal_ball_path0);
o->oPathedStartWaypoint = segmented_to_virtual(bob_seg7_metal_ball_path0);
break;
case BBALL_BP_STYPE_TTM:
o->oPathedWaypointsS16 = segmented_to_virtual(ttm_seg7_trajectory_070170A0);
o->oPathedStartWaypoint = segmented_to_virtual(ttm_seg7_trajectory_070170A0);
break;
case BBALL_BP_STYPE_BOB_LOWER:
o->oPathedWaypointsS16 = segmented_to_virtual(bob_seg7_metal_ball_path1);
o->oPathedStartWaypoint = segmented_to_virtual(bob_seg7_metal_ball_path1);
break;
case BBALL_BP_STYPE_THI_LARGE:
o->oPathedWaypointsS16 = D_803315B4;
o->oPathedStartWaypoint = (struct Waypoint *) sThiHugeMetalBallTraj;
break;
case BBALL_BP_STYPE_THI_SMALL:
o->oPathedWaypointsS16 = D_80331608;
o->oPathedStartWaypoint = (struct Waypoint *) sThiTinyMetalBallTraj;
break;
}
}

View File

@@ -106,7 +106,7 @@ s32 bowser_spawn_shockwave(void) {
}
void bowser_bounce(s32 *a) {
if (o->oMoveFlags & 1) {
if (o->oMoveFlags & OBJ_MOVE_LANDED) {
a[0]++;
if (a[0] < 4) {
cur_obj_start_cam_event(o, CAM_EVENT_BOWSER_THROW_BOUNCE);
@@ -453,7 +453,7 @@ s32 bowser_set_anim_in_air(void) {
}
s32 bowser_land(void) {
if (o->oMoveFlags & 1) {
if (o->oMoveFlags & OBJ_MOVE_LANDED) {
o->oForwardVel = 0;
o->oVelY = 0;
spawn_mist_particles_variable(0, 0, 60.0f);
@@ -627,7 +627,7 @@ void bowser_act_charge_mario(void) {
cur_obj_extend_animation_if_at_end();
break;
}
if (o->oMoveFlags & 0x400)
if (o->oMoveFlags & OBJ_MOVE_HIT_EDGE)
o->oAction = 10;
}
@@ -650,7 +650,7 @@ void bowser_act_thrown_dropped(void)
if (o->oSubAction == 0) {
cur_obj_init_animation_with_sound(2);
bowser_bounce(&o->oBowserUnkF8);
if (o->oMoveFlags & 2) {
if (o->oMoveFlags & OBJ_MOVE_ON_GROUND) {
o->oForwardVel = 0.0f;
o->oSubAction++;
}
@@ -780,9 +780,9 @@ void bowser_fly_back_dead(void) {
void bowser_dead_bounce(void) {
o->oBowserEyesShut = 1;
bowser_bounce(&o->oBowserUnkF8);
if (o->oMoveFlags & 1)
if (o->oMoveFlags & OBJ_MOVE_LANDED)
cur_obj_play_sound_2(SOUND_OBJ_BOWSER_WALK);
if (o->oMoveFlags & 2) {
if (o->oMoveFlags & OBJ_MOVE_ON_GROUND) {
o->oForwardVel = 0.0f;
o->oSubAction++;
}
@@ -962,7 +962,7 @@ s32 bowser_check_fallen_off_stage(void) // bowser off stage?
if (o->oAction != 2 && o->oAction != 19) {
if (o->oPosY < o->oHomeY - 1000.0f)
return 1;
if (o->oMoveFlags & 1) {
if (o->oMoveFlags & OBJ_MOVE_LANDED) {
if (o->oFloorType == 1)
return 1;
if (o->oFloorType == 10)
@@ -1168,7 +1168,7 @@ Gfx *geo_update_body_rot_from_parent(s32 run, UNUSED struct GraphNode *node, Mat
if (run == TRUE) {
sp1C = (struct Object *) gCurGraphNodeObject;
if (sp1C->prevObj != NULL) {
create_transformation_from_matrices(sp20, mtx, gCurGraphNodeCamera->matrixPtr);
create_transformation_from_matrices(sp20, mtx, *gCurGraphNodeCamera->matrixPtr);
obj_update_pos_from_parent_transformation(sp20, sp1C->prevObj);
obj_set_gfx_pos_from_pos(sp1C->prevObj);
}
@@ -1424,7 +1424,7 @@ void bhv_flame_bowser_loop(void) {
if (o->oAction == 0) {
cur_obj_become_intangible();
bowser_flame_move();
if (o->oMoveFlags & 1) {
if (o->oMoveFlags & OBJ_MOVE_LANDED) {
o->oAction++;
if (cur_obj_has_behavior(bhvFlameLargeBurningOut))
o->oFlameUnkF4 = 8.0f;
@@ -1494,7 +1494,7 @@ void bhv_flame_floating_landing_loop(void) {
obj_mark_for_deletion(o);
if (o->oVelY < D_8032F748[o->oBehParams2ndByte])
o->oVelY = D_8032F748[o->oBehParams2ndByte];
if (o->oMoveFlags & 1) {
if (o->oMoveFlags & OBJ_MOVE_LANDED) {
if (o->oBehParams2ndByte == 0)
spawn_object(o, MODEL_RED_FLAME, bhvFlameLargeBurningOut);
else

View File

@@ -33,7 +33,7 @@ void bubba_act_0(void) {
o->oBubbaUnkF8 = random_linear_offset(20, 30);
}
if ((o->oBubbaUnkFC = o->oMoveFlags & 0x00000200) != 0) {
if ((o->oBubbaUnkFC = o->oMoveFlags & OBJ_MOVE_HIT_WALL) != 0) {
o->oBubbaUnk1AE = cur_obj_reflect_move_angle_off_wall();
} else if (o->oTimer > 30 && o->oDistanceToMario < 2000.0f) {
o->oAction = 1;
@@ -130,8 +130,8 @@ void bhv_bubba_loop(void) {
break;
}
if (o->oMoveFlags & 0x00000078) {
if (o->oMoveFlags & 0x00000008) {
if (o->oMoveFlags & OBJ_MOVE_MASK_IN_WATER) {
if (o->oMoveFlags & OBJ_MOVE_ENTERED_WATER) {
sp38 = spawn_object(o, MODEL_WATER_SPLASH, bhvWaterSplash);
if (sp38 != NULL) {
obj_scale(sp38, 3.0f);

View File

@@ -45,7 +45,7 @@ void bullet_bill_act_2(void) {
cur_obj_play_sound_2(SOUND_OBJ_POUNDING_CANNON);
cur_obj_shake_screen(SHAKE_POS_SMALL);
}
if (o->oTimer > 150 || o->oMoveFlags & 0x200) {
if (o->oTimer > 150 || o->oMoveFlags & OBJ_MOVE_HIT_WALL) {
o->oAction = 3;
spawn_mist_particles();
}

View File

@@ -168,7 +168,7 @@ void chuckya_act_3(void) {
}
void chuckya_act_2(void) {
if (o->oMoveFlags & (0x200 | 0x40 | 0x20 | 0x10 | 0x8 | 0x1)) {
if (o->oMoveFlags & (OBJ_MOVE_HIT_WALL | OBJ_MOVE_MASK_IN_WATER | OBJ_MOVE_LANDED)) {
obj_mark_for_deletion(o);
obj_spawn_loot_yellow_coins(o, 5, 20.0f);
spawn_mist_particles_with_sound(SOUND_OBJ_CHUCKYA_DEATH);

View File

@@ -93,13 +93,13 @@ void bhv_coin_loop(void) {
obj_mark_for_deletion(o);
}
#ifndef VERSION_JP
if (o->oMoveFlags & OBJ_MOVE_13) {
if (o->oMoveFlags & OBJ_MOVE_BOUNCE) {
if (o->oCoinUnk1B0 < 5)
cur_obj_play_sound_2(0x30364081);
o->oCoinUnk1B0++;
}
#else
if (o->oMoveFlags & OBJ_MOVE_13)
if (o->oMoveFlags & OBJ_MOVE_BOUNCE)
cur_obj_play_sound_2(SOUND_GENERAL_COIN_DROP);
#endif
if (cur_obj_wait_then_blink(400, 20))
@@ -208,7 +208,7 @@ void bhv_coin_formation_loop(void) {
void coin_inside_boo_act_1(void) {
cur_obj_update_floor_and_walls();
cur_obj_if_hit_wall_bounce_away();
if (o->oMoveFlags & OBJ_MOVE_13)
if (o->oMoveFlags & OBJ_MOVE_BOUNCE)
cur_obj_play_sound_2(SOUND_GENERAL_COIN_DROP);
if (o->oTimer > 90 || (o->oMoveFlags & OBJ_MOVE_LANDED)) {
obj_set_hitbox(o, &sYellowCoinHitbox);

View File

@@ -41,7 +41,7 @@ void bhv_donut_platform_spawner_update(void) {
}
void bhv_donut_platform_update(void) {
if (o->oTimer != 0 && ((o->oMoveFlags & 0x00000003) || o->oDistanceToMario > 2500.0f)) {
if (o->oTimer != 0 && ((o->oMoveFlags & OBJ_MOVE_MASK_ON_GROUND) || o->oDistanceToMario > 2500.0f)) {
o->parentObj->oDonutPlatformSpawnerSpawnedPlatforms =
o->parentObj->oDonutPlatformSpawnerSpawnedPlatforms
& ((1 << o->oBehParams2ndByte) ^ 0xFFFFFFFF);

View File

@@ -292,7 +292,7 @@ static void eyerok_hand_act_show_eye(void) {
if (o->parentObj->oEyerokBossNumHands != 2) {
obj_face_yaw_approach(o->oMoveAngleYaw, 0x800);
if (o->oTimer > 10
&& (o->oPosZ - gMarioObject->oPosZ > 0.0f || (o->oMoveFlags & 0x00000400))) {
&& (o->oPosZ - gMarioObject->oPosZ > 0.0f || (o->oMoveFlags & OBJ_MOVE_HIT_EDGE))) {
o->parentObj->oEyerokBossActiveHand = 0;
o->oForwardVel = 0.0f;
}
@@ -321,7 +321,7 @@ static void eyerok_hand_act_attacked(void) {
o->collisionData = segmented_to_virtual(ssl_seg7_collision_07028274);
}
if (o->oMoveFlags & 0x00000003) {
if (o->oMoveFlags & OBJ_MOVE_MASK_ON_GROUND) {
o->oForwardVel = 0.0f;
}
}
@@ -346,7 +346,7 @@ static void eyerok_hand_act_die(void) {
create_sound_spawner(SOUND_OBJ2_EYEROK_SOUND_LONG);
}
if (o->oMoveFlags & 0x00000003) {
if (o->oMoveFlags & OBJ_MOVE_MASK_ON_GROUND) {
cur_obj_play_sound_2(SOUND_OBJ_POUNDING_LOUD);
o->oForwardVel = 0.0f;
}
@@ -378,7 +378,7 @@ static void eyerok_hand_act_retreat(void) {
static void eyerok_hand_act_target_mario(void) {
if (eyerok_check_mario_relative_z(400) != 0 || o->oPosZ - gMarioObject->oPosZ > 0.0f
|| o->oPosZ - o->parentObj->oPosZ > 1700.0f || absf(o->oPosX - o->parentObj->oPosX) > 900.0f
|| (o->oMoveFlags & 0x00000200)) {
|| (o->oMoveFlags & OBJ_MOVE_HIT_WALL)) {
o->oForwardVel = 0.0f;
if (approach_f32_ptr(&o->oPosY, o->oHomeY + 300.0f, 20.0f)) {
o->oAction = EYEROK_HAND_ACT_SMASH;
@@ -394,7 +394,7 @@ static void eyerok_hand_act_smash(void) {
s16 sp1E;
if (o->oTimer > 20) {
if (o->oMoveFlags & 0x00000003) {
if (o->oMoveFlags & OBJ_MOVE_MASK_ON_GROUND) {
if (o->oGravity < -4.0f) {
eyerok_hand_pound_ground();
o->oGravity = -4.0f;
@@ -418,7 +418,7 @@ static void eyerok_hand_act_smash(void) {
}
static void eyerok_hand_act_fist_push(void) {
if (o->oTimer > 5 && (o->oPosZ - gMarioObject->oPosZ > 0.0f || (o->oMoveFlags & 0x00000400))) {
if (o->oTimer > 5 && (o->oPosZ - gMarioObject->oPosZ > 0.0f || (o->oMoveFlags & OBJ_MOVE_HIT_EDGE))) {
o->oAction = EYEROK_HAND_ACT_FIST_SWEEP;
o->oForwardVel = 0.0f;
@@ -433,7 +433,7 @@ static void eyerok_hand_act_fist_push(void) {
}
static void eyerok_hand_act_fist_sweep(void) {
if (o->oPosZ - o->parentObj->oPosZ < 1000.0f || (o->oMoveFlags & 0x400)) {
if (o->oPosZ - o->parentObj->oPosZ < 1000.0f || (o->oMoveFlags & OBJ_MOVE_HIT_EDGE)) {
o->oAction = EYEROK_HAND_ACT_RETREAT;
o->oForwardVel = 0.0f;
} else {
@@ -470,7 +470,7 @@ static void eyerok_hand_act_double_pound(void) {
o->oAction = EYEROK_HAND_ACT_RETREAT;
o->parentObj->oEyerokBossUnk1AC = o->oBehParams2ndByte;
} else if (o->parentObj->oEyerokBossActiveHand == o->oBehParams2ndByte) {
if (o->oMoveFlags & 0x00000003) {
if (o->oMoveFlags & OBJ_MOVE_MASK_ON_GROUND) {
if (o->oGravity < -15.0f) {
o->parentObj->oEyerokBossActiveHand = 0;
eyerok_hand_pound_ground();

Some files were not shown because too many files have changed in this diff Show More