hydracastlelabyrinth icon indicating copy to clipboard operation
hydracastlelabyrinth copied to clipboard

Main character keep falling down at game start

Open musuruan opened this issue 2 years ago • 3 comments

A bit of time has passed since the last time I tried hcl. Therefore I decided to have another go. I pulled the new sources from this repo and I tried to compile it under F33/x86_64. gcc version is 10.3.1 20210422.

I had to make @zenorogue's workaround in https://github.com/ptitSeb/hydracastlelabyrinth/issues/21 to compile successfully.

But this was not enough. When starting the game, the character kept falling down with no screen drawn. The error "Map file was not found" was constantly printed in the terminal window.

Upon further inspection with gdb, "000a.map" and "000.map" map files couldn't be open.

This is because the stage array is not initialized.

I had to change #include "stagedata.h" to #include "stagedata.c" in src/game.c to get the correct behaviour.

I'm not sure this is the correct solution -my C days are long gone - but I wonder how it could have worked before.

musuruan avatar Sep 06 '21 12:09 musuruan

No. stagedata.c is already build by the cmake project. Including it would make it build 2 times. Maybe try to start over from a clean clone (I have just fixed issue #21 so a clean clone should just work).

ptitSeb avatar Sep 06 '21 18:09 ptitSeb

I noticed stagedata.c is built and linked but I wonder when the initialization code for the stage array is called.

With my config it seems it's never called (I tried a clean clone and I have the same result).

About #21, there is still a ton of other multiple definitions (and the workaround is still necessary):

/usr/bin/ld: CMakeFiles/hcl.dir/src/effect.c.o:(.bss+0x0): multiple definition of `lastDoor'; CMakeFiles/hcl.dir/src/collision.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/hcl.dir/src/effect.c.o:(.bss+0x8): multiple definition of `secretTimer'; CMakeFiles/hcl.dir/src/collision.c.o:(.bss+0x8): first defined here
/usr/bin/ld: CMakeFiles/hcl.dir/src/effect.c.o:(.bss+0xc): multiple definition of `levelStartTimer'; CMakeFiles/hcl.dir/src/collision.c.o:(.bss+0xc): first defined here
... 
[1821 lines in total]

musuruan avatar Sep 06 '21 20:09 musuruan

Need to find some system with a gcc 10+ I guess...

ptitSeb avatar Sep 06 '21 20:09 ptitSeb