Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

Just as an example for TempQuestEnemy.c.  The code in characters_init.c tries to dynamically load a .c file, and dynamically call a function:

if (FindFile("PROGRAM\Characters\init", "*.c", fname) != "") {
        if (LoadSegment("Characters\init\" + fname)) {
            call func(&n);
            UnloadSegment("Characters\init\" + fname);
        }
}

In the case of the problem, fname is "TempQuestEnemy.c" and func = "CreateTempQuestEnemyCharacters".  So it will try to call that function after it loads the .c file.  But in that TempQuestEnemy.c file, there is no function in the script I have from you.  It looks like this:

int CreateTempQuestEnemy(int n)

Notice that it is the wrong name, and also does not pass a reference type for &n, but rather an int n.  It should look like this:

void CreateTempQuestEnemyCharacters(ref n)

What happens with that original script is nothing happens and an error is logged that it can't find function CreateTempQuestEnemyCharacters in TempQuestEnemy.c.  That is not a porting problem and should not work no matter if it is Storm 2.0, Storm 2.8 or Maelstrom.

This is interesting, but makes sense since a lot of people worked on that mod. I will check the original program folder as soon as I get home.

(1 edit)

This PROGRAM folder is from original New Horizons mod for 2.0 engine. I compared it and it has 2.547 files, while the one I have now has 4.393. Is it possible that some files are obsolete?

https://mega.nz/file/9DQ0gZKa#mdfJ3ekLJuMaOYZkq5HTprotUmRwk3VZlC-aF2hLCtA

Obsolete files don't hurt anything if the references to them are removed from #include and they are never run.  So obsolete files, even with errors, don't cause problems.

I started over with clean PROGRAM folder from NH 2018 build, fixed the libriary syntax erros. The game starts, loads the PA! splash video and then just black screen. Error log shows this:

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'LanguageGetDefaultLanguage' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'GetSaveDirectory' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'GetProgramDirectory' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'GetResourceDirectory' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_MakeNode' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_DeleteNode' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_WindowShow' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_WindowDisable' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_IsWindowEnable' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_WindowAddNode' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'DialogAssembleStr' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'DialogAddParamToStr' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_StoreNodeLocksWithOff' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_RestoreNodeLocks' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_IsKeyPressed' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_RegistryExitKey' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'AddControlTreeNode' not declared

RUNTIME ERROR - file: battle_interface\loginterface.c; line: 31

Can't create class: ActionIntrface

RUNTIME ERROR - file: ships\ships_init.c; line: 210

Invalid function call

RUNTIME ERROR - file: ships\ships_init.c; line: 210

function 'InitShips' stack error

(2 edits)

If you start over, then you have to compare the old, working 2016 version, every file, that works for Maelstrom to the new one and add, remove, change the relevant parts again.  You have to add the new native function declarations that exist in Maelstrom, but not Storm 2.0, you have to remove the native function declarations that no longer exist in Maelstrom, change those SendMessage statements that don't have the correct parameters because they changed from 2.0 to 2.8, you have to modify all the LogInterface, BattleInterface and flag things that don't work the same, the sound messages/calls that are different, etc. 


There are literally hundreds of lines that need to change.

I'm doing that, but now I got stuck with this line: #library "script_interface_functions" in INTERFACE\utilite.c and don't know how to figure it out.

It would probably be easiest to use the Program.zip from my New Horizons and compare those files.  If you do a side-by-side comparison of utilite.c, the one from my New Horizons compiles just fine, so find the differences that contribute to the errors you see and make it more like the one that works, unless it looks like some of the changes are accurate for compilation and apply to the newer version because they wanted logic modification for their newer version.

Ok, so I fixed a few files. Now I get this in error log:

COMPILE ERROR - file: interface\utilite.c; line: 28

native function 'LanguageGetDefaultLanguage' not declared

COMPILE ERROR - file: interface\utilite.c; line: 28

native function 'GetSaveDirectory' not declared

COMPILE ERROR - file: interface\utilite.c; line: 28

native function 'GetProgramDirectory' not declared

COMPILE ERROR - file: interface\utilite.c; line: 28

native function 'GetResourceDirectory' not declared

COMPILE ERROR - file: interface\utilite.c; line: 28

native function 'AddControlTreeNode' not declared

RUNTIME ERROR - file: ships\ships_init.c; line: 210

Invalid function call

RUNTIME ERROR - file: ships\ships_init.c; line: 210

function 'InitShips' stack error

When I simply remove this line:

#library "script_interface_functions"

it makes hundreds of other errors. I don't have any idea what it does and what to do with it... :/

(1 edit)

For instance, referring to my other post about comparing, that utilite.c file from the 2016 NH needed some changes to work with 2.8 and Maelstrom, where these lines needed add:

native string DialogAssembleStr(string idStr, string paramStr);
native string DialogAddParamToStr(string oldParamStr, string paramID, string paramValue);
native void XI_MakeNode(string sIniFileName, string sNodeType, string sNodeName, int nPriority); 
native void XI_DeleteNode(string sNodeName); native bool XI_IsWindowEnable(string sWindowName); 
native void XI_WindowShow(string sWindowName, int bShowStatus); 
native void XI_WindowDisable(string sWindowName, int bDisableStatus); 
native void XI_WindowAddNode(string sWindowName, string sNodeName); 
native int XI_StoreNodeLocksWithOff(); native void XI_RestoreNodeLocks(int nStoreCode); 
native bool XI_IsKeyPressed(string key_name); // key_name = {"shift","control","alt"} 
native void XI_RegistryExitKey(string key_name);

And this line needed change:

#library "script_interface_functions"

Do you happen to know how to fix this?

COMPILE ERROR - file: seadogs.c; line: 508

Undeclared identifier: PChar

Declare it somewhere at the global scope.  In the 2018 version you supplied me, it was on line 19 of globals.c, just after these 2 lines:

float FRAND(float _x) { return rand(32768) / 32768.0 * _x; }

float frandSmall(float _x) { return rand(32) / 32.0 * _x; } // boal

ref pchar;

Now I get a bunch of new errors:

COMPILE ERROR - file: locations\locations.c; line: 19

native function 'SetTipsEnabled' not declared

COMPILE ERROR - file: battle_interface\utils.c; line: 7

native function 'ShipSailState' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'LanguageGetDefaultLanguage' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'GetSaveDirectory' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'GetProgramDirectory' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'GetResourceDirectory' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_MakeNode' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_DeleteNode' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_WindowShow' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_WindowDisable' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_IsWindowEnable' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_WindowAddNode' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'DialogAssembleStr' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'DialogAddParamToStr' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_StoreNodeLocksWithOff' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_RestoreNodeLocks' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_IsKeyPressed' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'XI_RegistryExitKey' not declared

COMPILE ERROR - file: interface\utilite.c; line: 16

native function 'AddControlTreeNode' not declared

RUNTIME ERROR - file: battle_interface\loginterface.c; line: 31

Can't create class: ActionIntrface

RUNTIME ERROR - file: ships\ships_init.c; line: 210

Invalid function call

RUNTIME ERROR - file: ships\ships_init.c; line: 210

function 'InitShips' stack error

Can't get to Start Menu still, but the game starts loading and passes the PA! splash video. So I guess we are on a good way to making it work. Just to note that I have included the 2021 updates as well.

This is the updated PROGRAM folder from 19th May 2021...

https://mega.nz/file/gbgHjSqZ#nxoWGXy8TuoR3LwbRzNdsSBL7AWpNUnzaXx5PlRDzKM

Ok, so I fixed some of them. These are the ones that appear now:

COMPILE ERROR - file: interface\utilite.c; line: 28

native function 'LanguageGetDefaultLanguage' not declared

COMPILE ERROR - file: interface\utilite.c; line: 28

native function 'GetSaveDirectory' not declared

COMPILE ERROR - file: interface\utilite.c; line: 28

native function 'GetProgramDirectory' not declared

COMPILE ERROR - file: interface\utilite.c; line: 28

native function 'GetResourceDirectory' not declared

COMPILE ERROR - file: interface\utilite.c; line: 28

native function 'AddControlTreeNode' not declared

RUNTIME ERROR - file: ships\ships_init.c; line: 210

Invalid function call

RUNTIME ERROR - file: ships\ships_init.c; line: 210

function 'InitShips' stack error

Sorry for bombarding you with so many messages, but I was trying to fix all by myself. I got the game to run with 2021 build, but isn't this weird, I was trying to fix the bugs in the PROGRAM folder. when I accidentally saw the log in compiler:

ini file RESOURCE\INI\RESOURCE\INI\NEW_INTERFACES\mainmenu.ini not found!

DestroyWindow

PostDWindow

System exit and cleanup:

Mem state: User memory: 0  MSSystem: 0  Blocks: 0

I made the folders RESOURCE\INI\RESOURCE\INI\NEW_INTERFACES\mainmenu and the game got to main menu screen. Isn't that weird. Why is it needing double folders?

Because in the New Horizons Maximus_Functions.c, the void ReinitInterface sets the .IniFile path like this:

Interfaces[INTERFACE_SELECT_STORYLINE].IniFile = "RESOURCE\INI\"+GetCurrentInterfacePath()+"\select_storyline.ini";

But Maelstrom already knows for any Interfaces object, the .Inifile path will always be the default RESOURCE path (specified in start.ini), so it is redundant.  If you compare the 2016 version of that same file/function, all the "RESOURCE\INI\" portions were removed for Maelstrom.  Keep in mind, that is not the only place in the scripts where this type of problem will occur, so you need to search all the file contents for similar issues.

I still suggest going through a 2018 (the working copy I gave just recently) and the 2021 version, and comparing all the different files.

Using FreeFileSync, not counting the new files that would be added, there are 951 files that are different:


Then you have to go through every one of them, compare them, and modify what is different in the 2018 working version, that is specific to making it work with Maelstrom.  Here is that MAXIMUS comparison:

Some things are because they were Storm 2.8 fixes, like replacing all ResetSoundScheme(); calls in every file except sound.c, with ResetSound();

There are lots of things, but the only way to find them all is compare those 900+ files to be sure you get them all.  Then in the case of things like the ResetSoundScheme thing, is to do a global search of all the files, because some files are newly added and there is no comparison to do, and if they contain things that we know need to change, you have to search for them.

Ok, will do that now. 

Ok, so I updated to the latest build from May 2021. I spent last 2 days fixing all the script errors. I think I fixed them all, except the one in utils.c:

RUNTIME ERROR - file: utils.c; line: 2091

function 'GetStoryline' stack error

RUNTIME ERROR - file: utils.c; line: 2091

function 'GetStoryline' stack error

RUNTIME ERROR - file: utils.c; line: 2091

function 'GetStoryline' stack error

I just don't get it why GetStoryline is bad code, when it appears in different files as well.

Here's the updated Resource and Program folder:

https://mega.nz/file/1GoEiL5D#GAKiPDQFsoPzNFgXly6o-mBPcrCV7lkVDEWE_3l4qcc

https://mega.nz/file/oSgwiBwC#O5qG-vBnGNxrjHoGWQdV6pzXEOE1WJgukj70un8lqDY

I just checked this original Program, and there is libriary error everywhere. Omg

The #libriary was valid in all Storm versions.  I could not handle the spelling error, so changed it in Maelstrom.  That is something that does need to change when porting to Maelstrom.