:(
This commit is contained in:
@@ -51,9 +51,14 @@ jobs:
|
|||||||
uses: mymindstorm/setup-emsdk@v14
|
uses: mymindstorm/setup-emsdk@v14
|
||||||
|
|
||||||
- name: Build shared library
|
- name: Build shared library
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ matrix.identifier }}" == "web" ]]; then
|
if [[ "${{ matrix.identifier }}" == "web" ]]; then
|
||||||
emmake make lib -j $(nproc) CC=emcc
|
emmake make lib -j $(nproc) CC=emcc
|
||||||
|
elif [[ "${{ matrix.identifier }}" == "windows" ]]; then
|
||||||
|
make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu) \
|
||||||
|
CC=x86_64-w64-mingw32-gcc \
|
||||||
|
CXX=x86_64-w64-mingw32-g++
|
||||||
else
|
else
|
||||||
make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu)
|
make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu)
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -95,7 +95,8 @@ test/level.c: ./import-test-collision.py
|
|||||||
|
|
||||||
test/main.cpp test/gl20/gl20_renderer.c test/gl33core/gl33core_renderer.c: test/level.c
|
test/main.cpp test/gl20/gl20_renderer.c test/gl33core/gl33core_renderer.c: test/level.c
|
||||||
|
|
||||||
SDL2_CFLAGS := $(shell sdl2-config --cflags)
|
SDL2_RAW_CFLAGS := $(shell sdl2-config --cflags)
|
||||||
|
SDL2_CFLAGS := $(filter-out -Dmain=SDL_main,$(SDL2_RAW_CFLAGS))
|
||||||
|
|
||||||
$(BUILD_DIR)/test/%.o: test/%.c
|
$(BUILD_DIR)/test/%.o: test/%.c
|
||||||
$(CC) -c $(CFLAGS) $(SDL2_CFLAGS) -I src/decomp/include -o $@ $<
|
$(CC) -c $(CFLAGS) $(SDL2_CFLAGS) -I src/decomp/include -o $@ $<
|
||||||
@@ -105,7 +106,7 @@ $(BUILD_DIR)/test/%.o: test/%.cpp
|
|||||||
|
|
||||||
$(TEST_FILE): $(LIB_FILE) $(TEST_OBJS)
|
$(TEST_FILE): $(LIB_FILE) $(TEST_OBJS)
|
||||||
ifdef WINDOWS_BUILD
|
ifdef WINDOWS_BUILD
|
||||||
$(CXX) -o $@ $(TEST_OBJS) $(LIB_FILE) -lglew32 -lopengl32 -lSDL2 -lSDL2main -lm
|
$(CXX) -o $@ $(TEST_OBJS) $(LIB_FILE) -lglew32 -lopengl32 -lSDL2 -lm
|
||||||
else ifdef MACOS_BUILD
|
else ifdef MACOS_BUILD
|
||||||
$(CXX) -o $@ $(TEST_OBJS) $(LIB_FILE) -framework OpenGL -lGLEW -lSDL2 -lSDL2main -lm -lpthread
|
$(CXX) -o $@ $(TEST_OBJS) $(LIB_FILE) -framework OpenGL -lGLEW -lSDL2 -lSDL2main -lm -lpthread
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -2093,10 +2093,11 @@ s32 execute_mario_action(UNUSED struct Object * o)
|
|||||||
* INITIALIZATION *
|
* INITIALIZATION *
|
||||||
**************************************************/
|
**************************************************/
|
||||||
|
|
||||||
int init_mario(void)
|
int init_mario(uint8_t isLocal)
|
||||||
{
|
{
|
||||||
//Vec3s capPos;
|
//Vec3s capPos;
|
||||||
//struct Object *capObject;
|
//struct Object *capObject;
|
||||||
|
gMarioState->isLocal = isLocal;
|
||||||
|
|
||||||
gMarioState->actionTimer = 0;
|
gMarioState->actionTimer = 0;
|
||||||
gMarioState->framesSinceA = 0xFF;
|
gMarioState->framesSinceA = 0xFF;
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ s32 set_water_plunge_action(struct MarioState *m);
|
|||||||
|
|
||||||
s32 execute_mario_action(UNUSED struct Object *o);
|
s32 execute_mario_action(UNUSED struct Object *o);
|
||||||
|
|
||||||
int init_mario(void);
|
int init_mario(uint8_t isLocal);
|
||||||
|
|
||||||
void init_mario_from_save_file(void);
|
void init_mario_from_save_file(void);
|
||||||
|
|
||||||
|
|||||||
@@ -34,38 +34,44 @@ static Vec3f gVec3fZero = {0.0f, 0.0f, 0.0f};
|
|||||||
|
|
||||||
void add_tree_leaf_particles(struct MarioState *m)
|
void add_tree_leaf_particles(struct MarioState *m)
|
||||||
{
|
{
|
||||||
// f32 leafHeight;
|
f32 leafHeight;
|
||||||
|
s32 isOnTree = false;//(m->usedObj->behavior == segmented_to_virtual(bhvTree));
|
||||||
|
|
||||||
// if (m->usedObj->behavior == segmented_to_virtual(bhvTree)) {
|
if (isOnTree) {
|
||||||
// // make leaf effect spawn higher on the Shifting Sand Land palm tree
|
// make leaf effect spawn higher on the Shifting Sand Land palm tree
|
||||||
// if (gCurrLevelNum == LEVEL_SSL) {
|
if (gCurrLevelNum == LEVEL_SSL) {
|
||||||
// leafHeight = 250.0f;
|
leafHeight = 250.0f;
|
||||||
// } else {
|
} else {
|
||||||
// leafHeight = 100.0f;
|
leafHeight = 100.0f;
|
||||||
// }
|
}
|
||||||
// if (m->pos[1] - m->floorHeight > leafHeight) {
|
if (m->pos[1] - m->floorHeight > leafHeight) {
|
||||||
// m->particleFlags |= PARTICLE_LEAF;
|
m->particleFlags |= PARTICLE_LEAF;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void play_climbing_sounds(struct MarioState *m, s32 b)
|
void play_climbing_sounds(struct MarioState *m, s32 b)
|
||||||
{
|
{
|
||||||
// s32 isOnTree = (m->usedObj->behavior == segmented_to_virtual(bhvTree));
|
s32 isOnTree = false;//(m->usedObj->behavior == segmented_to_virtual(bhvTree));
|
||||||
|
|
||||||
// if (b == 1) {
|
if (b == 1) {
|
||||||
// if (is_anim_past_frame(m, 1)) {
|
if (is_anim_past_frame(m, 1)) {
|
||||||
// play_sound(isOnTree ? SOUND_ACTION_CLIMB_UP_TREE : SOUND_ACTION_CLIMB_UP_POLE,
|
play_sound(isOnTree ? SOUND_ACTION_CLIMB_UP_TREE : SOUND_ACTION_CLIMB_UP_POLE,
|
||||||
// m->marioObj->header.gfx.cameraToObject);
|
m->marioObj->header.gfx.cameraToObject);
|
||||||
// }
|
}
|
||||||
// } else {
|
} else {
|
||||||
// play_sound(isOnTree ? SOUND_MOVING_SLIDE_DOWN_TREE : SOUND_MOVING_SLIDE_DOWN_POLE,
|
play_sound(isOnTree ? SOUND_MOVING_SLIDE_DOWN_TREE : SOUND_MOVING_SLIDE_DOWN_POLE,
|
||||||
// m->marioObj->header.gfx.cameraToObject);
|
m->marioObj->header.gfx.cameraToObject);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 set_pole_position(struct MarioState *m, f32 offsetY)
|
s32 set_pole_position(struct MarioState *m, f32 offsetY)
|
||||||
{
|
{
|
||||||
|
if (!m->isLocal && m->usedObj == NULL)
|
||||||
|
{
|
||||||
|
return POLE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
UNUSED s32 unused1;
|
UNUSED s32 unused1;
|
||||||
UNUSED s32 unused2;
|
UNUSED s32 unused2;
|
||||||
UNUSED s32 unused3;
|
UNUSED s32 unused3;
|
||||||
@@ -95,6 +101,7 @@ s32 set_pole_position(struct MarioState *m, f32 offsetY)
|
|||||||
}
|
}
|
||||||
|
|
||||||
f32 floorHeight = find_floor(m->pos[0], m->pos[1], m->pos[2], &floor);
|
f32 floorHeight = find_floor(m->pos[0], m->pos[1], m->pos[2], &floor);
|
||||||
|
f32 floorHeight2 = find_floor(m->pos[0], m->pos[1] + 100, m->pos[2], &floor);
|
||||||
if (m->pos[1] < floorHeight)
|
if (m->pos[1] < floorHeight)
|
||||||
{
|
{
|
||||||
m->pos[1] = floorHeight;
|
m->pos[1] = floorHeight;
|
||||||
@@ -104,8 +111,17 @@ s32 set_pole_position(struct MarioState *m, f32 offsetY)
|
|||||||
else if (marioObj->oMarioPolePos < -m->usedObj->hitboxDownOffset)
|
else if (marioObj->oMarioPolePos < -m->usedObj->hitboxDownOffset)
|
||||||
{
|
{
|
||||||
m->pos[1] = m->usedObj->oPosY - m->usedObj->hitboxDownOffset;
|
m->pos[1] = m->usedObj->oPosY - m->usedObj->hitboxDownOffset;
|
||||||
set_mario_action(m, ACT_FREEFALL, 0);
|
if (m->pos[1] < floorHeight2)
|
||||||
result = POLE_FELL_OFF;
|
{
|
||||||
|
m->pos[1] = floorHeight2;
|
||||||
|
set_mario_action(m, ACT_IDLE, 0);
|
||||||
|
result = POLE_TOUCHED_FLOOR;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
set_mario_action(m, ACT_FREEFALL, 0);
|
||||||
|
result = POLE_FELL_OFF;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (collided)
|
else if (collided)
|
||||||
{
|
{
|
||||||
@@ -165,7 +181,12 @@ s32 act_holding_pole(struct MarioState *m)
|
|||||||
|
|
||||||
if (poleStickY > 16.0f)
|
if (poleStickY > 16.0f)
|
||||||
{
|
{
|
||||||
f32 poleTop = m->usedObj->hitboxHeight - 100.0f;
|
f32 poleTop = m->pos[1] + 1000;
|
||||||
|
|
||||||
|
if (m->usedObj != NULL)
|
||||||
|
{
|
||||||
|
poleTop = m->usedObj->hitboxHeight - 100.0f;
|
||||||
|
}
|
||||||
// const BehaviorScript *poleBehavior = virtual_to_segmented(0x13, m->usedObj->behavior);
|
// const BehaviorScript *poleBehavior = virtual_to_segmented(0x13, m->usedObj->behavior);
|
||||||
|
|
||||||
if (marioObj->oMarioPolePos < poleTop - 0.4f)
|
if (marioObj->oMarioPolePos < poleTop - 0.4f)
|
||||||
|
|||||||
@@ -477,6 +477,7 @@ struct MarioState
|
|||||||
|
|
||||||
u16 curTerrain; // libsm64: added field
|
u16 curTerrain; // libsm64: added field
|
||||||
s32 gasLevel; // libsm64: added field
|
s32 gasLevel; // libsm64: added field
|
||||||
|
uint8_t isLocal;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TYPES_H
|
#endif // TYPES_H
|
||||||
|
|||||||
+2
-2
@@ -182,7 +182,7 @@ SM64_LIB_FN void sm64_static_surfaces_load(const struct SM64Surface *surfaceArra
|
|||||||
surfaces_load_static(surfaceArray, numSurfaces);
|
surfaces_load_static(surfaceArray, numSurfaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
SM64_LIB_FN int32_t sm64_mario_create(float x, float y, float z)
|
SM64_LIB_FN int32_t sm64_mario_create(float x, float y, float z, uint8_t isLocal)
|
||||||
{
|
{
|
||||||
int32_t marioIndex = obj_pool_alloc_index(&s_mario_instance_pool, sizeof(struct MarioInstance));
|
int32_t marioIndex = obj_pool_alloc_index(&s_mario_instance_pool, sizeof(struct MarioInstance));
|
||||||
struct MarioInstance *newInstance = s_mario_instance_pool.objects[marioIndex];
|
struct MarioInstance *newInstance = s_mario_instance_pool.objects[marioIndex];
|
||||||
@@ -220,7 +220,7 @@ SM64_LIB_FN int32_t sm64_mario_create(float x, float y, float z)
|
|||||||
|
|
||||||
init_mario_from_save_file();
|
init_mario_from_save_file();
|
||||||
|
|
||||||
if (init_mario() < 0)
|
if (init_mario(isLocal) < 0)
|
||||||
{
|
{
|
||||||
sm64_mario_delete(marioIndex);
|
sm64_mario_delete(marioIndex);
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
+1
-1
@@ -176,7 +176,7 @@ extern SM64_LIB_FN uint32_t sm64_audio_tick(uint32_t numQueuedSamples, uint32_t
|
|||||||
|
|
||||||
extern SM64_LIB_FN void sm64_static_surfaces_load(const struct SM64Surface *surfaceArray, uint32_t numSurfaces);
|
extern SM64_LIB_FN void sm64_static_surfaces_load(const struct SM64Surface *surfaceArray, uint32_t numSurfaces);
|
||||||
|
|
||||||
extern SM64_LIB_FN int32_t sm64_mario_create(float x, float y, float z);
|
extern SM64_LIB_FN int32_t sm64_mario_create(float x, float y, float z, uint8_t isLocal);
|
||||||
|
|
||||||
extern SM64_LIB_FN void sm64_mario_tick(int32_t marioId, const struct SM64MarioInputs *inputs, struct SM64MarioState *outState, struct SM64MarioGeometryBuffers *outBuffers);
|
extern SM64_LIB_FN void sm64_mario_tick(int32_t marioId, const struct SM64MarioInputs *inputs, struct SM64MarioState *outState, struct SM64MarioGeometryBuffers *outBuffers);
|
||||||
|
|
||||||
|
|||||||
+7
-10
@@ -28,13 +28,8 @@ extern "C"
|
|||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "sm64.h"
|
#include "sm64.h"
|
||||||
|
|
||||||
|
#include "../src/decomp/include/types.h"
|
||||||
|
|
||||||
// Add this include near the top, after libsm64.h
|
|
||||||
// AnimInfo is defined in the decomp headers, not the public API
|
|
||||||
#include "../src/decomp/include/types.h" // or wherever AnimInfo is fully defined in your tree
|
|
||||||
|
|
||||||
// -------------------------------------------------------
|
|
||||||
// Named struct so it can be used as a parameter type
|
|
||||||
struct FlagEntry
|
struct FlagEntry
|
||||||
{
|
{
|
||||||
uint32_t bit;
|
uint32_t bit;
|
||||||
@@ -568,9 +563,6 @@ static const char *GetActionName(uint32_t action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------
|
|
||||||
// All helpers defined BEFORE DrawMarioState
|
|
||||||
|
|
||||||
static void DrawBitFlags(
|
static void DrawBitFlags(
|
||||||
const char *label, uint32_t value,
|
const char *label, uint32_t value,
|
||||||
const FlagEntry *table, int count)
|
const FlagEntry *table, int count)
|
||||||
@@ -776,8 +768,13 @@ static void Rumble(int32_t marioId, int16_t level, int16_t time)
|
|||||||
SDL_HapticRumblePlay(gHaptic, strength, duration);
|
SDL_HapticRumblePlay(gHaptic, strength, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WINDOWS_BUILD
|
||||||
|
constexpr float M_PI = 3.14159265358979323846f;
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
SDL_SetMainReady();
|
||||||
size_t romSize;
|
size_t romSize;
|
||||||
|
|
||||||
uint8_t *rom = utils_read_file_alloc("baserom.us.z64", &romSize);
|
uint8_t *rom = utils_read_file_alloc("baserom.us.z64", &romSize);
|
||||||
@@ -798,7 +795,7 @@ int main(void)
|
|||||||
sm64_register_rumble_callback_function(Rumble);
|
sm64_register_rumble_callback_function(Rumble);
|
||||||
|
|
||||||
sm64_static_surfaces_load(surfaces, surfaces_count);
|
sm64_static_surfaces_load(surfaces, surfaces_count);
|
||||||
int32_t marioId = sm64_mario_create(-6558, 0, 6464);
|
int32_t marioId = sm64_mario_create(-6558, 0, 6464, true);
|
||||||
|
|
||||||
int thing = sm64_fake_object_create(-6558.0f, 0.0f, 6200.0f, 1);
|
int thing = sm64_fake_object_create(-6558.0f, 0.0f, 6200.0f, 1);
|
||||||
sm64_fake_object_set_hitbox(thing, 32.0f, 800.0f * 2, 800);
|
sm64_fake_object_set_hitbox(thing, 32.0f, 800.0f * 2, 800);
|
||||||
|
|||||||
Reference in New Issue
Block a user