Files
Ghostship/levels/bits/script.c

116 lines
8.5 KiB
C
Raw Permalink Normal View History

2023-08-15 11:18:01 -06:00
#include <libultraship.h>
2019-11-03 14:36:27 -05:00
#include "sm64.h"
#include "behavior_data.h"
#include "model_ids.h"
#include "seq_ids.h"
#include "segment_symbols.h"
#include "level_commands.h"
#include "game/level_update.h"
#include "levels/scripts.h"
#include "actors/common1.h"
#include "make_const_nonconst.h"
[WIP] Implemented GeoLayout loading and moved to otr every actor (#53) * Fixed GeoLayout loading and implemented mario loading from otr * Ported bobomb and coins * Ported cannon barrel * Ported blue_coin_switch * Fixed collision loading * Ported checkerboard_platform * Ported most of common0 to otr * Fixed amp on jp * Fixed some wrong yamls * Fixed faulty snow interpolation * Bump LUS * Extracted 99.99999% actors to be loaded from otr * Removed unnessesary print and added o2r mod support * Fixed headers * Added us support into geolayout parser * Fixed conflicts * Removed done indicators * Remove duplicated headers * Added bbh, bitdw, bitfs, bits, bob and lll loaded from otr * Bump torch * Fixed linux compilation * Pushed header generation * Got compiling on Linux working. (#59) * Added more data and hopefully fix more issues * Updated libultraship * bin dls and vtxs (#60) * Fixed master volume * Updated torch * Renamed otr files * Renamed otr en cmakelists * Updated libultraship and torch * Removed actors code * [WIP] The big one that removes almost all hardcoded assets from levels and actors * Updating cmake to match Starship * Updated more references * Updated cmake to add more targets * Updated o2r name * Removed unnecesary dma call * Updated gitmodules * Bump LUS, fixed cmake and fixed audio on windows * Update torch and wdw * Fixed some corrupted ptrs, cleaned up jp support and fixed bully * Added USE_GBI_TRACE * Fixed packaging.cmake and audio fixes * Removed old LUS * Updated torch and readded LUS * More compilation issues * Removed interpolation to use on the future the new system * Bump libs * Reimplemented skybox, and added synthesis overflow fix * Removed prints to use SPDLOG * This should had been on another branch but fuck it * Added more interpolation stuff * Fixed interpolation, fixed some random things and ported from GameInteractor to Lwyx's EventSystem * Removed some FrameInterpolation changes * Fixed gitignore and implemented PortEnhancements * Fixed interpolation crashes, WIP implemented reset among other fixes * Bump torch to fix paintings * Moved log to be a trace * Readded some frame tagging * Fixed rumble * Fixed skybox crashes * Bump LUS * Moved skybox and floats to float for better precision * Moved to health change and created lives change event * Fixed bubbles being broken * Fixed lives event not being registered * Fixed skybox crashes * Initialized mixer variables * Fixed some memory leaks * Fixed trajectory being exported incorrectly * Hopefully fixed us yamls * Fixed remaining us issues * Implemented o2r generation among some other things --------- Co-authored-by: KiritoDv <KiritoDv> Co-authored-by: sitton76 <58642183+sitton76@users.noreply.github.com> Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com>
2026-01-07 01:37:43 -06:00
#include "assets/levels/bits.h"
2019-11-03 14:36:27 -05:00
static const LevelScript script_func_local_1[] = {
OBJECT(/*model*/ MODEL_BITS_SLIDING_PLATFORM, /*pos*/ -2370, -4525, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00100000, /*beh*/ bhvSlidingPlatform2),
OBJECT(/*model*/ MODEL_BITS_TWIN_SLIDING_PLATFORMS, /*pos*/ -2611, 3544, -904, /*angle*/ 0, 0, 0, /*behParam*/ 0x00CF0000, /*beh*/ bhvSlidingPlatform2),
OBJECT(/*model*/ MODEL_BITS_TWIN_SLIDING_PLATFORMS, /*pos*/ -4700, 3544, -904, /*angle*/ 0, 180, 0, /*behParam*/ 0x008F0000, /*beh*/ bhvSlidingPlatform2),
OBJECT(/*model*/ MODEL_BITS_OCTAGONAL_PLATFORM, /*pos*/ 4139, -1740, -1831, /*angle*/ 0, 0, 0, /*behParam*/ 0x02000000, /*beh*/ bhvOctagonalPlatformRotating),
OBJECT(/*model*/ MODEL_BITS_OCTAGONAL_PLATFORM, /*pos*/ -6459, 1732, -904, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvOctagonalPlatformRotating),
OBJECT(/*model*/ MODEL_BITS_OCTAGONAL_PLATFORM, /*pos*/ -4770, 1732, -904, /*angle*/ 0, 0, 0, /*behParam*/ 0x02000000, /*beh*/ bhvOctagonalPlatformRotating),
OBJECT(/*model*/ MODEL_BITS_FERRIS_WHEEL_AXLE, /*pos*/ -1748, -1330, -1094, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvFerrisWheelAxle),
OBJECT(/*model*/ MODEL_BITS_FERRIS_WHEEL_AXLE, /*pos*/ 2275, 5628, -1315, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvFerrisWheelAxle),
OBJECT(/*model*/ MODEL_BITS_FERRIS_WHEEL_AXLE, /*pos*/ 3114, 4701, -1320, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvFerrisWheelAxle),
OBJECT(/*model*/ MODEL_BITS_ARROW_PLATFORM, /*pos*/ 2793, 2325, -904, /*angle*/ 0, 0, 0, /*behParam*/ 0x00610000, /*beh*/ bhvActivatedBackAndForthPlatform),
OBJECT(/*model*/ MODEL_BITS_SEESAW_PLATFORM, /*pos*/ 27, -1555, -713, /*angle*/ 0, 90, 0, /*behParam*/ 0x00010000, /*beh*/ bhvSeesawPlatform),
OBJECT(/*model*/ MODEL_BITS_TILTING_W_PLATFORM, /*pos*/ -306, -4300, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00020000, /*beh*/ bhvSeesawPlatform),
OBJECT(/*model*/ MODEL_BITS_STAIRCASE, /*pos*/ 1769, -234, -899, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvAnimatesOnFloorSwitchPress),
OBJECT(/*model*/ MODEL_PURPLE_SWITCH, /*pos*/ -279, -234, -900, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvFloorSwitchAnimatesObject),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -6460, 2039, -905, /*angle*/ 0, 0, 0, /*behParam*/ 0x00CF0000, /*beh*/ bhvPoleGrabbing),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3326, 3227, -905, /*angle*/ 0, 0, 0, /*behParam*/ 0x004D0000, /*beh*/ bhvPoleGrabbing),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 5518, 3184, -4019, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvFlamethrower),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 6465, 3731, -1915, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvFlamethrower),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 5915, 3718, -4019, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvFlamethrower),
RETURN(),
};
static const LevelScript script_func_local_2[] = {
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 350, 6800, -6800, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvBowserCourseRedCoinStar),
RETURN(),
};
const LevelScript level_bits_entry[] = {
INIT_LEVEL(),
LOAD_MIO0( /*seg*/ 0x07, _bits_segment_7SegmentRomStart, _bits_segment_7SegmentRomEnd),
LOAD_MIO0( /*seg*/ 0x0A, _bits_skybox_mio0SegmentRomStart, _bits_skybox_mio0SegmentRomEnd),
LOAD_MIO0_TEXTURE(/*seg*/ 0x09, _sky_mio0SegmentRomStart, _sky_mio0SegmentRomEnd),
LOAD_MIO0( /*seg*/ 0x06, _group14_mio0SegmentRomStart, _group14_mio0SegmentRomEnd),
LOAD_RAW( /*seg*/ 0x0D, _group14_geoSegmentRomStart, _group14_geoSegmentRomEnd),
LOAD_MIO0( /*seg*/ 0x08, _common0_mio0SegmentRomStart, _common0_mio0SegmentRomEnd),
LOAD_RAW( /*seg*/ 0x0F, _common0_geoSegmentRomStart, _common0_geoSegmentRomEnd),
ALLOC_LEVEL_POOL(),
MARIO(/*model*/ MODEL_MARIO, /*behParam*/ 0x00000001, /*beh*/ bhvMario),
JUMP_LINK(script_func_global_15),
JUMP_LINK(script_func_global_1),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_03, bits_geo_000430),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_04, bits_geo_000448),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_05, bits_geo_000460),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_06, bits_geo_000478),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_07, bits_geo_000490),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_08, bits_geo_0004A8),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_09, bits_geo_0004C0),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_0A, bits_geo_0004D8),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_0B, bits_geo_0004F0),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_0C, bits_geo_000508),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_0D, bits_geo_000520),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_0E, bits_geo_000538),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_0F, bits_geo_000550),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_10, bits_geo_000568),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_11, bits_geo_000580),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_12, bits_geo_000598),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_13, bits_geo_0005B0),
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_14, bits_geo_0005C8),
LOAD_MODEL_FROM_GEO(MODEL_BITS_SLIDING_PLATFORM, bits_geo_0005E0),
LOAD_MODEL_FROM_GEO(MODEL_BITS_TWIN_SLIDING_PLATFORMS, bits_geo_0005F8),
LOAD_MODEL_FROM_GEO(MODEL_BITS_OCTAGONAL_PLATFORM, bits_geo_000610),
LOAD_MODEL_FROM_GEO(MODEL_BITS_BLUE_PLATFORM, bits_geo_000628),
LOAD_MODEL_FROM_GEO(MODEL_BITS_FERRIS_WHEEL_AXLE, bits_geo_000640),
LOAD_MODEL_FROM_GEO(MODEL_BITS_ARROW_PLATFORM, bits_geo_000658),
LOAD_MODEL_FROM_GEO(MODEL_BITS_SEESAW_PLATFORM, bits_geo_000670),
LOAD_MODEL_FROM_GEO(MODEL_BITS_TILTING_W_PLATFORM, bits_geo_000688),
LOAD_MODEL_FROM_GEO(MODEL_BITS_STAIRCASE, bits_geo_0006A0),
LOAD_MODEL_FROM_GEO(MODEL_BITS_STAIRCASE_FRAME1, bits_geo_0006B8),
LOAD_MODEL_FROM_GEO(MODEL_BITS_STAIRCASE_FRAME2, bits_geo_0006D0),
LOAD_MODEL_FROM_GEO(MODEL_BITS_STAIRCASE_FRAME3, bits_geo_0006E8),
LOAD_MODEL_FROM_GEO(MODEL_BITS_STAIRCASE_FRAME4, bits_geo_000700),
LOAD_MODEL_FROM_GEO(MODEL_BITS_WARP_PIPE, warp_pipe_geo),
AREA(/*index*/ 1, bits_geo_000718),
2020-06-02 12:44:34 -04:00
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -7039, -3812, 4, /*angle*/ 0, 90, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvAirborneWarp),
2019-11-03 14:36:27 -05:00
OBJECT(/*model*/ MODEL_BITS_WARP_PIPE, /*pos*/ 351, 6652, -6030, /*angle*/ 0, 0, 0, /*behParam*/ 0x000B0000, /*beh*/ bhvWarpPipe),
2020-04-03 14:57:26 -04:00
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 351, 6800, -3900, /*angle*/ 0, 180, 0, /*behParam*/ 0x000C0000, /*beh*/ bhvDeathWarp),
2019-12-01 21:52:53 -05:00
WARP_NODE(/*id*/ 0x0A, /*destLevel*/ LEVEL_BITS, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x0B, /*destLevel*/ LEVEL_BOWSER_3, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x0C, /*destLevel*/ LEVEL_BITS, /*destArea*/ 0x01, /*destNode*/ 0x0C, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0xF1, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x02, /*destNode*/ 0x6B, /*flags*/ WARP_NO_CHECKPOINT),
2019-11-03 14:36:27 -05:00
JUMP_LINK(script_func_local_1),
JUMP_LINK(script_func_local_2),
TERRAIN(/*terrainData*/ bits_seg7_collision_level),
MACRO_OBJECTS(/*objList*/ bits_seg7_macro_objs),
SET_BACKGROUND_MUSIC(/*settingsPreset*/ 0x0000, /*seq*/ SEQ_LEVEL_KOOPA_ROAD),
TERRAIN_TYPE(/*terrainType*/ TERRAIN_STONE),
END_AREA(),
FREE_LEVEL_POOL(),
MARIO_POS(/*area*/ 1, /*yaw*/ 90, /*pos*/ -7039, -4812, 4),
CALL(/*arg*/ 0, /*func*/ lvl_init_or_update),
CALL_LOOP(/*arg*/ 1, /*func*/ lvl_init_or_update),
CLEAR_LEVEL(),
SLEEP_BEFORE_EXIT(/*frames*/ 1),
EXIT(),
};