All vanilla levels can be compiled through DynOS now

This commit is contained in:
MysterD 2022-04-04 01:11:02 -07:00
parent c0b0debf0b
commit 32388bf6ff
7 changed files with 39 additions and 9 deletions

View file

@ -40,4 +40,3 @@ LevelScript* dynos_level_get(const char* levelName);
#endif
#endif

View file

@ -4,6 +4,7 @@ extern "C" {
#include "geo_commands.h"
#include "src/game/camera.h"
#include "src/game/envfx_snow.h"
#include "src/game/paintings.h"
}
#pragma GCC diagnostic push
@ -113,6 +114,13 @@ static s64 ParseGeoSymbolArg(GfxData* aGfxData, DataNode<GeoLayout>* aNode, u64&
return (s64) x;
}
// Complex
s32 a;
s32 b;
if (sscanf(_Arg.begin(), "PAINTING_ID(%d,%d)", &a, &b) == 2) {
return PAINTING_ID(a, b);
}
// Unknown
PrintError(" ERROR: Unknown geo arg: %s", _Arg.begin());
return 0;

View file

@ -661,6 +661,7 @@ static void ParseGfxSymbol(GfxData* aGfxData, DataNode<Gfx>* aNode, Gfx*& aHead,
gfx_symbol_2(gsSPCopyLightEXT, false);
gfx_symbol_2(gsSPFogFactor, false);
gfx_symbol_1(gsDPSetTextureLOD, false);
// Special symbols
if (_Symbol == "gsSPTexture") {

View file

@ -9,6 +9,7 @@ extern "C" {
#include "src/game/level_update.h"
#include "include/dialog_ids.h"
#include "levels/scripts.h"
#include "src/game/area.h"
}
// Free data pointers, but keep nodes and tokens intact
@ -658,6 +659,8 @@ s64 DynOS_Lvl_ParseLevelScriptConstants(const String& _Arg, bool* found) {
lvl_constant(TERRAIN_MASK);
// Seq ids constants
lvl_constant(SEQ_BASE_ID);
lvl_constant(SEQ_VARIATION);
lvl_constant(SEQ_SOUND_PLAYER);
lvl_constant(SEQ_EVENT_CUTSCENE_COLLECT_STAR);
lvl_constant(SEQ_MENU_TITLE_SCREEN);
@ -1376,6 +1379,18 @@ s64 DynOS_Lvl_ParseLevelScriptConstants(const String& _Arg, bool* found) {
lvl_constant(REGULAR_FACE);
lvl_constant(DIZZY_FACE);
// warp transitions
lvl_constant(WARP_TRANSITION_FADE_FROM_COLOR);
lvl_constant(WARP_TRANSITION_FADE_INTO_COLOR);
lvl_constant(WARP_TRANSITION_FADE_FROM_STAR);
lvl_constant(WARP_TRANSITION_FADE_INTO_STAR);
lvl_constant(WARP_TRANSITION_FADE_FROM_CIRCLE);
lvl_constant(WARP_TRANSITION_FADE_INTO_CIRCLE);
lvl_constant(WARP_TRANSITION_FADE_FROM_MARIO);
lvl_constant(WARP_TRANSITION_FADE_INTO_MARIO);
lvl_constant(WARP_TRANSITION_FADE_FROM_BOWSER);
lvl_constant(WARP_TRANSITION_FADE_INTO_BOWSER);
// vanilla geos
s32 actorCount = DynOS_Geo_GetActorCount();
for (s32 i = 0; i < actorCount; i++) {
@ -1406,6 +1421,7 @@ static LevelScript ParseLevelScriptSymbolArg(GfxData* aGfxData, DataNode<LevelSc
// Other constants
lvl_constant(NULL);
lvl_constant(FALSE);
// Level Scripts
for (auto& _Node : aGfxData->mLevelScripts) {
@ -1983,7 +1999,6 @@ static void DynOS_Lvl_GeneratePack_Recursive(const SysPath &directory, GfxData *
void DynOS_Lvl_GeneratePack(const SysPath &aPackFolder) {
Print("---------- Level pack folder: \"%s\" ----------", aPackFolder.c_str());
Array<Pair<u64, String>> _ActorsFolders;
GfxData *_GfxData = New<GfxData>();
DIR *aPackDir = opendir(aPackFolder.c_str());
if (aPackDir) {
@ -2001,14 +2016,16 @@ void DynOS_Lvl_GeneratePack(const SysPath &aPackFolder) {
// Only parse folders with a 'script.c'
if (!fs_sys_file_exists(fstring("%s/script.c", _Folder.c_str()).c_str())) continue;
GfxData *_GfxData = New<GfxData>();
_GfxData->mModelIdentifier = 0;
DynOS_Lvl_GeneratePack_Recursive(_Folder, _GfxData);
// Generate a binary file for each level found in the GfxData
DynOS_Lvl_GeneratePack_Internal(aPackFolder, _ActorsFolders, _GfxData);
DynOS_Gfx_Free(_GfxData);
}
closedir(aPackDir);
}
// Generate a binary file for each actor found in the GfxData
DynOS_Lvl_GeneratePack_Internal(aPackFolder, _ActorsFolders, _GfxData);
DynOS_Gfx_Free(_GfxData);
}

View file

@ -226,7 +226,7 @@ s32 DynOS_Level_GetCourse(s32 aLevel) {
const void *DynOS_Level_GetScript(s32 aLevel) {
DynOS_Level_Init();
return DynOS_Lvl_Get("level_jrb_entry"); // DO NOT COMMIT
return DynOS_Lvl_Get("level_castle_inside_entry"); // DO NOT COMMIT
return sDynosLevelScripts[aLevel];
}

View file

@ -630,6 +630,11 @@ void DynOS_Lvl_Add(const SysPath &aPackFolder, const char *aLevelName) {
}
LevelScript* DynOS_Lvl_Get(const char* levelName) {
static u32 index = 0; // DO NOT COMMIT
index = (index + 1) % sDynosCustomLevelScripts.Count(); // DO NOT COMMIT
auto& scripts = sDynosCustomLevelScripts[index].second->mLevelScripts; // DO NOT COMMIT
return scripts[scripts.Count() - 1]->mData; // DO NOT COMMIT
for (s32 i = 0; i < sDynosCustomLevelScripts.Count(); ++i) {
if (!strcmp(sDynosCustomLevelScripts[i].first, levelName)) {
auto& scripts = sDynosCustomLevelScripts[i].second->mLevelScripts;

View file

@ -6,7 +6,7 @@
#include "src/pc/platform.h"
#include "mod.h"
#define MAX_MOD_SIZE (2 * 1048576) // 2MB
#define MAX_MOD_SIZE (5 * 1048576) // 5MB
#define TMP_DIRECTORY "tmp"
struct Mods {