├── .gitignore ├── README.md ├── nx ├── LICENSE ├── Makefile ├── ObjManager.cpp ├── ObjManager.fdh ├── ObjManager.h ├── README ├── TextBox │ ├── ItemImage.cpp │ ├── ItemImage.fdh │ ├── ItemImage.h │ ├── SaveSelect.cpp │ ├── SaveSelect.fdh │ ├── SaveSelect.h │ ├── StageSelect.cpp │ ├── StageSelect.fdh │ ├── StageSelect.h │ ├── TextBox.cpp │ ├── TextBox.fdh │ ├── TextBox.h │ ├── YesNoPrompt.cpp │ ├── YesNoPrompt.fdh │ └── YesNoPrompt.h ├── ai │ ├── IrregularBBox.cpp │ ├── IrregularBBox.fdh │ ├── IrregularBBox.h │ ├── ai.cpp │ ├── ai.fdh │ ├── ai.h │ ├── almond │ │ ├── almond.cpp │ │ ├── almond.fdh │ │ └── almond.h │ ├── balrog_common.cpp │ ├── balrog_common.fdh │ ├── balrog_common.h │ ├── boss │ │ ├── balfrog.cpp │ │ ├── balfrog.fdh │ │ ├── balfrog.h │ │ ├── ballos.cpp │ │ ├── ballos.fdh │ │ ├── ballos.h │ │ ├── core.cpp │ │ ├── core.fdh │ │ ├── core.h │ │ ├── heavypress.cpp │ │ ├── heavypress.fdh │ │ ├── heavypress.h │ │ ├── ironhead.cpp │ │ ├── ironhead.fdh │ │ ├── ironhead.h │ │ ├── omega.cpp │ │ ├── omega.fdh │ │ ├── omega.h │ │ ├── sisters.cpp │ │ ├── sisters.fdh │ │ ├── sisters.h │ │ ├── undead_core.cpp │ │ ├── undead_core.fdh │ │ ├── undead_core.h │ │ ├── x.cpp │ │ ├── x.fdh │ │ └── x.h │ ├── egg │ │ ├── egg.cpp │ │ ├── egg.fdh │ │ ├── egg2.cpp │ │ ├── egg2.fdh │ │ ├── igor.cpp │ │ └── igor.fdh │ ├── final_battle │ │ ├── balcony.cpp │ │ ├── balcony.fdh │ │ ├── doctor.cpp │ │ ├── doctor.fdh │ │ ├── doctor.h │ │ ├── doctor_common.cpp │ │ ├── doctor_common.fdh │ │ ├── doctor_frenzied.cpp │ │ ├── doctor_frenzied.fdh │ │ ├── final_misc.cpp │ │ ├── final_misc.fdh │ │ ├── misery.cpp │ │ ├── misery.fdh │ │ ├── sidekicks.cpp │ │ └── sidekicks.fdh │ ├── first_cave │ │ ├── first_cave.cpp │ │ └── first_cave.fdh │ ├── hell │ │ ├── ballos_misc.cpp │ │ ├── ballos_misc.fdh │ │ ├── ballos_priest.cpp │ │ ├── ballos_priest.fdh │ │ ├── hell.cpp │ │ └── hell.fdh │ ├── last_cave │ │ ├── last_cave.cpp │ │ └── last_cave.fdh │ ├── maze │ │ ├── balrog_boss_missiles.cpp │ │ ├── balrog_boss_missiles.fdh │ │ ├── critter_purple.cpp │ │ ├── critter_purple.fdh │ │ ├── gaudi.cpp │ │ ├── gaudi.fdh │ │ ├── labyrinth_m.cpp │ │ ├── labyrinth_m.fdh │ │ ├── maze.cpp │ │ ├── maze.fdh │ │ ├── pooh_black.cpp │ │ └── pooh_black.fdh │ ├── npc │ │ ├── balrog.cpp │ │ ├── balrog.fdh │ │ ├── curly.cpp │ │ ├── curly.fdh │ │ ├── curly_ai.cpp │ │ ├── curly_ai.fdh │ │ ├── misery.cpp │ │ ├── misery.fdh │ │ ├── npcguest.cpp │ │ ├── npcguest.fdh │ │ ├── npcplayer.cpp │ │ ├── npcplayer.fdh │ │ ├── npcregu.cpp │ │ └── npcregu.fdh │ ├── oside │ │ ├── oside.cpp │ │ └── oside.fdh │ ├── plantation │ │ ├── plantation.cpp │ │ └── plantation.fdh │ ├── sand │ │ ├── curly_boss.cpp │ │ ├── curly_boss.fdh │ │ ├── puppy.cpp │ │ ├── puppy.fdh │ │ ├── sand.cpp │ │ ├── sand.fdh │ │ ├── toroko_frenzied.cpp │ │ └── toroko_frenzied.fdh │ ├── stdai.h │ ├── sym │ │ ├── smoke.cpp │ │ ├── smoke.fdh │ │ ├── sym.cpp │ │ └── sym.fdh │ ├── village │ │ ├── balrog_boss_running.cpp │ │ ├── balrog_boss_running.fdh │ │ ├── ma_pignon.cpp │ │ ├── ma_pignon.fdh │ │ ├── village.cpp │ │ └── village.fdh │ ├── weapons │ │ ├── blade.cpp │ │ ├── blade.fdh │ │ ├── bubbler.cpp │ │ ├── bubbler.fdh │ │ ├── fireball.cpp │ │ ├── fireball.fdh │ │ ├── missile.cpp │ │ ├── missile.fdh │ │ ├── nemesis.cpp │ │ ├── nemesis.fdh │ │ ├── polar_mgun.cpp │ │ ├── polar_mgun.fdh │ │ ├── snake.cpp │ │ ├── snake.fdh │ │ ├── spur.cpp │ │ ├── spur.fdh │ │ ├── weapons.cpp │ │ ├── weapons.fdh │ │ ├── weapons.h │ │ ├── whimstar.cpp │ │ ├── whimstar.fdh │ │ └── whimstar.h │ └── weed │ │ ├── balrog_boss_flying.cpp │ │ ├── balrog_boss_flying.fdh │ │ ├── frenzied_mimiga.cpp │ │ ├── frenzied_mimiga.fdh │ │ ├── weed.cpp │ │ └── weed.fdh ├── autogen │ ├── AssignSprites.cpp │ ├── AssignSprites.fdh │ ├── asdefs.h │ ├── objnames.cpp │ ├── objnames.fdh │ ├── sprites.h │ └── stagedata.fdh ├── buildscript ├── caret.cpp ├── caret.fdh ├── caret.h ├── common │ ├── BList.cpp │ ├── BList.fdh │ ├── BList.h │ ├── DBuffer.cpp │ ├── DBuffer.fdh │ ├── DBuffer.h │ ├── DString.cpp │ ├── DString.fdh │ ├── DString.h │ ├── FileBuffer.cpp │ ├── FileBuffer.fdh │ ├── FileBuffer.h │ ├── InitList.cpp │ ├── InitList.fdh │ ├── InitList.h │ ├── StringList.cpp │ ├── StringList.fdh │ ├── StringList.h │ ├── SupportDefs.h │ ├── basics.h │ ├── bufio.cpp │ ├── bufio.fdh │ ├── bufio.h │ ├── llist.h │ ├── misc.cpp │ ├── misc.fdh │ ├── misc.obj │ ├── stat.cpp │ ├── stat.fdh │ └── stat.obj ├── config.h ├── console.cpp ├── console.fdh ├── console.h ├── debug.cpp ├── debug.fdh ├── debug.h ├── debug.txt ├── dirnames.h ├── endgame │ ├── CredReader.cpp │ ├── CredReader.fdh │ ├── CredReader.h │ ├── credits.cpp │ ├── credits.fdh │ ├── credits.h │ ├── island.cpp │ ├── island.fdh │ ├── island.h │ ├── misc.cpp │ └── misc.fdh ├── extract │ ├── crc.cpp │ ├── crc.fdh │ ├── extract.cpp │ ├── extract.fdh │ ├── extractfiles.cpp │ ├── extractfiles.fdh │ ├── extractpxt.cpp │ ├── extractpxt.fdh │ ├── extractstages.cpp │ └── extractstages.fdh ├── floattext.cpp ├── floattext.fdh ├── floattext.h ├── font.ttf ├── game.cpp ├── game.fdh ├── game.h ├── graphics │ ├── fbdev.cpp │ ├── fbdev.fdh │ ├── font.cpp │ ├── font.fdh │ ├── font.h │ ├── graphics.cpp │ ├── graphics.fdh │ ├── graphics.h │ ├── nxsurface.cpp │ ├── nxsurface.fdh │ ├── nxsurface.h │ ├── palette.cpp │ ├── palette.fdh │ ├── palette.h │ ├── safemode.cpp │ ├── safemode.fdh │ ├── safemode.h │ ├── sprites.cpp │ ├── sprites.fdh │ ├── sprites.h │ ├── tileset.cpp │ ├── tileset.fdh │ └── tileset.h ├── input.cpp ├── input.fdh ├── input.h ├── intro │ ├── intro.cpp │ ├── intro.fdh │ ├── intro.h │ ├── title.cpp │ ├── title.fdh │ └── title.h ├── inventory.cpp ├── inventory.fdh ├── inventory.h ├── ip.txt.in ├── main.cpp ├── main.fdh ├── makelist.ml ├── map.cpp ├── map.fdh ├── map.h ├── map_system.cpp ├── map_system.fdh ├── map_system.h ├── maprecord.h ├── master.sh ├── niku.cpp ├── niku.fdh ├── nx.h ├── nxce │ ├── buildscript │ ├── remotescript │ └── silayout ├── object.cpp ├── object.fdh ├── object.h ├── p_arms.cpp ├── p_arms.fdh ├── p_arms.h ├── pause │ ├── dialog.cpp │ ├── dialog.fdh │ ├── dialog.h │ ├── message.cpp │ ├── message.fdh │ ├── message.h │ ├── objects.cpp │ ├── objects.fdh │ ├── options.cpp │ ├── options.fdh │ ├── options.h │ ├── pause.cpp │ ├── pause.fdh │ └── pause.h ├── platform.cpp ├── platform.fdh ├── platform.h ├── platform │ └── Linux │ │ ├── vbesync.c │ │ └── vbesync.fdh ├── player.cpp ├── player.fdh ├── player.h ├── playerstats.cpp ├── playerstats.fdh ├── profile.cpp ├── profile.fdh ├── profile.h ├── replay.cpp ├── replay.fdh ├── replay.h ├── screeneffect.cpp ├── screeneffect.fdh ├── screeneffect.h ├── settings.cpp ├── settings.fdh ├── settings.h ├── siflib │ ├── sectSprites.cpp │ ├── sectSprites.fdh │ ├── sectSprites.h │ ├── sectStringArray.cpp │ ├── sectStringArray.fdh │ ├── sectStringArray.h │ ├── sif.cpp │ ├── sif.fdh │ ├── sif.h │ ├── sifloader.cpp │ ├── sifloader.fdh │ ├── sifloader.h │ └── sifupgrade.cpp ├── silayout ├── sin_table.h ├── slope.cpp ├── slope.fdh ├── slope.h ├── smalfont.bmp ├── sound │ ├── org.cpp │ ├── org.fdh │ ├── org.h │ ├── pxt.cpp │ ├── pxt.fdh │ ├── pxt.h │ ├── sound.cpp │ ├── sound.fdh │ ├── sound.h │ ├── sslib.cpp │ ├── sslib.fdh │ └── sslib.h ├── sprites.sif ├── stageboss.cpp ├── stageboss.fdh ├── stageboss.h ├── stagedata.cpp ├── stagedata.fdh ├── stagedata.h ├── statusbar.cpp ├── statusbar.fdh ├── statusbar.h ├── tan_table.h ├── tilekey.dat ├── tools │ ├── SoundList.vbp │ ├── SoundList.vbw │ ├── TileKey.vbp │ ├── TileKey.vbw │ ├── compile_genobjnametable │ ├── extractmapinfo │ ├── extractmapinfo.c │ ├── extractpxt.cpp │ ├── frmSoundList.frm │ ├── frmTileKey.frm │ ├── frmTileKey.frx │ ├── genobjnametable │ └── genobjnametable.cpp ├── trig.cpp ├── trig.fdh ├── trig.h ├── tsc.cpp ├── tsc.fdh ├── tsc.h ├── tsc_cmdtbl.cpp ├── vararray.h └── wince.ml ├── nxextract ├── LICENSE ├── ObjManager.cpp ├── ObjManager.h ├── SDL.dll ├── TextBox │ ├── ItemImage.cpp │ ├── ItemImage.h │ ├── SaveSelect.cpp │ ├── SaveSelect.h │ ├── StageSelect.cpp │ ├── StageSelect.h │ ├── TextBox.cpp │ ├── TextBox.h │ ├── YesNoPrompt.cpp │ └── YesNoPrompt.h ├── ai │ ├── IrregularBBox.cpp │ ├── IrregularBBox.h │ ├── ai.cpp │ ├── ai.h │ ├── almond │ │ ├── almond.cpp │ │ └── almond.h │ ├── balrog_common.cpp │ ├── balrog_common.h │ ├── boss │ │ ├── balfrog.cpp │ │ ├── balfrog.h │ │ ├── ballos.cpp │ │ ├── ballos.h │ │ ├── core.cpp │ │ ├── core.h │ │ ├── heavypress.cpp │ │ ├── heavypress.h │ │ ├── ironhead.cpp │ │ ├── ironhead.h │ │ ├── omega.cpp │ │ ├── omega.h │ │ ├── sisters.cpp │ │ ├── sisters.h │ │ ├── undead_core.cpp │ │ ├── undead_core.h │ │ ├── x.cpp │ │ └── x.h │ ├── egg │ │ ├── egg.cpp │ │ ├── egg2.cpp │ │ └── igor.cpp │ ├── final_battle │ │ ├── balcony.cpp │ │ ├── doctor.cpp │ │ ├── doctor.h │ │ ├── doctor_common.cpp │ │ ├── doctor_frenzied.cpp │ │ ├── final_misc.cpp │ │ ├── misery.cpp │ │ └── sidekicks.cpp │ ├── first_cave │ │ └── first_cave.cpp │ ├── hell │ │ ├── ballos_misc.cpp │ │ ├── ballos_priest.cpp │ │ └── hell.cpp │ ├── last_cave │ │ └── last_cave.cpp │ ├── maze │ │ ├── balrog_boss_missiles.cpp │ │ ├── critter_purple.cpp │ │ ├── gaudi.cpp │ │ ├── labyrinth_m.cpp │ │ ├── maze.cpp │ │ └── pooh_black.cpp │ ├── npc │ │ ├── balrog.cpp │ │ ├── curly.cpp │ │ ├── curly_ai.cpp │ │ ├── misery.cpp │ │ ├── npcguest.cpp │ │ ├── npcplayer.cpp │ │ └── npcregu.cpp │ ├── oside │ │ └── oside.cpp │ ├── plantation │ │ └── plantation.cpp │ ├── sand │ │ ├── curly_boss.cpp │ │ ├── puppy.cpp │ │ ├── sand.cpp │ │ └── toroko_frenzied.cpp │ ├── stdai.h │ ├── sym │ │ ├── smoke.cpp │ │ └── sym.cpp │ ├── village │ │ ├── balrog_boss_running.cpp │ │ ├── ma_pignon.cpp │ │ └── village.cpp │ ├── weapons │ │ ├── blade.cpp │ │ ├── bubbler.cpp │ │ ├── fireball.cpp │ │ ├── missile.cpp │ │ ├── nemesis.cpp │ │ ├── polar_mgun.cpp │ │ ├── snake.cpp │ │ ├── spur.cpp │ │ ├── weapons.cpp │ │ ├── weapons.h │ │ ├── whimstar.cpp │ │ └── whimstar.h │ └── weed │ │ ├── balrog_boss_flying.cpp │ │ ├── frenzied_mimiga.cpp │ │ └── weed.cpp ├── autogen │ ├── AssignSprites.cpp │ ├── asdefs.h │ ├── objnames.cpp │ └── sprites.h ├── buildscript ├── caret.cpp ├── caret.h ├── common │ ├── BList.cpp │ ├── BList.h │ ├── DBuffer.cpp │ ├── DBuffer.h │ ├── DString.cpp │ ├── DString.h │ ├── FileBuffer.cpp │ ├── FileBuffer.h │ ├── InitList.cpp │ ├── InitList.h │ ├── StringList.cpp │ ├── StringList.h │ ├── SupportDefs.h │ ├── basics.h │ ├── bufio.cpp │ ├── bufio.h │ ├── llist.h │ ├── misc.cpp │ └── stat.cpp ├── config.h ├── console.cpp ├── console.h ├── debug.cpp ├── debug.h ├── dirnames.h ├── endgame │ ├── CredReader.cpp │ ├── CredReader.h │ ├── credits.cpp │ ├── credits.h │ ├── island.cpp │ ├── island.h │ └── misc.cpp ├── extract │ ├── crc.cpp │ ├── extract.cpp │ ├── extractfiles.cpp │ ├── extractpxt.cpp │ └── extractstages.cpp ├── floattext.cpp ├── floattext.h ├── font.ttf ├── game.cpp ├── game.h ├── graphics │ ├── fbdev.cpp │ ├── font.cpp │ ├── font.h │ ├── graphics.cpp │ ├── graphics.h │ ├── nxsurface.cpp │ ├── nxsurface.h │ ├── palette.cpp │ ├── palette.h │ ├── safemode.cpp │ ├── safemode.h │ ├── sprites.cpp │ ├── sprites.h │ ├── tileset.cpp │ └── tileset.h ├── i586-mingw32msvc.ml ├── input.cpp ├── input.h ├── intro │ ├── intro.cpp │ ├── intro.h │ ├── title.cpp │ └── title.h ├── inventory.cpp ├── inventory.h ├── main.cpp ├── makelist.ml ├── map.cpp ├── map.h ├── map_system.cpp ├── map_system.h ├── maprecord.h ├── niku.cpp ├── nx.h ├── nxce │ ├── buildscript │ ├── remotescript │ └── silayout ├── object.cpp ├── object.h ├── p_arms.cpp ├── p_arms.h ├── pause │ ├── dialog.cpp │ ├── dialog.h │ ├── message.cpp │ ├── message.h │ ├── objects.cpp │ ├── options.cpp │ ├── options.h │ ├── pause.cpp │ └── pause.h ├── platform.cpp ├── platform.h ├── platform │ └── Linux │ │ └── vbesync.c ├── player.cpp ├── player.h ├── playerstats.cpp ├── profile.cpp ├── profile.h ├── release.sh ├── replay.cpp ├── replay.h ├── screeneffect.cpp ├── screeneffect.h ├── settings.cpp ├── settings.h ├── siflib │ ├── sectSprites.cpp │ ├── sectSprites.h │ ├── sectStringArray.cpp │ ├── sectStringArray.h │ ├── sif.cpp │ ├── sif.h │ ├── sifloader.cpp │ ├── sifloader.h │ └── sifupgrade.cpp ├── silayout ├── sintan.cpp ├── slope.cpp ├── slope.h ├── smalfont.bmp ├── sound │ ├── org.cpp │ ├── org.h │ ├── pxt.cpp │ ├── pxt.h │ ├── sound.cpp │ ├── sound.h │ ├── sslib.cpp │ └── sslib.h ├── sprites.sif ├── stageboss.cpp ├── stageboss.h ├── stagedata.cpp ├── stagedata.h ├── statusbar.cpp ├── statusbar.h ├── tilekey.dat ├── tools │ ├── SoundList.vbp │ ├── SoundList.vbw │ ├── TileKey.vbp │ ├── TileKey.vbw │ ├── compile_genobjnametable │ ├── extractmapinfo │ ├── extractmapinfo.c │ ├── extractpxt.cpp │ ├── frmSoundList.frm │ ├── frmTileKey.frm │ ├── frmTileKey.frx │ ├── genobjnametable │ └── genobjnametable.cpp ├── trig.cpp ├── trig.h ├── tsc.cpp ├── tsc.h ├── tsc_cmdtbl.cpp ├── vararray.h └── wince.ml └── sdlshim ├── Makefile ├── SDL ├── SDL.h ├── SDL_keysym.h ├── audio.cpp ├── audio.fdh ├── audio.h ├── bmploader.cpp ├── bmploader.fdh ├── bmploader.h ├── event.cpp ├── event.fdh ├── event.h ├── fastblit.cpp ├── fastblit.h ├── init.cpp ├── init.fdh ├── init.h ├── misc.cpp ├── misc.fdh ├── screen.cpp ├── screen.fdh └── screen.h ├── aica.bin.c ├── aica ├── arm-crt0.s ├── clib.c ├── clib.h ├── common.h └── main.c ├── arm ├── Makefile ├── arm_pxt_code.c ├── arm_pxt_code.h ├── encode_armcode.pike └── sound_pxt.h ├── asm.s ├── audio.c ├── audio.cpp ├── audio.fdh ├── audio.h ├── buildscript ├── cave_icon.h ├── common ├── BList.cpp ├── BList.fdh ├── BList.h ├── DBuffer.cpp ├── DBuffer.fdh ├── DBuffer.h ├── DString.cpp ├── DString.fdh ├── DString.h ├── Queue.cpp ├── Queue.fdh ├── Queue.h ├── SupportDefs.h ├── ThreadFlag.cpp ├── ThreadFlag.fdh ├── ThreadFlag.h ├── atree.cpp ├── atree.fdh ├── atree.h ├── basics.h ├── bufio.cpp ├── bufio.fdh ├── bufio.h ├── curses.cpp ├── curses.fdh ├── iord.cpp ├── iord.fdh ├── iord.h ├── misc.cpp ├── misc.fdh ├── quicksearch.cpp ├── quicksearch.fdh ├── quicksearch.h ├── stat.cpp ├── stat.fdh ├── tcpstuff.cpp ├── tcpstuff.fdh ├── tcpstuff.h ├── timer.cpp ├── timer.fdh ├── timer.h ├── udpstuff.cpp ├── udpstuff.fdh └── udpstuff.h ├── console.cpp ├── console.fdh ├── file.cpp ├── file.fdh ├── font.cpp ├── font.fdh ├── gapi.cpp ├── gapi.fdh ├── hacks.cpp ├── hacks.fdh ├── icon_data_2bpp.h ├── impl ├── libsh4.h ├── libsh4 ├── gbr.h ├── sh4.h ├── sh4float.h ├── sq.h └── trapa.h ├── main.cpp ├── main.fdh ├── makelist.ml ├── music ├── org.cpp ├── org.fdh ├── org.h ├── pmd.cpp ├── pmd.fdh └── pmd.h ├── npvr_vertex.h ├── private.h ├── profile.c ├── profile.h ├── remotescript ├── scrnsave.cpp ├── scrnsave.h ├── shim.cpp ├── shim.h ├── silayout ├── sound ├── cdda.cpp ├── org.cpp ├── org.fdh ├── org.h ├── pxt.cpp ├── pxt.fdh ├── pxt.h ├── sslib.cpp ├── sslib.fdh └── sslib.h ├── sslib.cpp ├── sslib.fdh ├── sslib.h ├── support.cpp ├── support.fdh ├── vm_file.cpp ├── vm_file.h ├── vmu.cpp ├── vmu.h ├── watchdog.c └── watchdog.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.elf 3 | *.BIN 4 | *.bin 5 | ip.txt 6 | *.exe 7 | *.CDI 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NXEngine for DC 2 | 3 | Port of NxEngine to the Dreamcast. 4 | NXEngine [website][1] by Caitlin Shaw. 5 | A complete open-source clone/rewrite of the masterpiece jump-and-run platformer Doukutsu Monogatari. 6 | 7 | [1]:http://nxengine.sourceforge.net 8 | 9 | ## Burning 10 | cdi image at release page 11 | you can burn with [Image Burn](https://www.imgburn.com/index.php?act=download) 12 | 13 | ## Controlls 14 | ### Dreamcast controller 15 | - Start button is assigned MENU(F3) 16 | - buttons and triggers are not assigned in default 17 | 18 | ## Build Instructions (Source code) 19 | you'll need sdk [KallistiOS](http://gamedev.allusion.net/softprj/kos/) 20 | After all setting up compiler and libs 21 | ``` 22 | cd nx 23 | make 24 | ``` 25 | ## Credits 26 | - Studio Pixel 27 | - Caitlin Shaw 28 | - Histat 29 | -------------------------------------------------------------------------------- /nx/ObjManager.fdh: -------------------------------------------------------------------------------- 1 | //hash:3b98a341 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //------------------[referenced from ObjManager.cpp]-----------------// 7 | Object *CreateObject(int x, int y, int type); 8 | bool hitdetect(Object *o1, Object *o2); 9 | bool solidhitdetect(Object *o1, Object *o2); 10 | 11 | -------------------------------------------------------------------------------- /nx/README: -------------------------------------------------------------------------------- 1 | NXEngine for DC 2 | =============== 3 | 4 | About 5 | ----- 6 | 7 | Port of NxEngine to the Dreamcast 8 | 9 | NxEngine is a complete open-source clone/rewrite of the Cave Story. 10 | 11 | Original NXEngine website http://nxengine.sourceforge.net 12 | 13 | 14 | Burning 15 | ------- 16 | you can burn with Image Burn 17 | 18 | Controls 19 | -------- 20 | 21 | Dreamcast controller: 22 | D-pad: left,right,down,up 23 | Start: MENU(F3) 24 | 25 | thease buttons and triggers are not assigned in default 26 | A,B,X,Y,L trigger,R trigger 27 | 28 | 29 | Dreamcast keyboard: 30 | arrow: left,right,down,up 31 | F3: MENU 32 | Z: jump 33 | X: fire 34 | Q: inventory 35 | W: mapsystem 36 | A: prev wepon 37 | S: next wepon 38 | 39 | 40 | Credits 41 | ------- 42 | - Cave Story 43 | Studio Pixel 44 | 45 | - NXEngine 46 | 47 | NXEngine by Caitlin Shaw (rogueeve) 48 | 49 | - Dreamcast Library 50 | 51 | KallistiOS - https://cadcdev.sourceforge.net/ 52 | 53 | Contact 54 | ------- 55 | histat@users.sourceforge.net 56 | http://twitter.com/histat 57 | 58 | 59 | -------------------------------------------------------------------------------- /nx/TextBox/ItemImage.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /nx/TextBox/ItemImage.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _ITEMIMAGE_H 3 | #define _ITEMIMAGE_H 4 | 5 | class TB_ItemImage 6 | { 7 | public: 8 | void ResetState(); 9 | void Draw(); 10 | 11 | void SetVisible(bool enable); 12 | void SetSprite(int sprite, int frame); 13 | 14 | private: 15 | bool fVisible; 16 | int fSprite, fFrame; 17 | int fYOffset; 18 | }; 19 | 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /nx/TextBox/SaveSelect.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SAVESELECT_H 3 | #define _SAVESELECT_H 4 | 5 | #define SS_LOADING 0 6 | #define SS_SAVING 1 7 | #define MAX_SAVE_SLOTS 5 8 | 9 | class TB_SaveSelect 10 | { 11 | public: 12 | TB_SaveSelect(); 13 | 14 | void ResetState(); 15 | void SetVisible(bool enable, bool saving=SS_LOADING); 16 | 17 | bool IsVisible(); 18 | void Draw(); 19 | 20 | private: 21 | void Run_Input(); 22 | void DrawProfile(int x, int y, int index); 23 | void DrawExtendedInfo(); 24 | 25 | bool fVisible; 26 | bool fSaving; 27 | int fCurSel; 28 | int fNumFiles; 29 | 30 | struct { int x, y, w, h; } fCoords; 31 | }; 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /nx/TextBox/StageSelect.fdh: -------------------------------------------------------------------------------- 1 | //hash:6474e2de 2 | //automatically generated by Makegen 3 | 4 | /* located in tsc.cpp */ 5 | 6 | //--------------[referenced from TextBox/StageSelect.cpp]------------// 7 | bool JumpScript(int newscriptno, int pageno); 8 | void StopScripts(void); 9 | 10 | 11 | /* located in input.cpp */ 12 | 13 | //--------------[referenced from TextBox/StageSelect.cpp]------------// 14 | bool justpushed(int k); 15 | bool buttondown(void); 16 | 17 | 18 | /* located in sound/sound.cpp */ 19 | 20 | //--------------[referenced from TextBox/StageSelect.cpp]------------// 21 | void sound(int snd); 22 | 23 | 24 | /* located in common/stat.cpp */ 25 | 26 | //--------------[referenced from TextBox/StageSelect.cpp]------------// 27 | void stat(const char *fmt, ...); 28 | 29 | -------------------------------------------------------------------------------- /nx/TextBox/StageSelect.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _STAGESELECT_H 3 | #define _STAGESELECT_H 4 | 5 | #define NUM_TELEPORTER_SLOTS 8 6 | 7 | struct Teleporter_Slot 8 | { 9 | int slotno; // which slot # this is (first param to PS+) 10 | int scriptno; // which script is run when selected (2nd param to PS+) 11 | }; 12 | 13 | class TB_StageSelect 14 | { 15 | public: 16 | TB_StageSelect(); 17 | 18 | void ResetState(); 19 | void SetVisible(bool enable); 20 | 21 | void SetSlot(int slotno, int scriptno); 22 | void ClearSlots(); 23 | bool GetSlotByIndex(int index, int *slotno_out=NULL, int *scriptno_out=NULL); 24 | int CountActiveSlots(); 25 | 26 | bool IsVisible(); 27 | void Draw(); 28 | 29 | private: 30 | void HandleInput(); 31 | void MoveSelection(int dir); 32 | void UpdateText(); 33 | 34 | bool fVisible; 35 | int fSlots[NUM_TELEPORTER_SLOTS]; // scripts used for slots 36 | 37 | int fWarpY; 38 | 39 | int fSelectionIndex; 40 | int fSelectionFrame; 41 | 42 | bool fLastButtonDown; 43 | bool fMadeSelection; 44 | }; 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /nx/TextBox/TextBox.fdh: -------------------------------------------------------------------------------- 1 | //hash:3d2d7914 2 | //automatically generated by Makegen 3 | 4 | /* located in input.cpp */ 5 | 6 | //----------------[referenced from TextBox/TextBox.cpp]--------------// 7 | bool buttondown(void); 8 | 9 | 10 | /* located in graphics/font.cpp */ 11 | 12 | //----------------[referenced from TextBox/TextBox.cpp]--------------// 13 | int font_draw(int x, int y, const char *text, int spacing, NXFont *font); 14 | 15 | 16 | /* located in sound/sound.cpp */ 17 | 18 | //----------------[referenced from TextBox/TextBox.cpp]--------------// 19 | void sound(int snd); 20 | 21 | -------------------------------------------------------------------------------- /nx/TextBox/YesNoPrompt.fdh: -------------------------------------------------------------------------------- 1 | //hash:70812d61 2 | //automatically generated by Makegen 3 | 4 | /* located in input.cpp */ 5 | 6 | //--------------[referenced from TextBox/YesNoPrompt.cpp]------------// 7 | bool justpushed(int k); 8 | 9 | 10 | /* located in sound/sound.cpp */ 11 | 12 | //--------------[referenced from TextBox/YesNoPrompt.cpp]------------// 13 | void sound(int snd); 14 | 15 | -------------------------------------------------------------------------------- /nx/TextBox/YesNoPrompt.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _YESNOPROMPT_H 3 | #define _YESNOPROMPT_H 4 | 5 | enum YNJResult 6 | { 7 | NO, 8 | YES 9 | }; 10 | 11 | class TB_YNJPrompt 12 | { 13 | public: 14 | void SetVisible(bool enable); 15 | void ResetState(); 16 | 17 | void Draw(); 18 | 19 | bool IsVisible() { return fVisible; } 20 | bool ResultReady(); // returns true if the user has selected a result 21 | int GetResult(); // returns YES or NO 22 | 23 | private: 24 | bool fVisible; 25 | struct { int y; } fCoords; 26 | 27 | int fState; 28 | int fTimer; 29 | 30 | int fAnswer; 31 | }; 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /nx/ai/IrregularBBox.fdh: -------------------------------------------------------------------------------- 1 | //hash:401a9d0e 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //---------------[referenced from ai/IrregularBBox.cpp]--------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in common/stat.cpp */ 11 | 12 | //---------------[referenced from ai/IrregularBBox.cpp]--------------// 13 | void staterr(const char *fmt, ...); 14 | 15 | -------------------------------------------------------------------------------- /nx/ai/IrregularBBox.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _IRREGULARBBOX_H 3 | #define _IRREGULARBBOX_H 4 | 5 | 6 | #define IB_MAX_BBOXES 4 7 | 8 | 9 | class IrregularBBox 10 | { 11 | public: 12 | bool init(Object *associatedObject, int max_rectangles); 13 | void destroy(); 14 | 15 | void set_damage(int dmg); 16 | void transmit_hits(); 17 | 18 | void place(void (*placefunc)(void *userparm), void *userparm); 19 | void set_bbox(int index, int x, int y, int w, int h, uint32_t flags); 20 | 21 | private: 22 | Object *bbox[IB_MAX_BBOXES]; 23 | int num_bboxes; 24 | Object *assoc_object; 25 | 26 | }; 27 | 28 | 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /nx/ai/almond/almond.fdh: -------------------------------------------------------------------------------- 1 | //hash:e7887cd2 2 | //automatically generated by Makegen 3 | 4 | /* located in ai/ai.cpp */ 5 | 6 | //---------------[referenced from ai/almond/almond.cpp]--------------// 7 | void ai_animate3(Object *o); 8 | 9 | 10 | /* located in ai/almond/almond.cpp */ 11 | 12 | //---------------[referenced from ai/almond/almond.cpp]--------------// 13 | void ai_waterlevel(Object *o); 14 | void ai_shutter(Object *o); 15 | void ai_shutter_stuck(Object *o); 16 | void ai_almond_robot(Object *o); 17 | 18 | 19 | /* located in ai/sym/smoke.cpp */ 20 | 21 | //---------------[referenced from ai/almond/almond.cpp]--------------// 22 | void SmokeSide(Object *o, int nclouds, int dir); 23 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 24 | 25 | 26 | /* located in sound/sound.cpp */ 27 | 28 | //---------------[referenced from ai/almond/almond.cpp]--------------// 29 | void sound(int snd); 30 | 31 | 32 | /* located in common/stat.cpp */ 33 | 34 | //---------------[referenced from ai/almond/almond.cpp]--------------// 35 | void stat(const char *fmt, ...); 36 | 37 | -------------------------------------------------------------------------------- /nx/ai/almond/almond.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _ALMOND_H 3 | #define _ALMOND_H 4 | 5 | // states to control the water-level object 6 | #define WL_CALM 10 // calm and slow at set point 7 | 8 | #define WL_CYCLE 20 // cycles between set point and top of screen 9 | #define WL_DOWN 21 // in cycle--currently down 10 | #define WL_UP 22 // in cycle--currently up 11 | 12 | #define WL_STAY_UP 30 // goes to top of screen and doesn't come back down 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /nx/ai/balrog_common.fdh: -------------------------------------------------------------------------------- 1 | //hash:0e6b9889 2 | //automatically generated by Makegen 3 | 4 | /* located in ai/balrog_common.cpp */ 5 | 6 | //---------------[referenced from ai/balrog_common.cpp]--------------// 7 | void balrog_grab_player(Object *o); 8 | bool balrog_toss_player_away(Object *o); 9 | 10 | 11 | /* located in sound/sound.cpp */ 12 | 13 | //---------------[referenced from ai/balrog_common.cpp]--------------// 14 | void sound(int snd); 15 | 16 | -------------------------------------------------------------------------------- /nx/ai/balrog_common.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BALROG_COMMON_H 3 | #define _BALROG_COMMON_H 4 | 5 | void balrog_grab_player(Object *o); 6 | bool balrog_toss_player_away(Object *o); 7 | 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /nx/ai/boss/balfrog.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BALFROG_H 3 | #define _BALFROG_H 4 | 5 | #include "../IrregularBBox.h" 6 | 7 | class BalfrogBoss : public StageBoss 8 | { 9 | public: 10 | void OnMapEntry(); 11 | void Run(); 12 | 13 | void place_bboxes(); 14 | 15 | private: 16 | void RunDeathAnim(); 17 | void RunEntryAnim(); 18 | 19 | void RunFighting(); 20 | void RunJumping(); 21 | void RunShooting(); 22 | 23 | void SetJumpingSprite(bool enable); 24 | void SpawnFrogs(int objtype, int count); 25 | void SpawnSmoke(int count, int ytop); 26 | 27 | void set_bbox(int index, int x, int y, int w, int h, uint32_t flags); 28 | void transmit_bbox_hits(Object *box); 29 | 30 | Object *o; 31 | 32 | struct 33 | { 34 | int shakeflash; 35 | 36 | int orighp; 37 | int shots_fired; 38 | int attackcounter; 39 | 40 | Object *balrog; // balrog puppet for death scene 41 | 42 | // our group of multiple bboxes to simulate our irregular bounding box. 43 | IrregularBBox bboxes; 44 | int bbox_mode; 45 | 46 | } frog; 47 | }; 48 | 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /nx/ai/boss/ballos.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BALLOS_H 3 | #define _BALLOS_H 4 | 5 | #define NUM_EYES 2 6 | enum TRIGDIR { LESS_THAN=0, GREATER_THAN=1 }; 7 | 8 | class BallosBoss : public StageBoss 9 | { 10 | public: 11 | void OnMapEntry(); 12 | void Run(); 13 | void RunAftermove(); 14 | 15 | private: 16 | void RunForm1(Object *o); 17 | void RunForm2(Object *o); 18 | void RunForm3(Object *o); 19 | void RunComeDown(Object *o); 20 | void RunDefeated(Object *o); 21 | 22 | void run_eye(int index); 23 | void place_eye(int index); 24 | void SetEyeStates(int newstate); 25 | 26 | bool passed_xcoord(bool ltgt, int xcoord, bool reset=false); 27 | bool passed_ycoord(bool ltgt, int ycoord, bool reset=false); 28 | 29 | Object *main; 30 | Object *body; 31 | Object *eye[NUM_EYES]; 32 | Object *shield; // top shield to cover eyes from above 33 | }; 34 | 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /nx/ai/boss/core.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _COREBOSS_H 3 | #define _COREBOSS_H 4 | 5 | class CoreBoss : public StageBoss 6 | { 7 | public: 8 | void OnMapEntry(); 9 | void OnMapExit(); 10 | void Run(); 11 | 12 | private: 13 | void RunOpenMouth(); 14 | 15 | void StartWaterStream(void); 16 | void StopWaterStream(void); 17 | 18 | Object *o; 19 | Object *pieces[8]; 20 | int hittimer; 21 | }; 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /nx/ai/boss/heavypress.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _HEAVYPRESS_H 3 | #define _HEAVYPRESS_H 4 | 5 | 6 | class HeavyPress : public StageBoss 7 | { 8 | public: 9 | void OnMapEntry(); 10 | void Run(); 11 | 12 | private: 13 | void run_defeated(); 14 | void run_passageway(); 15 | 16 | Object *o; 17 | Object *shield_left, *shield_right; 18 | 19 | int uncover_left, uncover_right; 20 | int uncover_y; 21 | 22 | SIFRect fullwidth_bbox; 23 | SIFRect center_bbox; 24 | }; 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /nx/ai/boss/ironhead.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _IRONHEAD_H 3 | #define _IRONHEAD_H 4 | 5 | class IronheadBoss : public StageBoss 6 | { 7 | public: 8 | void OnMapEntry(); 9 | void OnMapExit(); 10 | void Run(); 11 | 12 | private: 13 | Object *o; 14 | int hittimer; 15 | }; 16 | 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /nx/ai/boss/omega.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _OMEGA_H 3 | #define _OMEGA_H 4 | 5 | 6 | class OmegaBoss : public StageBoss 7 | { 8 | public: 9 | void OnMapEntry(); 10 | void OnMapExit(); 11 | 12 | void Run(); 13 | 14 | private: 15 | 16 | Object *pieces[4]; 17 | 18 | struct 19 | { 20 | int timer; 21 | int animtimer; 22 | 23 | int movedir, movetime; 24 | int nextstate; 25 | 26 | int form; 27 | 28 | int firefreq, startfiring, stopfiring, endfirestate, shotxspd; 29 | int firecounter; 30 | 31 | int leg_descend; 32 | 33 | int orgx, orgy; 34 | 35 | int shaketimer; 36 | int lasthp; 37 | 38 | bool defeated; 39 | } omg; 40 | 41 | }; 42 | 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /nx/ai/boss/sisters.fdh: -------------------------------------------------------------------------------- 1 | //hash:90d72648 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //----------------[referenced from ai/boss/sisters.cpp]--------------// 7 | Object *CreateObject(int x, int y, int type); 8 | bool hitdetect(Object *o1, Object *o2); 9 | 10 | 11 | /* located in trig.cpp */ 12 | 13 | //----------------[referenced from ai/boss/sisters.cpp]--------------// 14 | int xinertia_from_angle(uint8_t angle, int speed); 15 | int yinertia_from_angle(uint8_t angle, int speed); 16 | void EmFireAngledShot(Object *o, int objtype, int rand_variance, int speed); 17 | 18 | 19 | /* located in ai/ai.cpp */ 20 | 21 | //----------------[referenced from ai/boss/sisters.cpp]--------------// 22 | void KillObjectsOfType(int type); 23 | 24 | 25 | /* located in ai/sym/smoke.cpp */ 26 | 27 | //----------------[referenced from ai/boss/sisters.cpp]--------------// 28 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 29 | Object *SmokePuff(int x, int y); 30 | 31 | 32 | /* located in sound/sound.cpp */ 33 | 34 | //----------------[referenced from ai/boss/sisters.cpp]--------------// 35 | void sound(int snd); 36 | 37 | 38 | /* located in common/misc.cpp */ 39 | 40 | //----------------[referenced from ai/boss/sisters.cpp]--------------// 41 | int random(int min, int max); 42 | 43 | -------------------------------------------------------------------------------- /nx/ai/boss/sisters.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SISTERS_H 3 | #define _SISTERS_H 4 | 5 | // although you will need to add additional copies of the head sprites 6 | // for it to work properly, just try setting this number to something 7 | // like 10 and running the fight! 8 | #define NUM_SISTERS 2 9 | 10 | class SistersBoss : public StageBoss 11 | { 12 | public: 13 | void OnMapEntry(); 14 | void OnMapExit(); 15 | void Run(); 16 | 17 | private: 18 | void run_head(int index); 19 | void head_set_bbox(int index); 20 | void run_body(int index); 21 | 22 | void SetHeadStates(int newstate); 23 | void SetBodyStates(int newstate); 24 | 25 | void SpawnScreenSmoke(int count); 26 | 27 | int mainangle; 28 | 29 | Object *main; 30 | Object *head[NUM_SISTERS]; 31 | Object *body[NUM_SISTERS]; 32 | }; 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /nx/ai/boss/undead_core.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _UNDEADCORE_BOSS_H 3 | #define _UNDEADCORE_BOSS_H 4 | 5 | #define NUM_ROTATORS 4 6 | enum BBoxes { BB_UPPER, BB_BACK, BB_LOWER, BB_TARGET, NUM_BBOXES }; 7 | 8 | enum UD_Faces 9 | { 10 | FACE_SKULL, 11 | FACE_TEETH, 12 | FACE_MOUTH, 13 | FACE_MOUTH_LIT, 14 | FACE_NONE 15 | }; 16 | 17 | class UDCoreBoss : public StageBoss 18 | { 19 | public: 20 | void OnMapEntry(); 21 | void OnMapExit(); 22 | void Run(); 23 | void RunAftermove(); 24 | 25 | private: 26 | bool RunDefeated(); 27 | void SpawnFaceSmoke(); 28 | void SpawnPellet(int dir); 29 | void RunHurtFlash(int timer); 30 | 31 | void run_front(Object *o); 32 | void run_face(Object *o); 33 | void run_back(Object *o); 34 | 35 | void move_bboxes(); 36 | void set_bbox_shootable(bool enable); 37 | 38 | Object *create_rotator(int angle, int front); 39 | void run_rotator(Object *o); 40 | void SetRotatorStates(int newstate); 41 | 42 | Object *main; 43 | Object *front, *back; 44 | Object *face; 45 | 46 | Object *rotator[NUM_ROTATORS]; 47 | Object *bbox[NUM_BBOXES]; 48 | 49 | }; 50 | 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /nx/ai/boss/x.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _XBOSS_H 3 | #define _XBOSS_H 4 | 5 | enum XBDir 6 | { 7 | UL, UR, LL, LR 8 | }; 9 | 10 | class XBoss : public StageBoss 11 | { 12 | public: 13 | void OnMapEntry(); 14 | void OnMapExit(); 15 | void Run(); 16 | void RunAftermove(); 17 | 18 | private: 19 | void run_tread(int index); 20 | void run_body(int index); 21 | void run_door(int index); 22 | void run_target(int index); 23 | void run_fishy_spawner(int index); 24 | void run_internals(); 25 | 26 | bool AllTargetsDestroyed(); 27 | void Init(); 28 | Object *CreateTread(int x, int y, int sprite); 29 | Object *CreatePiece(int x, int y, int type); 30 | 31 | void SetStates(Object *objects[], int nobjects, int state); 32 | void SetDirs(Object *objects[], int nobjects, int dir); 33 | 34 | void DeleteMonster(); 35 | 36 | Object *mainobject; 37 | Object *body[4]; 38 | Object *treads[4]; 39 | Object *internals; 40 | Object *doors[2]; 41 | Object *targets[4]; 42 | Object *fishspawners[4]; 43 | 44 | Object *piecelist[24]; 45 | int npieces; 46 | 47 | struct 48 | { 49 | bool initilized; 50 | } X; 51 | }; 52 | 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /nx/ai/egg/egg.fdh: -------------------------------------------------------------------------------- 1 | //hash:b9ee0abd 2 | //automatically generated by Makegen 3 | 4 | /* located in trig.cpp */ 5 | 6 | //------------------[referenced from ai/egg/egg.cpp]-----------------// 7 | void EmFireAngledShot(Object *o, int objtype, int rand_variance, int speed); 8 | 9 | 10 | /* located in ai/ai.cpp */ 11 | 12 | //------------------[referenced from ai/egg/egg.cpp]-----------------// 13 | void ai_animate1(Object *o); 14 | 15 | 16 | /* located in ai/egg/egg.cpp */ 17 | 18 | //------------------[referenced from ai/egg/egg.cpp]-----------------// 19 | void ai_basil(Object *o); 20 | void ai_behemoth(Object *o); 21 | void ai_beetle_horiz(Object *o); 22 | void ai_beetle_freefly(Object *o); 23 | void ai_giant_beetle(Object *o); 24 | void ai_egg_elevator(Object *o); 25 | void ai_forcefield(Object *o); 26 | 27 | 28 | /* located in sound/sound.cpp */ 29 | 30 | //------------------[referenced from ai/egg/egg.cpp]-----------------// 31 | void sound(int snd); 32 | 33 | -------------------------------------------------------------------------------- /nx/ai/final_battle/doctor.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _DOCTOR_H 3 | #define _DOCTOR_H 4 | 5 | extern int crystal_xmark, crystal_ymark; 6 | extern bool crystal_tofront; 7 | 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /nx/ai/final_battle/doctor_common.fdh: -------------------------------------------------------------------------------- 1 | //hash:aec4f409 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //---------[referenced from ai/final_battle/doctor_common.cpp]-------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in ai/final_battle/doctor_common.cpp */ 11 | 12 | //---------[referenced from ai/final_battle/doctor_common.cpp]-------// 13 | Object *dr_create_red_crystal(int x, int y); 14 | void dr_tp_out_init(Object *o); 15 | bool dr_tp_out(Object *o); 16 | void dr_tp_in_init(Object *o); 17 | bool dr_tp_in(Object *o); 18 | 19 | 20 | /* located in sound/sound.cpp */ 21 | 22 | //---------[referenced from ai/final_battle/doctor_common.cpp]-------// 23 | void sound(int snd); 24 | 25 | -------------------------------------------------------------------------------- /nx/ai/final_battle/final_misc.fdh: -------------------------------------------------------------------------------- 1 | //hash:1c3a2075 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //----------[referenced from ai/final_battle/final_misc.cpp]---------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in ai/ai.cpp */ 11 | 12 | //----------[referenced from ai/final_battle/final_misc.cpp]---------// 13 | void DeleteObjectsOfType(int type); 14 | void randblink(Object *o, int blinkframe, int blinktime, int prob); 15 | 16 | 17 | /* located in ai/final_battle/final_misc.cpp */ 18 | 19 | //----------[referenced from ai/final_battle/final_misc.cpp]---------// 20 | void ai_doctor_ghost(Object *o); 21 | void ai_red_energy(Object *o); 22 | void ai_mimiga_caged(Object *o); 23 | 24 | 25 | /* located in common/misc.cpp */ 26 | 27 | //----------[referenced from ai/final_battle/final_misc.cpp]---------// 28 | int random(int min, int max); 29 | 30 | -------------------------------------------------------------------------------- /nx/ai/first_cave/first_cave.fdh: -------------------------------------------------------------------------------- 1 | //hash:3c4c85d2 2 | //automatically generated by Makegen 3 | 4 | /* located in ai/ai.cpp */ 5 | 6 | //-----------[referenced from ai/first_cave/first_cave.cpp]----------// 7 | void randblink(Object *o, int blinkframe, int blinktime, int prob); 8 | 9 | 10 | /* located in ai/first_cave/first_cave.cpp */ 11 | 12 | //-----------[referenced from ai/first_cave/first_cave.cpp]----------// 13 | void ai_bat_up_down(Object *o); 14 | void ai_hermit_gunsmith(Object *o); 15 | void ai_door_enemy(Object *o); 16 | 17 | 18 | /* located in ai/sand/puppy.cpp */ 19 | 20 | //-----------[referenced from ai/first_cave/first_cave.cpp]----------// 21 | void ai_zzzz_spawner(Object *o); 22 | 23 | 24 | /* located in common/misc.cpp */ 25 | 26 | //-----------[referenced from ai/first_cave/first_cave.cpp]----------// 27 | int random(int min, int max); 28 | 29 | -------------------------------------------------------------------------------- /nx/ai/maze/critter_purple.fdh: -------------------------------------------------------------------------------- 1 | //hash:ef256ea0 2 | //automatically generated by Makegen 3 | 4 | /* located in trig.cpp */ 5 | 6 | //------------[referenced from ai/maze/critter_purple.cpp]-----------// 7 | void EmFireAngledShot(Object *o, int objtype, int rand_variance, int speed); 8 | 9 | 10 | /* located in ai/maze/critter_purple.cpp */ 11 | 12 | //------------[referenced from ai/maze/critter_purple.cpp]-----------// 13 | void ai_critter_shooting_purple(Object *o); 14 | 15 | 16 | /* located in sound/sound.cpp */ 17 | 18 | //------------[referenced from ai/maze/critter_purple.cpp]-----------// 19 | void sound(int snd); 20 | 21 | -------------------------------------------------------------------------------- /nx/ai/maze/gaudi.fdh: -------------------------------------------------------------------------------- 1 | //hash:f9425f6f 2 | //automatically generated by Makegen 3 | 4 | /* located in caret.cpp */ 5 | 6 | //-----------------[referenced from ai/maze/gaudi.cpp]---------------// 7 | Caret *effect(int x, int y, int effectno); 8 | 9 | 10 | /* located in trig.cpp */ 11 | 12 | //-----------------[referenced from ai/maze/gaudi.cpp]---------------// 13 | void vector_from_angle(uint8_t angle, int speed, int *xs, int *ys); 14 | void EmFireAngledShot(Object *o, int objtype, int rand_variance, int speed); 15 | 16 | 17 | /* located in ai/ai.cpp */ 18 | 19 | //-----------------[referenced from ai/maze/gaudi.cpp]---------------// 20 | void randblink(Object *o, int blinkframe, int blinktime, int prob); 21 | 22 | 23 | /* located in ai/maze/gaudi.cpp */ 24 | 25 | //-----------------[referenced from ai/maze/gaudi.cpp]---------------// 26 | void ai_gaudi(Object *o); 27 | void ai_gaudi_dying(Object *o); 28 | void ai_gaudi_flying(Object *o); 29 | void ai_gaudi_armored(Object *o); 30 | void ai_gaudi_armored_shot(Object *o); 31 | 32 | 33 | /* located in sound/sound.cpp */ 34 | 35 | //-----------------[referenced from ai/maze/gaudi.cpp]---------------// 36 | void sound(int snd); 37 | 38 | 39 | /* located in common/misc.cpp */ 40 | 41 | //-----------------[referenced from ai/maze/gaudi.cpp]---------------// 42 | int random(int min, int max); 43 | 44 | -------------------------------------------------------------------------------- /nx/ai/maze/maze.fdh: -------------------------------------------------------------------------------- 1 | //hash:c7e432c2 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //-----------------[referenced from ai/maze/maze.cpp]----------------// 7 | void quake(int quaketime, int snd); 8 | 9 | 10 | /* located in ai/maze/maze.cpp */ 11 | 12 | //-----------------[referenced from ai/maze/maze.cpp]----------------// 13 | void ai_block_moveh(Object *o); 14 | void ai_block_movev(Object *o); 15 | void ai_boulder(Object *o); 16 | 17 | 18 | /* located in ai/sym/smoke.cpp */ 19 | 20 | //-----------------[referenced from ai/maze/maze.cpp]----------------// 21 | void SmokeSide(Object *o, int nclouds, int dir); 22 | 23 | 24 | /* located in sound/sound.cpp */ 25 | 26 | //-----------------[referenced from ai/maze/maze.cpp]----------------// 27 | void sound(int snd); 28 | 29 | -------------------------------------------------------------------------------- /nx/ai/npc/curly.fdh: -------------------------------------------------------------------------------- 1 | //hash:d9c51670 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //-----------------[referenced from ai/npc/curly.cpp]----------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in map.cpp */ 11 | 12 | //-----------------[referenced from ai/npc/curly.cpp]----------------// 13 | Object *FindObjectByID2(int id2); 14 | 15 | 16 | /* located in p_arms.cpp */ 17 | 18 | //-----------------[referenced from ai/npc/curly.cpp]----------------// 19 | void SetupBullet(Object *shot, int x, int y, int btype, int dir); 20 | 21 | 22 | /* located in ai/ai.cpp */ 23 | 24 | //-----------------[referenced from ai/npc/curly.cpp]----------------// 25 | void StickToPlayer(Object *o, int x_left, int x_right, int off_y); 26 | 27 | 28 | /* located in ai/npc/curly.cpp */ 29 | 30 | //-----------------[referenced from ai/npc/curly.cpp]----------------// 31 | void ai_curly(Object *o); 32 | void aftermove_curly_carried(Object *o); 33 | void ai_curly_carried_shooting(Object *o); 34 | void ai_ccs_gun(Object *o); 35 | 36 | 37 | /* located in ai/sym/smoke.cpp */ 38 | 39 | //-----------------[referenced from ai/npc/curly.cpp]----------------// 40 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 41 | 42 | -------------------------------------------------------------------------------- /nx/ai/npc/curly_ai.fdh: -------------------------------------------------------------------------------- 1 | //hash:c172b805 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //----------------[referenced from ai/npc/curly_ai.cpp]--------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in p_arms.cpp */ 11 | 12 | //----------------[referenced from ai/npc/curly_ai.cpp]--------------// 13 | void FireLevel23MGun(int x, int y, int level, int dir); 14 | void SetupBullet(Object *shot, int x, int y, int btype, int dir); 15 | 16 | 17 | /* located in ai/npc/curly_ai.cpp */ 18 | 19 | //----------------[referenced from ai/npc/curly_ai.cpp]--------------// 20 | void ai_curly_ai(Object *o); 21 | static void CaiJUMP(Object *o); 22 | void ai_cai_gun(Object *o); 23 | void aftermove_cai_gun(Object *o); 24 | void aftermove_cai_watershield(Object *o); 25 | 26 | 27 | /* located in sound/sound.cpp */ 28 | 29 | //----------------[referenced from ai/npc/curly_ai.cpp]--------------// 30 | void sound(int snd); 31 | 32 | 33 | /* located in common/misc.cpp */ 34 | 35 | //----------------[referenced from ai/npc/curly_ai.cpp]--------------// 36 | int random(int min, int max); 37 | 38 | -------------------------------------------------------------------------------- /nx/ai/npc/npcguest.fdh: -------------------------------------------------------------------------------- 1 | //hash:156aa096 2 | //automatically generated by Makegen 3 | 4 | /* located in ai/ai.cpp */ 5 | 6 | //----------------[referenced from ai/npc/npcguest.cpp]--------------// 7 | void randblink(Object *o, int blinkframe, int blinktime, int prob); 8 | 9 | 10 | /* located in ai/npc/npcguest.cpp */ 11 | 12 | //----------------[referenced from ai/npc/npcguest.cpp]--------------// 13 | void ai_chthulu(Object *o); 14 | void ai_npc_mahin(Object *o); 15 | void ai_yamashita_pavilion(Object *o); 16 | 17 | -------------------------------------------------------------------------------- /nx/ai/npc/npcplayer.fdh: -------------------------------------------------------------------------------- 1 | //hash:6572894a 2 | //automatically generated by Makegen 3 | 4 | /* located in tsc.cpp */ 5 | 6 | //---------------[referenced from ai/npc/npcplayer.cpp]--------------// 7 | int CVTDir(int csdir); 8 | 9 | 10 | /* located in ai/ai.cpp */ 11 | 12 | //---------------[referenced from ai/npc/npcplayer.cpp]--------------// 13 | bool DoTeleportOut(Object *o, int slowness); 14 | bool DoTeleportIn(Object *o, int slowness); 15 | 16 | 17 | /* located in ai/npc/npcplayer.cpp */ 18 | 19 | //---------------[referenced from ai/npc/npcplayer.cpp]--------------// 20 | void ai_npc_player(Object *o); 21 | void ai_ptelin(Object *o); 22 | void ai_ptelout(Object *o); 23 | 24 | 25 | /* located in ai/sym/smoke.cpp */ 26 | 27 | //---------------[referenced from ai/npc/npcplayer.cpp]--------------// 28 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 29 | 30 | 31 | /* located in sound/sound.cpp */ 32 | 33 | //---------------[referenced from ai/npc/npcplayer.cpp]--------------// 34 | void sound(int snd); 35 | 36 | 37 | /* located in common/misc.cpp */ 38 | 39 | //---------------[referenced from ai/npc/npcplayer.cpp]--------------// 40 | int random(int min, int max); 41 | 42 | -------------------------------------------------------------------------------- /nx/ai/oside/oside.fdh: -------------------------------------------------------------------------------- 1 | //hash:10bf31fc 2 | //automatically generated by Makegen 3 | 4 | /* located in ai/ai.cpp */ 5 | 6 | //----------------[referenced from ai/oside/oside.cpp]---------------// 7 | Object *SpawnObjectAtActionPoint(Object *o, int otype); 8 | 9 | 10 | /* located in ai/oside/oside.cpp */ 11 | 12 | //----------------[referenced from ai/oside/oside.cpp]---------------// 13 | void ai_night_spirit(Object *o); 14 | void ai_night_spirit_shot(Object *o); 15 | void ai_hoppy(Object *o); 16 | void ai_sky_dragon(Object *o); 17 | void ai_pixel_cat(Object *o); 18 | void ai_little_family(Object *o); 19 | 20 | 21 | /* located in ai/sym/smoke.cpp */ 22 | 23 | //----------------[referenced from ai/oside/oside.cpp]---------------// 24 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 25 | 26 | 27 | /* located in sound/sound.cpp */ 28 | 29 | //----------------[referenced from ai/oside/oside.cpp]---------------// 30 | void sound(int snd); 31 | 32 | 33 | /* located in common/misc.cpp */ 34 | 35 | //----------------[referenced from ai/oside/oside.cpp]---------------// 36 | int random(int min, int max); 37 | 38 | -------------------------------------------------------------------------------- /nx/ai/sand/puppy.fdh: -------------------------------------------------------------------------------- 1 | //hash:a6684331 2 | //automatically generated by Makegen 3 | 4 | /* located in caret.cpp */ 5 | 6 | //-----------------[referenced from ai/sand/puppy.cpp]---------------// 7 | Caret *effect(int x, int y, int effectno); 8 | 9 | 10 | /* located in ai/ai.cpp */ 11 | 12 | //-----------------[referenced from ai/sand/puppy.cpp]---------------// 13 | void randblink(Object *o, int blinkframe, int blinktime, int prob); 14 | void StickToPlayer(Object *o, int x_left, int x_right, int off_y); 15 | 16 | 17 | /* located in ai/sand/puppy.cpp */ 18 | 19 | //-----------------[referenced from ai/sand/puppy.cpp]---------------// 20 | void ai_puppy_wag(Object *o); 21 | void ai_puppy_bark(Object *o); 22 | void ai_zzzz_spawner(Object *o); 23 | void ai_puppy_run(Object *o); 24 | void aftermove_puppy_carry(Object *o); 25 | 26 | 27 | /* located in sound/sound.cpp */ 28 | 29 | //-----------------[referenced from ai/sand/puppy.cpp]---------------// 30 | void sound(int snd); 31 | 32 | 33 | /* located in common/misc.cpp */ 34 | 35 | //-----------------[referenced from ai/sand/puppy.cpp]---------------// 36 | int random(int min, int max); 37 | 38 | -------------------------------------------------------------------------------- /nx/ai/stdai.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _STDAI_H 3 | #define _STDAI_H 4 | 5 | #include "../nx.h" 6 | 7 | extern InitList AIRoutines; 8 | 9 | #define ONTICK(OBJTYPE, FUNCTION) objprop[OBJTYPE].ai_routines.ontick = FUNCTION; 10 | #define ONDEATH(OBJTYPE, FUNCTION) objprop[OBJTYPE].ai_routines.ondeath = FUNCTION; 11 | #define AFTERMOVE(OBJTYPE, FUNCTION) objprop[OBJTYPE].ai_routines.aftermove = FUNCTION; 12 | #define ONSPAWN(OBJTYPE, FUNCTION) objprop[OBJTYPE].ai_routines.onspawn = FUNCTION; 13 | 14 | #define GENERIC_NPC(O) \ 15 | { \ 16 | ONSPAWN(O, onspawn_generic_npc); \ 17 | ONTICK(O, ai_generic_npc); \ 18 | } 19 | 20 | #define GENERIC_NPC_NOFACEPLAYER(O) \ 21 | { \ 22 | ONSPAWN(O, onspawn_generic_npc); \ 23 | ONTICK(O, ai_generic_npc_nofaceplayer); \ 24 | } 25 | 26 | void aftermove_StickToLinkedActionPoint(Object *o); 27 | void onspawn_set_frame_from_id2(Object *o); 28 | void onspawn_snap_to_ground(Object *o); 29 | void ai_generic_angled_shot(Object *o); 30 | 31 | void ai_generic_npc(Object *o); 32 | void ai_generic_npc_nofaceplayer(Object *o); 33 | void onspawn_generic_npc(Object *o); 34 | 35 | void ai_animate1(Object *o); 36 | void ai_animate2(Object *o); 37 | void ai_animate3(Object *o); 38 | void ai_animate4(Object *o); 39 | void ai_animate5(Object *o); 40 | 41 | void KillObjectsOfType(int type); 42 | void DeleteObjectsOfType(int type); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /nx/ai/sym/smoke.fdh: -------------------------------------------------------------------------------- 1 | //hash:19c7b1dc 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //-----------------[referenced from ai/sym/smoke.cpp]----------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in trig.cpp */ 11 | 12 | //-----------------[referenced from ai/sym/smoke.cpp]----------------// 13 | void vector_from_angle(uint8_t angle, int speed, int *xs, int *ys); 14 | 15 | 16 | /* located in ai/sym/smoke.cpp */ 17 | 18 | //-----------------[referenced from ai/sym/smoke.cpp]----------------// 19 | Object *SmokePuff(int x, int y); 20 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 21 | void SmokeXY(int x, int y, int nclouds, int rangex, int rangey, Object *push_behind); 22 | void SmokeSide(Object *o, int nclouds, int dir); 23 | void SmokeCloudsSlow(int x, int y, int nclouds); 24 | void SmokeBoomUp(Object *o); 25 | void ai_smokecloud(Object *o); 26 | 27 | 28 | /* located in common/misc.cpp */ 29 | 30 | //-----------------[referenced from ai/sym/smoke.cpp]----------------// 31 | int random(int min, int max); 32 | 33 | -------------------------------------------------------------------------------- /nx/ai/village/balrog_boss_running.fdh: -------------------------------------------------------------------------------- 1 | //hash:01c3aee9 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //--------[referenced from ai/village/balrog_boss_running.cpp]-------// 7 | void quake(int quaketime, int snd); 8 | 9 | 10 | /* located in player.cpp */ 11 | 12 | //--------[referenced from ai/village/balrog_boss_running.cpp]-------// 13 | void hurtplayer(int damage); 14 | 15 | 16 | /* located in ai/village/balrog_boss_running.cpp */ 17 | 18 | //--------[referenced from ai/village/balrog_boss_running.cpp]-------// 19 | void ai_balrog_boss_running(Object *o); 20 | static void walking_animation(Object *o); 21 | void ondeath_balrog_boss_running(Object *o); 22 | 23 | 24 | /* located in ai/maze/balrog_boss_missiles.cpp */ 25 | 26 | //--------[referenced from ai/village/balrog_boss_running.cpp]-------// 27 | static void walking_animation(Object *o); 28 | 29 | 30 | /* located in ai/balrog_common.cpp */ 31 | 32 | //--------[referenced from ai/village/balrog_boss_running.cpp]-------// 33 | void balrog_grab_player(Object *o); 34 | bool balrog_toss_player_away(Object *o); 35 | 36 | 37 | /* located in sound/sound.cpp */ 38 | 39 | //--------[referenced from ai/village/balrog_boss_running.cpp]-------// 40 | void sound(int snd); 41 | 42 | -------------------------------------------------------------------------------- /nx/ai/village/village.fdh: -------------------------------------------------------------------------------- 1 | //hash:8be69c8c 2 | //automatically generated by Makegen 3 | 4 | /* located in ai/village/village.cpp */ 5 | 6 | //--------------[referenced from ai/village/village.cpp]-------------// 7 | void ai_toroko_shack(Object *o); 8 | void ai_mushroom_enemy(Object *o); 9 | void ai_gravekeeper(Object *o); 10 | void ai_cage(Object *o); 11 | 12 | 13 | /* located in sound/sound.cpp */ 14 | 15 | //--------------[referenced from ai/village/village.cpp]-------------// 16 | void sound(int snd); 17 | 18 | 19 | /* located in common/misc.cpp */ 20 | 21 | //--------------[referenced from ai/village/village.cpp]-------------// 22 | int random(int min, int max); 23 | 24 | -------------------------------------------------------------------------------- /nx/ai/weapons/blade.fdh: -------------------------------------------------------------------------------- 1 | //hash:90bd36fc 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //---------------[referenced from ai/weapons/blade.cpp]--------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in ai/weapons/weapons.cpp */ 11 | 12 | //---------------[referenced from ai/weapons/blade.cpp]--------------// 13 | void shot_dissipate(Object *o, int effectno); 14 | Object *damage_enemies(Object *o, uint32_t flags_to_exclude); 15 | void shot_spawn_effect(Object *o, int effectno); 16 | bool IsBlockedInShotDir(Object *o); 17 | bool shot_destroy_blocks(Object *o); 18 | 19 | 20 | /* located in ai/weapons/blade.cpp */ 21 | 22 | //---------------[referenced from ai/weapons/blade.cpp]--------------// 23 | void ai_blade_l3_shot(Object *o); 24 | void aftermove_blade_slash(Object *o); 25 | void aftermove_blade_l12_shot(Object *o); 26 | 27 | 28 | /* located in sound/sound.cpp */ 29 | 30 | //---------------[referenced from ai/weapons/blade.cpp]--------------// 31 | void sound(int snd); 32 | 33 | 34 | /* located in common/misc.cpp */ 35 | 36 | //---------------[referenced from ai/weapons/blade.cpp]--------------// 37 | int random(int min, int max); 38 | 39 | -------------------------------------------------------------------------------- /nx/ai/weapons/bubbler.fdh: -------------------------------------------------------------------------------- 1 | //hash:5ebaab6e 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //--------------[referenced from ai/weapons/bubbler.cpp]-------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in caret.cpp */ 11 | 12 | //--------------[referenced from ai/weapons/bubbler.cpp]-------------// 13 | Caret *effect(int x, int y, int effectno); 14 | 15 | 16 | /* located in ai/weapons/weapons.cpp */ 17 | 18 | //--------------[referenced from ai/weapons/bubbler.cpp]-------------// 19 | Object *damage_enemies(Object *o, uint32_t flags_to_exclude); 20 | bool IsBlockedInShotDir(Object *o); 21 | void shot_dissipate(Object *o, int effectno); 22 | uint8_t run_shot(Object *o, bool destroys_blocks); 23 | 24 | 25 | /* located in ai/weapons/bubbler.cpp */ 26 | 27 | //--------------[referenced from ai/weapons/bubbler.cpp]-------------// 28 | void ai_bubbler_l12(Object *o); 29 | void ai_bubbler_l3(Object *o); 30 | void ai_bubbler_sharp(Object *o); 31 | 32 | 33 | /* located in sound/sound.cpp */ 34 | 35 | //--------------[referenced from ai/weapons/bubbler.cpp]-------------// 36 | void sound(int snd); 37 | 38 | 39 | /* located in common/misc.cpp */ 40 | 41 | //--------------[referenced from ai/weapons/bubbler.cpp]-------------// 42 | int random(int min, int max); 43 | 44 | -------------------------------------------------------------------------------- /nx/ai/weapons/fireball.fdh: -------------------------------------------------------------------------------- 1 | //hash:b87b3dad 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //--------------[referenced from ai/weapons/fireball.cpp]------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in ai/weapons/weapons.cpp */ 11 | 12 | //--------------[referenced from ai/weapons/fireball.cpp]------------// 13 | void shot_dissipate(Object *o, int effectno); 14 | Object *check_hit_enemy(Object *shot, uint32_t flags_to_exclude); 15 | 16 | 17 | /* located in ai/weapons/fireball.cpp */ 18 | 19 | //--------------[referenced from ai/weapons/fireball.cpp]------------// 20 | void ai_fireball(Object *o); 21 | void ai_fireball_level_23(Object *o); 22 | Object *create_fire_trail(Object *o, int objtype, int level); 23 | void ai_fireball_trail(Object *o); 24 | 25 | 26 | /* located in sound/sound.cpp */ 27 | 28 | //--------------[referenced from ai/weapons/fireball.cpp]------------// 29 | void sound(int snd); 30 | 31 | -------------------------------------------------------------------------------- /nx/ai/weapons/nemesis.fdh: -------------------------------------------------------------------------------- 1 | //hash:8e5ea205 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //--------------[referenced from ai/weapons/nemesis.cpp]-------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in ai/weapons/weapons.cpp */ 11 | 12 | //--------------[referenced from ai/weapons/nemesis.cpp]-------------// 13 | uint8_t run_shot(Object *o, bool destroys_blocks); 14 | 15 | 16 | /* located in ai/weapons/nemesis.cpp */ 17 | 18 | //--------------[referenced from ai/weapons/nemesis.cpp]-------------// 19 | void ai_nemesis_shot(Object *o); 20 | 21 | 22 | /* located in common/misc.cpp */ 23 | 24 | //--------------[referenced from ai/weapons/nemesis.cpp]-------------// 25 | int random(int min, int max); 26 | 27 | -------------------------------------------------------------------------------- /nx/ai/weapons/polar_mgun.fdh: -------------------------------------------------------------------------------- 1 | //hash:646e2d68 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //-------------[referenced from ai/weapons/polar_mgun.cpp]-----------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in p_arms.cpp */ 11 | 12 | //-------------[referenced from ai/weapons/polar_mgun.cpp]-----------// 13 | void SetupBullet(Object *shot, int x, int y, int btype, int dir); 14 | 15 | 16 | /* located in ai/weapons/weapons.cpp */ 17 | 18 | //-------------[referenced from ai/weapons/polar_mgun.cpp]-----------// 19 | Object *damage_enemies(Object *o, uint32_t flags_to_exclude); 20 | bool IsBlockedInShotDir(Object *o); 21 | void shot_spawn_effect(Object *o, int effectno); 22 | bool shot_destroy_blocks(Object *o); 23 | 24 | 25 | /* located in ai/weapons/polar_mgun.cpp */ 26 | 27 | //-------------[referenced from ai/weapons/polar_mgun.cpp]-----------// 28 | void ai_polar_shot(Object *o); 29 | void ai_mgun_trail(Object *o); 30 | void ai_mgun_spawner(Object *o); 31 | 32 | 33 | /* located in sound/sound.cpp */ 34 | 35 | //-------------[referenced from ai/weapons/polar_mgun.cpp]-----------// 36 | void sound(int snd); 37 | 38 | -------------------------------------------------------------------------------- /nx/ai/weapons/snake.fdh: -------------------------------------------------------------------------------- 1 | //hash:e16efd5e 2 | //automatically generated by Makegen 3 | 4 | /* located in ai/weapons/weapons.cpp */ 5 | 6 | //---------------[referenced from ai/weapons/snake.cpp]--------------// 7 | void shot_dissipate(Object *o, int effectno); 8 | Object *damage_enemies(Object *o, uint32_t flags_to_exclude); 9 | 10 | 11 | /* located in ai/weapons/fireball.cpp */ 12 | 13 | //---------------[referenced from ai/weapons/snake.cpp]--------------// 14 | Object *create_fire_trail(Object *o, int objtype, int level); 15 | 16 | 17 | /* located in ai/weapons/snake.cpp */ 18 | 19 | //---------------[referenced from ai/weapons/snake.cpp]--------------// 20 | void ai_snake(Object *o); 21 | void ai_snake_23(Object *o); 22 | void ai_snake_trail(Object *o); 23 | 24 | 25 | /* located in common/misc.cpp */ 26 | 27 | //---------------[referenced from ai/weapons/snake.cpp]--------------// 28 | int random(int min, int max); 29 | 30 | -------------------------------------------------------------------------------- /nx/ai/weapons/spur.fdh: -------------------------------------------------------------------------------- 1 | //hash:f4f572b1 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //----------------[referenced from ai/weapons/spur.cpp]--------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in ai/weapons/weapons.cpp */ 11 | 12 | //----------------[referenced from ai/weapons/spur.cpp]--------------// 13 | bool IsBlockedInShotDir(Object *o); 14 | bool shot_destroy_blocks(Object *o); 15 | void shot_spawn_effect(Object *o, int effectno); 16 | Object *damage_enemies(Object *o, uint32_t flags_to_exclude); 17 | 18 | 19 | /* located in ai/weapons/spur.cpp */ 20 | 21 | //----------------[referenced from ai/weapons/spur.cpp]--------------// 22 | void ai_spur_shot(Object *o); 23 | static void spur_spawn_trail(Object *o); 24 | void ai_spur_trail(Object *o); 25 | 26 | 27 | /* located in sound/sound.cpp */ 28 | 29 | //----------------[referenced from ai/weapons/spur.cpp]--------------// 30 | void sound(int snd); 31 | 32 | -------------------------------------------------------------------------------- /nx/ai/weapons/weapons.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _WEAPONS_H 3 | #define _WEAPONS_H 4 | 5 | #include "../stdai.h" 6 | 7 | uint8_t run_shot(Object *o, bool destroys_blocks); 8 | enum run_shot_result 9 | { 10 | RS_NONE = 0, 11 | RS_HIT_ENEMY, 12 | RS_HIT_WALL, 13 | RS_TTL_EXPIRED 14 | }; 15 | 16 | Object *check_hit_enemy(Object *o, uint32_t flags_to_exclude=0); 17 | Object *damage_enemies(Object *o, uint32_t flags_to_exclude=0); 18 | int damage_multiple_enemies(Object *o, uint32_t flags_to_exclude=0); 19 | 20 | void shot_spawn_effect(Object *o, int effectno); 21 | void shot_dissipate(Object *o, int effectno = EFFECT_STARPOOF); 22 | bool shot_destroy_blocks(Object *o); 23 | 24 | bool IsBlockedInShotDir(Object *o); 25 | 26 | // --------------------------------------- 27 | 28 | // from Fireball code, shared with Snake 29 | Object *create_fire_trail(Object *o, int objtype, int level); 30 | 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /nx/ai/weapons/whimstar.fdh: -------------------------------------------------------------------------------- 1 | //hash:cbbcdfc9 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //--------------[referenced from ai/weapons/whimstar.cpp]------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in caret.cpp */ 11 | 12 | //--------------[referenced from ai/weapons/whimstar.cpp]------------// 13 | Caret *effect(int x, int y, int effectno); 14 | 15 | 16 | /* located in ai/weapons/weapons.cpp */ 17 | 18 | //--------------[referenced from ai/weapons/whimstar.cpp]------------// 19 | Object *check_hit_enemy(Object *shot, uint32_t flags_to_exclude); 20 | 21 | 22 | /* located in ai/weapons/whimstar.cpp */ 23 | 24 | //--------------[referenced from ai/weapons/whimstar.cpp]------------// 25 | void init_whimstar(WhimsicalStar *wh); 26 | void add_whimstar(WhimsicalStar *wh); 27 | void remove_whimstar(WhimsicalStar *wh); 28 | void run_whimstar(WhimsicalStar *wh); 29 | void draw_whimstars(WhimsicalStar *wh); 30 | void ai_whimsical_star(Object *o); 31 | 32 | 33 | /* located in sound/sound.cpp */ 34 | 35 | //--------------[referenced from ai/weapons/whimstar.cpp]------------// 36 | void sound(int snd); 37 | 38 | -------------------------------------------------------------------------------- /nx/ai/weapons/whimstar.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _WHIMSTAR_H 3 | #define _WHIMSTAR_H 4 | 5 | 6 | #define MAX_WHIMSTARS 3 7 | 8 | struct Whimstar 9 | { 10 | int x, y; 11 | int xinertia, yinertia; 12 | }; 13 | 14 | struct WhimsicalStar 15 | { 16 | Whimstar stars[MAX_WHIMSTARS]; 17 | int nstars; 18 | int stariter; 19 | }; 20 | 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /nx/ai/weed/frenzied_mimiga.fdh: -------------------------------------------------------------------------------- 1 | //hash:f0cdb4ba 2 | //automatically generated by Makegen 3 | 4 | /* located in ai/weed/frenzied_mimiga.cpp */ 5 | 6 | //------------[referenced from ai/weed/frenzied_mimiga.cpp]----------// 7 | void ai_frenzied_mimiga(Object *o); 8 | 9 | 10 | /* located in ai/sym/smoke.cpp */ 11 | 12 | //------------[referenced from ai/weed/frenzied_mimiga.cpp]----------// 13 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 14 | 15 | 16 | /* located in sound/sound.cpp */ 17 | 18 | //------------[referenced from ai/weed/frenzied_mimiga.cpp]----------// 19 | void sound(int snd); 20 | 21 | -------------------------------------------------------------------------------- /nx/autogen/AssignSprites.fdh: -------------------------------------------------------------------------------- 1 | //hash:fc79b590 2 | //automatically generated by Makegen 3 | 4 | /* located in autogen/AssignSprites.cpp */ 5 | 6 | //-------------[referenced from autogen/AssignSprites.cpp]-----------// 7 | void AssignSprites(void); 8 | 9 | -------------------------------------------------------------------------------- /nx/autogen/asdefs.h: -------------------------------------------------------------------------------- 1 | 2 | // this is a small file that tells AssignSprites.cpp how to do it's job, 3 | // like glue that links it with the rest of the project in a project-independent way. 4 | #include "../nx.h" 5 | 6 | #define ASSIGN_SPRITE(OBJECT, SPRITE) \ 7 | objprop[OBJECT].sprite = SPRITE; 8 | -------------------------------------------------------------------------------- /nx/autogen/objnames.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /nx/autogen/stagedata.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /nx/buildscript: -------------------------------------------------------------------------------- 1 | makegen 2 | make -j4 3 | %nx -------------------------------------------------------------------------------- /nx/caret.fdh: -------------------------------------------------------------------------------- 1 | //hash:1ea42078 2 | //automatically generated by Makegen 3 | 4 | /* located in caret.cpp */ 5 | 6 | //---------------------[referenced from caret.cpp]-------------------// 7 | Caret *CreateCaret(int x, int y, int sprite, void (*ontick)(Caret *c), int xinertia, int yinertia); 8 | Caret *effect(int x, int y, int effectno); 9 | void caret_animate1(Caret *c); 10 | void caret_animate2(Caret *c); 11 | void caret_animate3(Caret *c); 12 | void caret_bonkplus(Caret *c); 13 | void caret_fishy(Caret *c); 14 | void caret_spur_hit(Caret *c); 15 | void caret_playertext(Caret *c); 16 | void caret_qmark(Caret *c); 17 | void caret_bonusflash(Caret *c); 18 | void caret_hey(Caret *c); 19 | void caret_gunfish_bubble(Caret *c); 20 | void caret_ghost_sparkle(Caret *c); 21 | void caret_zzzz(Caret *c); 22 | 23 | 24 | /* located in trig.cpp */ 25 | 26 | //---------------------[referenced from caret.cpp]-------------------// 27 | void vector_from_angle(uint8_t angle, int speed, int *xs, int *ys); 28 | 29 | 30 | /* located in common/stat.cpp */ 31 | 32 | //---------------------[referenced from caret.cpp]-------------------// 33 | void staterr(const char *fmt, ...); 34 | 35 | 36 | /* located in common/misc.cpp */ 37 | 38 | //---------------------[referenced from caret.cpp]-------------------// 39 | int random(int min, int max); 40 | 41 | -------------------------------------------------------------------------------- /nx/common/BList.fdh: -------------------------------------------------------------------------------- 1 | //hash:57950a83 2 | //automatically generated by Makegen 3 | 4 | /* located in common/BList.cpp */ 5 | 6 | //-----------------[referenced from common/BList.cpp]----------------// 7 | move_items(void** items, int32 offset, int32 count); 8 | || (toIndex < 0)); 9 | AddList__5BListP5BListl(BList* self, BList* list, int32 index); 10 | AddList__5BListP5BList(BList* self, BList* list); 11 | 12 | -------------------------------------------------------------------------------- /nx/common/DBuffer.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /nx/common/DString.fdh: -------------------------------------------------------------------------------- 1 | //hash:aa5032f8 2 | //automatically generated by Makegen 3 | 4 | /* located in tsc.cpp */ 5 | 6 | //----------------[referenced from common/DString.cpp]---------------// 7 | void Clear(); 8 | 9 | -------------------------------------------------------------------------------- /nx/common/DString.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _DSTRING_H 3 | #define _DSTRING_H 4 | 5 | #include "basics.h" 6 | #include "DBuffer.h" 7 | 8 | /* 9 | DString vs. DBuffer 10 | 11 | The difference is that with a DBuffer, if you AppendString() multiple times, 12 | you will get null-terminators in between each string. With a DString, 13 | the strings will be concatenated. You can override this behavior in a DBuffer 14 | by calling AppendStringNoNull instead of AppendString, but there is no function 15 | for inserting NULLs into a DString, as that doesn't make sense. 16 | */ 17 | 18 | class DString 19 | { 20 | public: 21 | DString(); 22 | DString(const char *string); 23 | DString(const char *string, int length); 24 | DString(DString &other); 25 | 26 | void SetTo(const char *string); 27 | void SetTo(const char *string, int length); 28 | void SetTo(DString *other); 29 | void SetTo(DString &other); 30 | 31 | void AppendString(const char *str); 32 | void AppendString(const char *str, int length); 33 | void AppendChar(uchar ch); 34 | 35 | void ReplaceString(const char *repstr_old, const char *repstr_new); 36 | void EnsureAlloc(int min_required); 37 | 38 | void Clear(); 39 | char *String(); 40 | int Length(); 41 | 42 | void ReplaceUnprintableChars(); 43 | 44 | private: 45 | DBuffer fBuffer; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /nx/common/FileBuffer.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "FileBuffer.h" 4 | 5 | FileBuffer::FileBuffer() 6 | { 7 | fMaxSize = 0; 8 | fFP = NULL; 9 | } 10 | 11 | void FileBuffer::SetBufferSize(int maxsize) 12 | { 13 | fMaxSize = maxsize; 14 | } 15 | 16 | void FileBuffer::SetFile(FILE *fp) 17 | { 18 | fFP = fp; 19 | } 20 | 21 | /* 22 | void c------------------------------() {} 23 | */ 24 | 25 | void FileBuffer::Write8(uint8_t data) 26 | { 27 | fBuffer.Append8(data); 28 | CheckFlush(fMaxSize); 29 | } 30 | 31 | void FileBuffer::Write16(uint16_t data) 32 | { 33 | fBuffer.Append16(data); 34 | CheckFlush(fMaxSize); 35 | } 36 | 37 | void FileBuffer::Write32(uint32_t data) 38 | { 39 | fBuffer.Append32(data); 40 | CheckFlush(fMaxSize); 41 | } 42 | 43 | /* 44 | void c------------------------------() {} 45 | */ 46 | 47 | void FileBuffer::CheckFlush(int maxsize) 48 | { 49 | if (fBuffer.Length() >= maxsize) 50 | { 51 | if (fFP) 52 | { 53 | //stat("CheckFlush wrote %d bytes", fBuffer.Length()); 54 | fwrite(fBuffer.Data(), fBuffer.Length(), 1, fFP); 55 | fBuffer.Clear(); 56 | } 57 | else 58 | { 59 | staterr("CheckFlush: no file"); 60 | } 61 | } 62 | } 63 | 64 | void FileBuffer::Flush() 65 | { 66 | CheckFlush(0); 67 | } 68 | 69 | void FileBuffer::Dump() 70 | { 71 | fBuffer.Clear(); 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /nx/common/FileBuffer.fdh: -------------------------------------------------------------------------------- 1 | //hash:78d0206c 2 | //automatically generated by Makegen 3 | 4 | /* located in tsc.cpp */ 5 | 6 | //---------------[referenced from common/FileBuffer.cpp]-------------// 7 | void Clear(); 8 | 9 | 10 | /* located in common/stat.cpp */ 11 | 12 | //---------------[referenced from common/FileBuffer.cpp]-------------// 13 | void staterr(const char *fmt, ...); 14 | 15 | -------------------------------------------------------------------------------- /nx/common/FileBuffer.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _FILEBUFFER_H 3 | #define _FILEBUFFER_H 4 | 5 | #include "DBuffer.h" 6 | 7 | 8 | class FileBuffer 9 | { 10 | public: 11 | FileBuffer(); 12 | void SetBufferSize(int maxsize); 13 | void SetFile(FILE *fp); 14 | 15 | void Write8(uint8_t data); 16 | void Write16(uint16_t data); 17 | void Write32(uint32_t data); 18 | 19 | void Flush(); 20 | void Dump(); 21 | 22 | private: 23 | void CheckFlush(int maxsize); 24 | 25 | DBuffer fBuffer; 26 | int fMaxSize; 27 | 28 | FILE *fFP; 29 | }; 30 | 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /nx/common/InitList.fdh: -------------------------------------------------------------------------------- 1 | //hash:7790eafb 2 | //automatically generated by Makegen 3 | 4 | /* located in common/stat.cpp */ 5 | 6 | //----------------[referenced from common/InitList.cpp]--------------// 7 | void stat(const char *fmt, ...); 8 | 9 | -------------------------------------------------------------------------------- /nx/common/InitList.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _INITLIST_H 3 | #define _INITLIST_H 4 | 5 | #define MAX_INIT_RECORDS 100 6 | 7 | class InitList 8 | { 9 | public: 10 | void AddFunction(void (*func)(void)); 11 | void AddFunction(bool (*func)(void)); 12 | void AddFunction(void *func); 13 | bool CallFunctions(); 14 | 15 | private: 16 | void *fFunctions[MAX_INIT_RECORDS]; 17 | int fCount; // counting on behavior of auto-initilization to 0 18 | }; 19 | 20 | class InitAdder 21 | { 22 | public: 23 | InitAdder(InitList *initlist, void (*func)(void)) { initlist->AddFunction(func); } 24 | InitAdder(InitList *initlist, bool (*func)(void)) { initlist->AddFunction(func); } 25 | InitAdder(InitList &initlist, void (*func)(void)) { initlist.AddFunction(func); } 26 | InitAdder(InitList &initlist, bool (*func)(void)) { initlist.AddFunction(func); } 27 | }; 28 | 29 | #define INITFUNC(TARGET) \ 30 | static void __InitFunc(void); \ 31 | static InitAdder _ia(TARGET, __InitFunc); \ 32 | static void __InitFunc(void) \ 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /nx/common/StringList.fdh: -------------------------------------------------------------------------------- 1 | //hash:32a53999 2 | //automatically generated by Makegen 3 | 4 | /* located in common/stat.cpp */ 5 | 6 | //---------------[referenced from common/StringList.cpp]-------------// 7 | void stat(const char *fmt, ...); 8 | 9 | 10 | /* located in common/misc.cpp */ 11 | 12 | //---------------[referenced from common/StringList.cpp]-------------// 13 | int random(int min, int max); 14 | 15 | -------------------------------------------------------------------------------- /nx/common/StringList.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _STRINGLIST_H 3 | #define _STRINGLIST_H 4 | 5 | #include "BList.h" 6 | 7 | class StringList : protected BList 8 | { 9 | public: 10 | StringList() { } 11 | 12 | StringList(const StringList &other) 13 | { 14 | *this = other; 15 | } 16 | 17 | virtual ~StringList(); 18 | 19 | void AddString(const char *str); 20 | char *StringAt(int index) const; 21 | bool SetString(int index, const char *newstring); 22 | void MakeEmpty(); 23 | 24 | void Shuffle(); 25 | bool ContainsString(const char *term); 26 | bool ContainsCaseString(const char *term); 27 | void RemoveString(int index); 28 | void RemoveString(const char *str); 29 | void RemoveIString(const char *str); 30 | 31 | void SwapItems(int index1, int index2); 32 | void DumpContents(); 33 | 34 | int32_t CountItems() const { return BList::CountItems(); } 35 | 36 | StringList &operator= (const StringList &other); 37 | bool operator== (const StringList &other) const; 38 | bool operator!= (const StringList &other) const; 39 | }; 40 | 41 | 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /nx/common/basics.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BASICS_H 3 | #define _BASICS_H 4 | 5 | #include 6 | 7 | #ifdef __clang__ 8 | #define MAXPATHLEN 256 9 | #else 10 | #include // MAXPATHLEN 11 | #endif 12 | 13 | #ifndef PATH_MAX 14 | #define PATH_MAX 259 15 | #endif 16 | 17 | typedef unsigned char uchar; 18 | 19 | 20 | void stat(const char *fmt, ...); 21 | void staterr(const char *fmt, ...); 22 | #define ASSERT(X) \ 23 | { \ 24 | if (!(X)) \ 25 | { \ 26 | staterr("** ASSERT FAILED: '%s' at %s(%d)", #X, __FILE__, __LINE__); \ 27 | exit(1); \ 28 | } \ 29 | } 30 | 31 | #define SWAP(A, B) { A ^= B; B ^= A; A ^= B; } 32 | 33 | #ifndef MIN 34 | #define MIN(A, B) ( ( (A) < (B) ) ? (A) : (B) ) 35 | #endif 36 | 37 | #ifndef MAX 38 | #define MAX(A, B) ( ( (A) > (B) ) ? (A) : (B) ) 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /nx/common/bufio.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BUFIO_H 3 | #define _BUFIO_H 4 | 5 | #include "bufio.fdh" 6 | 7 | void write_Variable(DBuffer *out, const uint8_t *data, int len); 8 | void write_Variable(DBuffer *out, DBuffer *in); 9 | 10 | 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /nx/common/misc.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nx/common/misc.obj -------------------------------------------------------------------------------- /nx/common/stat.fdh: -------------------------------------------------------------------------------- 1 | //hash:cca537b6 2 | //automatically generated by Makegen 3 | 4 | /* located in platform.cpp */ 5 | 6 | //------------------[referenced from common/stat.cpp]----------------// 7 | FILE *fileopen(const char *fname, const char *mode); 8 | 9 | 10 | /* located in common/stat.cpp */ 11 | 12 | //------------------[referenced from common/stat.cpp]----------------// 13 | void SetLogFilename(const char *fname); 14 | void writelog(const char *buf, bool append_cr); 15 | void stat(const char *fmt, ...); 16 | void staterr(const char *fmt, ...); 17 | 18 | 19 | /* located in common/misc.cpp */ 20 | 21 | //------------------[referenced from common/stat.cpp]----------------// 22 | void maxcpy(char *dst, const char *src, int maxlen); 23 | 24 | -------------------------------------------------------------------------------- /nx/common/stat.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nx/common/stat.obj -------------------------------------------------------------------------------- /nx/config.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _CONFIG_H 3 | #define _CONFIG_H 4 | 5 | // if set graphics scaling factor is changable at runtime (otherwise it's a #define) 6 | //#define CONFIG_MUTABLE_SCALE 7 | 8 | // SDL_ttf support. if turned off SDL_ttf will not be required but only 9 | // bitmap fonts will be supported. 10 | //#define CONFIG_ENABLE_TTF 11 | 12 | // include the Doukutsu data-file extractor in the build 13 | // (it's needed only the first time the program is run). 14 | //#define CONFIG_DATA_EXTRACTOR 15 | 16 | // do image scaling in hardware via OpenGL 17 | //#define CONFIG_OPENGL 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /nx/debug.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _DEBUG_H 3 | #define _DEBUG_H 4 | 5 | #define DM_PIXEL 0 6 | #define DM_CROSSHAIR 1 7 | #define DM_XLINE 2 8 | #define DM_YLINE 3 9 | #define DM_BOX 4 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /nx/dirnames.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | extern const char *data_dir; 4 | extern const char *stage_dir; 5 | extern const char *pic_dir; 6 | extern const char *savegamename; 7 | extern const char *nxdata_dir; 8 | -------------------------------------------------------------------------------- /nx/endgame/CredReader.fdh: -------------------------------------------------------------------------------- 1 | //hash:d0daead0 2 | //automatically generated by Makegen 3 | 4 | /* located in tsc.cpp */ 5 | 6 | //--------------[referenced from endgame/CredReader.cpp]-------------// 7 | static int ReadNumber(const char **buf, const char *buf_end); 8 | char *tsc_decrypt(const char *fname, int *fsize_out); 9 | 10 | 11 | /* located in common/stat.cpp */ 12 | 13 | //--------------[referenced from endgame/CredReader.cpp]-------------// 14 | void staterr(const char *fmt, ...); 15 | void stat(const char *fmt, ...); 16 | 17 | -------------------------------------------------------------------------------- /nx/endgame/CredReader.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _CREDITS_READER_H 3 | #define _CREDITS_READER_H 4 | 5 | enum CC 6 | { 7 | CC_TEXT = '[', 8 | CC_SET_XOFF = '+', 9 | CC_BLANK_SPACE = '-', 10 | 11 | CC_JUMP = 'j', 12 | CC_FLAGJUMP = 'f', 13 | CC_LABEL = 'l', 14 | 15 | CC_MUSIC = '!', 16 | CC_FADE_MUSIC = '~', 17 | CC_END = '/' 18 | }; 19 | 20 | // represents a command from the .tsc 21 | struct CredCommand 22 | { 23 | int type; 24 | int parm, parm2; 25 | char text[80]; 26 | 27 | void DumpContents(); 28 | }; 29 | 30 | class CredReader 31 | { 32 | public: 33 | CredReader(); 34 | bool OpenFile(); 35 | void CloseFile(); 36 | bool ReadCommand(CredCommand *cmd); 37 | void Rewind(); 38 | 39 | private: 40 | int ReadNumber(); 41 | char get(); 42 | void unget(); 43 | char peek(); 44 | 45 | char *data; 46 | int dataindex, datalen; 47 | }; 48 | 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /nx/endgame/island.fdh: -------------------------------------------------------------------------------- 1 | //hash:a7d258f5 2 | //automatically generated by Makegen 3 | 4 | /* located in statusbar.cpp */ 5 | 6 | //----------------[referenced from endgame/island.cpp]---------------// 7 | void niku_draw(int value, bool force_white); 8 | 9 | 10 | /* located in endgame/island.cpp */ 11 | 12 | //----------------[referenced from endgame/island.cpp]---------------// 13 | bool island_init(int parameter); 14 | void island_tick(); 15 | 16 | -------------------------------------------------------------------------------- /nx/endgame/island.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _ISLAND_H 3 | #define _ISLAND_H 4 | 5 | bool island_init(int survives); 6 | void island_tick(); 7 | 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /nx/endgame/misc.fdh: -------------------------------------------------------------------------------- 1 | //hash:e401a413 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //-----------------[referenced from endgame/misc.cpp]----------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in ai/ai.cpp */ 11 | 12 | //-----------------[referenced from endgame/misc.cpp]----------------// 13 | void randblink(Object *o, int blinkframe, int blinktime, int prob); 14 | 15 | 16 | /* located in endgame/misc.cpp */ 17 | 18 | //-----------------[referenced from endgame/misc.cpp]----------------// 19 | void ai_cloud_spawner(Object *o); 20 | void ai_cloud(Object *o); 21 | void ai_balrog_flying(Object *o); 22 | void aftermove_balrog_passenger(Object *o); 23 | void ai_balrog_medic(Object *o); 24 | void ai_gaudi_patient(Object *o); 25 | void ai_baby_puppy(Object *o); 26 | void ai_turning_human(Object *o); 27 | void ai_ahchoo(Object *o); 28 | void ai_misery_wind(Object *o); 29 | void ai_the_cast(Object *o); 30 | 31 | 32 | /* located in common/misc.cpp */ 33 | 34 | //-----------------[referenced from endgame/misc.cpp]----------------// 35 | int random(int min, int max); 36 | 37 | -------------------------------------------------------------------------------- /nx/extract/crc.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include "crc.fdh" 6 | 7 | static uint32_t CRC_Table[256]; 8 | static const uint32_t poly = 0x04c11db7; 9 | 10 | void crc_init(void) 11 | { 12 | int i, j; 13 | 14 | for(i=0;i<256;i++) 15 | { 16 | CRC_Table[i] = reflect(i, 8) << 24; 17 | 18 | for(j=0;j<8;j++) 19 | CRC_Table[i] = (CRC_Table[i] << 1) ^ ((CRC_Table[i] & (1 << 31)) ? poly : 0); 20 | 21 | CRC_Table[i] = reflect(CRC_Table[i], 32); 22 | } 23 | } 24 | 25 | uint32_t crc_calc(uint8_t *buf, uint32_t size) 26 | { 27 | uint32_t crc = 0xFFFFFFFF; 28 | 29 | while(size) 30 | { 31 | crc = (crc >> 8) ^ CRC_Table[(crc & 0xFF) ^ *buf++]; 32 | size--; 33 | } 34 | 35 | return (crc ^ 0xFFFFFFFF); 36 | } 37 | 38 | 39 | static uint32_t reflect(uint32_t value, int size) 40 | { 41 | uint32_t newbits = 0; 42 | int i; 43 | 44 | for(i=1;i<=size;i++) 45 | { 46 | if (value & 1) 47 | newbits |= (1 << (size - i)); 48 | 49 | value >>= 1; 50 | } 51 | 52 | return newbits; 53 | } 54 | 55 | 56 | -------------------------------------------------------------------------------- /nx/extract/crc.fdh: -------------------------------------------------------------------------------- 1 | //hash:6c29cc36 2 | //automatically generated by Makegen 3 | 4 | /* located in extract/crc.cpp */ 5 | 6 | //------------------[referenced from extract/crc.cpp]----------------// 7 | void crc_init(void); 8 | uint32_t crc_calc(uint8_t *buf, uint32_t size); 9 | static uint32_t reflect(uint32_t value, int size); 10 | 11 | -------------------------------------------------------------------------------- /nx/extract/extractfiles.fdh: -------------------------------------------------------------------------------- 1 | //hash:ac97400d 2 | //automatically generated by Makegen 3 | 4 | /* located in platform.cpp */ 5 | 6 | //-------------[referenced from extract/extractfiles.cpp]------------// 7 | FILE *fileopen(const char *fname, const char *mode); 8 | 9 | 10 | /* located in extract/extractfiles.cpp */ 11 | 12 | //-------------[referenced from extract/extractfiles.cpp]------------// 13 | bool extract_files(FILE *exefp); 14 | static void createdir(const char *fname); 15 | 16 | 17 | /* located in extract/crc.cpp */ 18 | 19 | //-------------[referenced from extract/extractfiles.cpp]------------// 20 | void crc_init(void); 21 | uint32_t crc_calc(uint8_t *buf, uint32_t size); 22 | 23 | -------------------------------------------------------------------------------- /nx/extract/extractpxt.fdh: -------------------------------------------------------------------------------- 1 | //hash:34b55a98 2 | //automatically generated by Makegen 3 | 4 | /* located in platform.cpp */ 5 | 6 | //--------------[referenced from extract/extractpxt.cpp]-------------// 7 | FILE *fileopen(const char *fname, const char *mode); 8 | 9 | 10 | /* located in extract/extractpxt.cpp */ 11 | 12 | //--------------[referenced from extract/extractpxt.cpp]-------------// 13 | bool extract_pxt(FILE *fp); 14 | 15 | 16 | /* located in common/misc.cpp */ 17 | 18 | //--------------[referenced from extract/extractpxt.cpp]-------------// 19 | uint32_t fgetl(FILE *fp); 20 | double fgetfloat(FILE *fp); 21 | 22 | -------------------------------------------------------------------------------- /nx/extract/extractstages.fdh: -------------------------------------------------------------------------------- 1 | //hash:dbadae2c 2 | //automatically generated by Makegen 3 | 4 | /* located in platform.cpp */ 5 | 6 | //-------------[referenced from extract/extractstages.cpp]-----------// 7 | FILE *fileopen(const char *fname, const char *mode); 8 | 9 | 10 | /* located in extract/extractstages.cpp */ 11 | 12 | //-------------[referenced from extract/extractstages.cpp]-----------// 13 | bool extract_stages(FILE *exefp); 14 | static int find_index(const char *fname, const char *list[]); 15 | 16 | -------------------------------------------------------------------------------- /nx/floattext.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /nx/floattext.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _FLOATTEXT_H 3 | #define _FLOATTEXT_H 4 | 5 | #define FT_Y_START -4 // this starts it exactly centered, since the font is 8px tall 6 | #define FT_Y_HOLD -19 7 | #define FT_Y_RISEAWAY (FT_Y_HOLD - 8) 8 | 9 | enum FloatTextStates 10 | { 11 | FT_IDLE, 12 | FT_RISE, 13 | FT_HOLD, 14 | FT_SCROLL_AWAY, 15 | }; 16 | 17 | class FloatText 18 | { 19 | public: 20 | FloatText(int sprite); 21 | ~FloatText(); 22 | void Reset(); 23 | 24 | void AddQty(int amt); 25 | bool IsScrollingAway(); 26 | 27 | void UpdatePos(Object *assoc_object); 28 | 29 | static void DrawAll(); 30 | static void DeleteAll(); 31 | static void ResetAll(void); 32 | 33 | bool ObjectDestroyed; 34 | 35 | private: 36 | void Draw(); 37 | 38 | uint8_t state; 39 | 40 | int yoff; // how much we've risen 41 | int shownAmount; 42 | int sprite; // allows selecting font 43 | int timer; 44 | 45 | SDL_Rect cliprect; 46 | int objX, objY; // the center pixel of the associated object (de-CSFd) 47 | 48 | 49 | FloatText *next, *prev; 50 | static FloatText *first, *last; 51 | }; 52 | 53 | 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /nx/font.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nx/font.ttf -------------------------------------------------------------------------------- /nx/graphics/fbdev.fdh: -------------------------------------------------------------------------------- 1 | //hash:180b8a59 2 | //automatically generated by Makegen 3 | 4 | /* located in graphics/fbdev.cpp */ 5 | 6 | //----------------[referenced from graphics/fbdev.cpp]---------------// 7 | bool fbdev_init(void); 8 | void fbdev_close(void); 9 | void fbdev_blit(uint8_t *source, int width, int height); 10 | void fbdev_test(void); 11 | static uint64_t timer(void); 12 | 13 | 14 | /* located in common/stat.cpp */ 15 | 16 | //----------------[referenced from graphics/fbdev.cpp]---------------// 17 | void stat(const char *fmt, ...); 18 | void staterr(const char *fmt, ...); 19 | 20 | -------------------------------------------------------------------------------- /nx/graphics/font.fdh: -------------------------------------------------------------------------------- 1 | //hash:d7ca2a1d 2 | //automatically generated by Makegen 3 | 4 | /* located in graphics/font.cpp */ 5 | 6 | //-----------------[referenced from graphics/font.cpp]---------------// 7 | bool font_init(void); 8 | void font_close(void); 9 | bool font_reload(); 10 | void direct_text_draw(int x, int y, const char *text); 11 | static int text_draw(int x, int y, const char *text, int spacing, NXFont *font); 12 | int GetFontWidth(const char *text, int spacing, bool is_shaded); 13 | int GetFontHeight(); 14 | static bool create_shade_sfc(void); 15 | int font_draw(int x, int y, const char *text, int spacing, NXFont *font); 16 | int font_draw_shaded(int x, int y, const char *text, int spacing, NXFont *font); 17 | 18 | 19 | /* located in common/stat.cpp */ 20 | 21 | //-----------------[referenced from graphics/font.cpp]---------------// 22 | void stat(const char *fmt, ...); 23 | void staterr(const char *fmt, ...); 24 | 25 | -------------------------------------------------------------------------------- /nx/graphics/graphics.fdh: -------------------------------------------------------------------------------- 1 | //hash:3ab8d1dd 2 | //automatically generated by Makegen 3 | 4 | /* located in map.cpp */ 5 | 6 | //---------------[referenced from graphics/graphics.cpp]-------------// 7 | void map_flush_graphics(); 8 | 9 | 10 | /* located in tsc.cpp */ 11 | 12 | //---------------[referenced from graphics/graphics.cpp]-------------// 13 | void Clear(); 14 | 15 | 16 | /* located in graphics/font.cpp */ 17 | 18 | //---------------[referenced from graphics/graphics.cpp]-------------// 19 | bool font_reload(); 20 | 21 | 22 | /* located in graphics/palette.cpp */ 23 | 24 | //---------------[referenced from graphics/graphics.cpp]-------------// 25 | void palette_reset(void); 26 | 27 | 28 | /* located in common/stat.cpp */ 29 | 30 | //---------------[referenced from graphics/graphics.cpp]-------------// 31 | void stat(const char *fmt, ...); 32 | void staterr(const char *fmt, ...); 33 | 34 | -------------------------------------------------------------------------------- /nx/graphics/nxsurface.fdh: -------------------------------------------------------------------------------- 1 | //hash:dd5708e0 2 | //automatically generated by Makegen 3 | 4 | /* located in tsc.cpp */ 5 | 6 | //--------------[referenced from graphics/nxsurface.cpp]-------------// 7 | void Clear(); 8 | 9 | 10 | /* located in graphics/palette.cpp */ 11 | 12 | //--------------[referenced from graphics/nxsurface.cpp]-------------// 13 | SDL_Surface *palette_add(SDL_Surface *sfc); 14 | 15 | 16 | /* located in common/stat.cpp */ 17 | 18 | //--------------[referenced from graphics/nxsurface.cpp]-------------// 19 | void staterr(const char *fmt, ...); 20 | 21 | -------------------------------------------------------------------------------- /nx/graphics/palette.fdh: -------------------------------------------------------------------------------- 1 | //hash:38ce643b 2 | //automatically generated by Makegen 3 | 4 | /* located in graphics/palette.cpp */ 5 | 6 | //---------------[referenced from graphics/palette.cpp]--------------// 7 | void palette_reset(void); 8 | SDL_Surface *palette_add(SDL_Surface *sfc); 9 | int palette_alloc(uint8_t r, uint8_t g, uint8_t b); 10 | 11 | 12 | /* located in common/stat.cpp */ 13 | 14 | //---------------[referenced from graphics/palette.cpp]--------------// 15 | void staterr(const char *fmt, ...); 16 | void stat(const char *fmt, ...); 17 | 18 | -------------------------------------------------------------------------------- /nx/graphics/palette.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _PALETTE_H 3 | #define _PALETTE_H 4 | 5 | 6 | 7 | 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /nx/graphics/safemode.fdh: -------------------------------------------------------------------------------- 1 | //hash:98779cf6 2 | //automatically generated by Makegen 3 | 4 | /* located in main.cpp */ 5 | 6 | //---------------[referenced from graphics/safemode.cpp]-------------// 7 | void SDL_Delay(int ms); 8 | 9 | 10 | /* located in input.cpp */ 11 | 12 | //---------------[referenced from graphics/safemode.cpp]-------------// 13 | void input_poll(void); 14 | 15 | 16 | /* located in graphics/font.cpp */ 17 | 18 | //---------------[referenced from graphics/safemode.cpp]-------------// 19 | int GetFontHeight(); 20 | int GetFontWidth(const char *text, int spacing, bool is_shaded); 21 | int font_draw(int x, int y, const char *text, int spacing, NXFont *font); 22 | 23 | 24 | /* located in common/stat.cpp */ 25 | 26 | //---------------[referenced from graphics/safemode.cpp]-------------// 27 | void stat(const char *fmt, ...); 28 | 29 | -------------------------------------------------------------------------------- /nx/graphics/safemode.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SAFEMODE_H 3 | #define _SAFEMODE_H 4 | 5 | enum // special Y positioning arguments for moveto 6 | { 7 | SM_UPPER_THIRD = -1, 8 | SM_CENTER = -2, 9 | SM_LOWER_THIRD = -3, 10 | SM_NONE = -4, 11 | SM_MIDUPPER_Y = -5 12 | }; 13 | 14 | namespace safemode 15 | { 16 | bool init(); 17 | void close(); 18 | 19 | void moveto(int y); 20 | bool print(const char *fmt, ...); 21 | void clear(); 22 | 23 | void status(const char *fmt, ...); 24 | void clearstatus(); 25 | 26 | int run_until_key(bool delay=true); 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /nx/graphics/sprites.fdh: -------------------------------------------------------------------------------- 1 | //hash:ce3c3b74 2 | //automatically generated by Makegen 3 | 4 | /* located in graphics/sprites.cpp */ 5 | 6 | //---------------[referenced from graphics/sprites.cpp]--------------// 7 | static bool load_sif(const char *fname); 8 | static void create_slope_boxes(); 9 | static void offset_by_draw_points(); 10 | static void expand_single_dir_sprites(); 11 | 12 | 13 | /* located in common/stat.cpp */ 14 | 15 | //---------------[referenced from graphics/sprites.cpp]--------------// 16 | void staterr(const char *fmt, ...); 17 | 18 | -------------------------------------------------------------------------------- /nx/graphics/sprites.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SPRITES_H 3 | #define _SPRITES_H 4 | 5 | #define MAX_SPRITESHEETS 64 6 | #define MAX_SPRITES 512 7 | 8 | #include "../siflib/sif.h" 9 | extern SIFSprite sprites[MAX_SPRITES]; 10 | 11 | 12 | namespace Sprites 13 | { 14 | bool Init(); 15 | void Close(); 16 | void FlushSheets(); 17 | 18 | static void LoadSheetIfNeeded(int spr); 19 | 20 | static void BlitSprite(int x, int y, int s, int frame, uint8_t dir, \ 21 | int xoff, int yoff, int wd, int ht); 22 | 23 | 24 | void draw_sprite(int x, int y, int s, int frame=0, uint8_t dir=0); 25 | void draw_sprite_at_dp(int x, int y, int s, int frame=0, uint8_t dir=0); 26 | void draw_sprite_clipped(int x, int y, int s, int frame, uint8_t dir, int clipx1, int clipx2, int clipy1, int clipy2); 27 | void draw_sprite_clip_width(int x, int y, int s, int frame, int wd); 28 | void draw_sprite_chopped(int x, int y, int s, int frame, int wd, int repeat_at); 29 | void draw_sprite_repeating_x(int x, int y, int s, int frame, int wd); 30 | 31 | NXSurface *get_spritesheet(int sheetno); 32 | int create_spritesheet(int wd, int ht); 33 | void draw_sprite_to_surface(NXSurface *dst, int x, int y, int s, int frame, uint8_t dir); 34 | 35 | }; 36 | 37 | 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /nx/graphics/tileset.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /nx/graphics/tileset.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _TILESET_H 3 | #define _TILESET_H 4 | 5 | #define TILE_W 16 6 | #define TILE_H 16 7 | 8 | namespace Tileset 9 | { 10 | bool Init(); 11 | void Close(); 12 | 13 | bool Load(int new_tileset); 14 | void Reload(); 15 | void draw_tile(int x, int y, int t); 16 | 17 | NXSurface *GetSurface(); 18 | }; 19 | 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /nx/input.fdh: -------------------------------------------------------------------------------- 1 | //hash:62c25ddc 2 | //automatically generated by Makegen 3 | 4 | /* located in input.cpp */ 5 | 6 | //---------------------[referenced from input.cpp]-------------------// 7 | bool input_init(void); 8 | void input_remap(int keyindex, int sdl_key); 9 | int input_get_mapping(int keyindex); 10 | const char *input_get_name(int index); 11 | void input_set_mappings(int *array); 12 | void input_poll(void); 13 | static int IsNonConsoleKey(int key); 14 | void input_close(void); 15 | bool buttondown(void); 16 | bool buttonjustpushed(void); 17 | bool justpushed(int k); 18 | 19 | 20 | /* located in sound/sound.cpp */ 21 | 22 | //---------------------[referenced from input.cpp]-------------------// 23 | void sound(int snd); 24 | 25 | 26 | /* located in common/stat.cpp */ 27 | 28 | //---------------------[referenced from input.cpp]-------------------// 29 | void stat(const char *fmt, ...); 30 | 31 | -------------------------------------------------------------------------------- /nx/input.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _INPUT_H 3 | #define _INPUT_H 4 | 5 | enum INPUTS 6 | { 7 | LEFTKEY, RIGHTKEY, UPKEY, DOWNKEY, 8 | JUMPKEY, FIREKEY, 9 | PREVWPNKEY, NEXTWPNKEY, 10 | INVENTORYKEY, MAPSYSTEMKEY, 11 | 12 | ESCKEY, 13 | F1KEY, 14 | F2KEY, 15 | F3KEY, 16 | F4KEY, 17 | F5KEY, 18 | F6KEY, 19 | F7KEY, 20 | F8KEY, 21 | F9KEY, 22 | F10KEY, 23 | F11KEY, 24 | F12KEY, 25 | 26 | FREEZE_FRAME_KEY, 27 | FRAME_ADVANCE_KEY, 28 | DEBUG_FLY_KEY, 29 | 30 | INPUT_COUNT 31 | }; 32 | 33 | #define LASTCONTROLKEY MAPSYSTEMKEY 34 | 35 | #define DEBUG_GOD_KEY F1KEY 36 | #define DEBUG_MOVE_KEY F2KEY 37 | #define DEBUG_SAVE_KEY F4KEY 38 | #define FFWDKEY F5KEY 39 | 40 | extern bool inputs[INPUT_COUNT]; 41 | extern bool lastinputs[INPUT_COUNT]; 42 | extern int last_sdl_key; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /nx/intro/intro.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _INTRO_H 3 | #define _INTRO_H 4 | 5 | 6 | bool intro_init(int param); 7 | void intro_tick(); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /nx/intro/title.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _TITLE_H 3 | #define _TITLE_H 4 | 5 | 6 | bool title_init(int param); 7 | void title_tick(); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /nx/ip.txt.in: -------------------------------------------------------------------------------- 1 | Hardware ID : SEGA SEGAKATANA 2 | Maker ID : SEGA ENTERPRISES 3 | Device Info : 0000 CD-ROM1/1 4 | Area Symbols : JUE 5 | Peripherals : E000F10 6 | Product No : T0000 7 | Version : @VERSION@ 8 | Release Date : @DATE@ 9 | Boot Filename : 1ST_READ.BIN 10 | SW Maker Name : histat 11 | Game Title : NXEngine for DC 12 | -------------------------------------------------------------------------------- /nx/map_system.fdh: -------------------------------------------------------------------------------- 1 | //hash:ade0b838 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //------------------[referenced from map_system.cpp]-----------------// 7 | void DrawScene(void); 8 | 9 | 10 | /* located in input.cpp */ 11 | 12 | //------------------[referenced from map_system.cpp]-----------------// 13 | bool buttondown(void); 14 | 15 | 16 | /* located in map_system.cpp */ 17 | 18 | //------------------[referenced from map_system.cpp]-----------------// 19 | bool ms_init(int return_to_mode); 20 | void ms_close(void); 21 | void ms_tick(void); 22 | static void draw_expand(void); 23 | static void draw_banner(void); 24 | static void draw_row(int y); 25 | static int get_color(int tilecode); 26 | 27 | 28 | /* located in graphics/font.cpp */ 29 | 30 | //------------------[referenced from map_system.cpp]-----------------// 31 | int GetFontWidth(const char *text, int spacing, bool is_shaded); 32 | int font_draw(int x, int y, const char *text, int spacing, NXFont *font); 33 | 34 | -------------------------------------------------------------------------------- /nx/map_system.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _MAPSYSTEM_H 3 | #define _MAPSYSTEM_H 4 | 5 | 6 | bool ms_init(int param); 7 | void ms_tick(void); 8 | void ms_close(void); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /nx/maprecord.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _MAPRECORD_H 3 | #define _MAPRECORD_H 4 | 5 | #define MAX_STAGES 120 6 | struct MapRecord 7 | { 8 | char filename[32]; 9 | char stagename[35]; 10 | 11 | uint8_t tileset; 12 | uint8_t bg_no; 13 | uint8_t scroll_type; 14 | uint8_t bossNo; 15 | uint8_t NPCset1; 16 | uint8_t NPCset2; 17 | }; 18 | extern MapRecord stages[MAX_STAGES]; 19 | extern int num_stages; 20 | 21 | #define STAGE_SAND 10 22 | #define STAGE_START_POINT 13 23 | #define STAGE_IRONH 31 24 | #define STAGE_BOULDER_CHAMBER 44 25 | #define STAGE_MAZE_M 45 26 | #define STAGE_ALMOND 47 27 | #define STAGE_WATERWAY 48 28 | #define STAGE_KINGS_TABLE 65 29 | #define STAGE_HELL1 80 30 | #define STAGE_HELL2 81 31 | #define STAGE_HELL3 82 32 | #define STAGE_HELL4 84 33 | #define STAGE_HELL42 85 34 | #define STAGE_STATUE_CHAMBER 86 35 | #define STAGE_SEAL_CHAMBER 87 36 | #define STAGE_SEAL_CHAMBER_2 92 37 | #define STAGE_CORRIDOR 88 38 | #define STAGE_KINGS 72 // intro 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /nx/master.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #------------------------------------------------------------------------- 3 | # edit dev_option 4 | # $ wodim --devices 5 | 6 | dev_option="/dev/sg4" 7 | 8 | #========================================================================= 9 | # Don't edit 10 | local_cdrecord=`which wodim` 11 | local_mkisofs=`which genisoimage` 12 | 13 | if [ ! -e wav ]; then 14 | echo "WAV not exist" 1>&2 15 | exit 1 16 | fi 17 | 18 | if [ ! -e data ]; then 19 | echo "DATA not exist" 1>&2 20 | exit 1 21 | fi 22 | 23 | if [ ! -e data/1ST_READ.BIN ]; then 24 | echo "1ST_READ.BIN not exist" 1>&2 25 | exit 1 26 | fi 27 | 28 | if [ ! -e IP.BIN ]; then 29 | echo "IP.BIN not exist" 1>&2 30 | exit 1 31 | fi 32 | 33 | # burning audio 34 | $local_cdrecord dev=$dev_option -multi -audio -pad wav/*.wav 35 | 36 | # multi-session info 37 | msinfo=`$local_cdrecord dev=$dev_option -msinfo` 38 | 39 | #CD-ROM XA mode 2 form 1 - 2048 bytes 40 | $local_mkisofs -G IP.BIN -C $msinfo -l data | $local_cdrecord dev=$dev_option -multi -xa - 41 | 42 | -------------------------------------------------------------------------------- /nx/niku.fdh: -------------------------------------------------------------------------------- 1 | //hash:1da713cd 2 | //automatically generated by Makegen 3 | 4 | /* located in platform.cpp */ 5 | 6 | //---------------------[referenced from niku.cpp]--------------------// 7 | FILE *fileopen(const char *fname, const char *mode); 8 | 9 | 10 | /* located in niku.cpp */ 11 | 12 | //---------------------[referenced from niku.cpp]--------------------// 13 | bool niku_load(uint32_t *value_out); 14 | bool niku_save(uint32_t value); 15 | static const char *getfname(); 16 | 17 | 18 | /* located in common/stat.cpp */ 19 | 20 | //---------------------[referenced from niku.cpp]--------------------// 21 | void stat(const char *fmt, ...); 22 | void staterr(const char *fmt, ...); 23 | 24 | 25 | /* located in common/misc.cpp */ 26 | 27 | //---------------------[referenced from niku.cpp]--------------------// 28 | int random(int min, int max); 29 | 30 | -------------------------------------------------------------------------------- /nx/nxce/buildscript: -------------------------------------------------------------------------------- 1 | cd .. 2 | makegen wince.ml +q 3 | #tools/genobjnametable 4 | LD_LIBRARY_PATH="/opt/lib32/usr/lib/" make -j4 5 | 6 | %cd nxce 7 | %~/dev/jlime/ceremote/ceremote 192.168.131.201 8 | hide 9 | -------------------------------------------------------------------------------- /nx/nxce/remotescript: -------------------------------------------------------------------------------- 1 | send ../nxce.exe \nxce\nxce.exe 2 | exec \nxce\nxce.exe 3 | exit 4 | -------------------------------------------------------------------------------- /nx/pause/dialog.fdh: -------------------------------------------------------------------------------- 1 | //hash:fd95fe73 2 | //automatically generated by Makegen 3 | 4 | /* located in tsc.cpp */ 5 | 6 | //-----------------[referenced from pause/dialog.cpp]----------------// 7 | void Clear(); 8 | 9 | 10 | /* located in input.cpp */ 11 | 12 | //-----------------[referenced from pause/dialog.cpp]----------------// 13 | bool buttonjustpushed(void); 14 | bool justpushed(int k); 15 | 16 | 17 | /* located in graphics/font.cpp */ 18 | 19 | //-----------------[referenced from pause/dialog.cpp]----------------// 20 | int GetFontHeight(); 21 | int GetFontWidth(const char *text, int spacing, bool is_shaded); 22 | int font_draw(int x, int y, const char *text, int spacing, NXFont *font); 23 | 24 | 25 | /* located in sound/sound.cpp */ 26 | 27 | //-----------------[referenced from pause/dialog.cpp]----------------// 28 | void sound(int snd); 29 | 30 | -------------------------------------------------------------------------------- /nx/pause/message.fdh: -------------------------------------------------------------------------------- 1 | //hash:b11f32f6 2 | //automatically generated by Makegen 3 | 4 | /* located in graphics/font.cpp */ 5 | 6 | //-----------------[referenced from pause/message.cpp]---------------// 7 | int GetFontWidth(const char *text, int spacing, bool is_shaded); 8 | int GetFontHeight(); 9 | int font_draw(int x, int y, const char *text, int spacing, NXFont *font); 10 | 11 | -------------------------------------------------------------------------------- /nx/pause/message.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _MESSAGE_H 3 | #define _MESSAGE_H 4 | 5 | #include "options.h" 6 | namespace Options { 7 | 8 | class Message : public FocusHolder 9 | { 10 | public: 11 | Message(const char *msg, const char *msg2 = NULL); 12 | ~Message(); 13 | 14 | void Draw(); 15 | void RunInput(); 16 | 17 | int *rawKeyReturn; 18 | void (*on_dismiss)(Message *msg); 19 | 20 | private: 21 | char *fMsg, *fMsg2; 22 | int fMsgX, fMsgY; 23 | int fMsg2X, fMsg2Y; 24 | 25 | int fShowDelay; 26 | }; 27 | 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /nx/pause/objects.fdh: -------------------------------------------------------------------------------- 1 | //hash:721c5ba0 2 | //automatically generated by Makegen 3 | 4 | /* located in pause/objects.cpp */ 5 | 6 | //-----------------[referenced from pause/objects.cpp]---------------// 7 | static void ai_oc_controller(Object *o); 8 | static void ai_oc_quote(Object *o); 9 | static void ai_oc_ikachan(Object *o); 10 | 11 | 12 | /* located in common/misc.cpp */ 13 | 14 | //-----------------[referenced from pause/objects.cpp]---------------// 15 | int random(int min, int max); 16 | 17 | -------------------------------------------------------------------------------- /nx/pause/options.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _OPTIONS_H 3 | #define _OPTIONS_H 4 | 5 | namespace Options 6 | { 7 | // class for something like a dialog box that can hold the focus. 8 | // there is a stack of them. everyone in the stack is drawn, 9 | // and the topmost one receives HandleKey events. 10 | class FocusHolder 11 | { 12 | public: 13 | virtual ~FocusHolder() { } 14 | 15 | virtual void Draw() = 0; 16 | virtual void RunInput() = 0; 17 | }; 18 | 19 | 20 | class FocusStack : public BList 21 | { 22 | public: 23 | FocusHolder *ItemAt(int index) { return (FocusHolder *)BList::ItemAt(index); } 24 | }; 25 | 26 | 27 | void init_objects(); 28 | void close_objects(); 29 | void run_and_draw_objects(void); 30 | Object *create_object(int x, int y, int type); 31 | 32 | }; // end namespace 33 | 34 | 35 | bool options_init(int param); 36 | void options_tick(void); 37 | void options_close(void); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /nx/pause/pause.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "../nx.h" 3 | #include "pause.fdh" 4 | 5 | bool pause_init(int param) 6 | { 7 | memset(lastinputs, 1, sizeof(lastinputs)); 8 | return 0; 9 | } 10 | 11 | void pause_tick() 12 | { 13 | ClearScreen(BLACK); 14 | 15 | int cx = (SCREEN_WIDTH / 2) - (sprites[SPR_RESETPROMPT].w / 2); 16 | int cy = (SCREEN_HEIGHT / 2) - (sprites[SPR_RESETPROMPT].h / 2); 17 | draw_sprite(cx, cy, SPR_RESETPROMPT); 18 | 19 | const char *str = "F3:Options"; 20 | cx = (SCREEN_WIDTH / 2) - (GetFontWidth(str, 0) / 2) - 4; 21 | cy = (SCREEN_HEIGHT - 8) - GetFontHeight(); 22 | int f3wd = font_draw(cx, cy, "F3", 0); 23 | font_draw(cx + f3wd, cy, ":Options", 0, &bluefont); 24 | 25 | // resume 26 | if (justpushed(F1KEY)) 27 | { 28 | lastinputs[F1KEY] = true; 29 | game.pause(false); 30 | return; 31 | } 32 | 33 | // reset 34 | if (justpushed(F2KEY)) 35 | { 36 | lastinputs[F2KEY] = true; 37 | game.reset(); 38 | return; 39 | } 40 | 41 | // exit 42 | if (justpushed(ESCKEY)) 43 | { 44 | lastinputs[ESCKEY] = true; 45 | game.running = false; 46 | return; 47 | } 48 | } 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /nx/pause/pause.fdh: -------------------------------------------------------------------------------- 1 | //hash:f8b50229 2 | //automatically generated by Makegen 3 | 4 | /* located in input.cpp */ 5 | 6 | //------------------[referenced from pause/pause.cpp]----------------// 7 | bool justpushed(int k); 8 | 9 | 10 | /* located in pause/pause.cpp */ 11 | 12 | //------------------[referenced from pause/pause.cpp]----------------// 13 | bool pause_init(int param); 14 | void pause_tick(); 15 | 16 | 17 | /* located in graphics/font.cpp */ 18 | 19 | //------------------[referenced from pause/pause.cpp]----------------// 20 | int GetFontWidth(const char *text, int spacing, bool is_shaded); 21 | int GetFontHeight(); 22 | int font_draw(int x, int y, const char *text, int spacing, NXFont *font); 23 | 24 | -------------------------------------------------------------------------------- /nx/pause/pause.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _PAUSE_H 3 | #define _PAUSE_H 4 | 5 | 6 | bool pause_init(int retmode); 7 | void pause_tick(void); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /nx/platform.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include "config.h" 5 | #include "platform.fdh" 6 | 7 | #ifndef __SDLSHIM__ 8 | 9 | FILE *fileopen(const char *fname, const char *mode) 10 | { 11 | return fopen(fname, mode); 12 | } 13 | 14 | #else 15 | 16 | FILE *fileopen(const char *fname, const char *mode) 17 | { 18 | return SDLS_fopen(fname, mode); 19 | } 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /nx/platform.fdh: -------------------------------------------------------------------------------- 1 | //hash:19a15e6b 2 | //automatically generated by Makegen 3 | 4 | /* located in platform.cpp */ 5 | 6 | //-------------------[referenced from platform.cpp]------------------// 7 | FILE *fileopen(const char *fname, const char *mode); 8 | FILE *fileopen(const char *fname, const char *mode); 9 | 10 | -------------------------------------------------------------------------------- /nx/platform.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _PLATFORM_H 3 | #define _PLATFORM_H 4 | 5 | extern "C" 6 | { 7 | void platform_sync_to_vblank(void); 8 | }; 9 | 10 | 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /nx/platform/Linux/vbesync.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #define DRM_VBLANK_RELATIVE 0x1 7 | #if 0 8 | void platform_sync_to_vblank(void) 9 | { 10 | static char initilized = 0; 11 | static int fd; 12 | int ret; 13 | 14 | if (!initilized) 15 | { 16 | initilized = 1; 17 | 18 | printf("Linux vbesync: opening DRM card interface...\n"); 19 | fd = open("/dev/dri/card0", O_RDWR); 20 | if (fd == -1) 21 | { 22 | printf("Failed to open DRM interface; sync-to-vblank will not be done.\n"); 23 | return; 24 | } 25 | 26 | printf("Linux vbesync: DRM-based sync-to-vblank activated.\n"); 27 | } 28 | else if (fd == -1) 29 | { 30 | return; 31 | } 32 | 33 | drm_wait_vblank_t vbl; 34 | 35 | vbl.request.type = DRM_VBLANK_RELATIVE; 36 | vbl.request.sequence = 1; 37 | 38 | do 39 | { 40 | ret = ioctl(fd, DRM_IOCTL_WAIT_VBLANK, vbl); 41 | vbl.request.type &= ~DRM_VBLANK_RELATIVE; 42 | } 43 | while(ret && errno == EINTR); 44 | 45 | } 46 | #endif 47 | -------------------------------------------------------------------------------- /nx/platform/Linux/vbesync.fdh: -------------------------------------------------------------------------------- 1 | //hash:3d032dcf 2 | //automatically generated by Makegen 3 | 4 | /* located in platform/Linux/vbesync.c */ 5 | 6 | //-------------[referenced from platform/Linux/vbesync.c]------------// 7 | void platform_sync_to_vblank(void); 8 | 9 | -------------------------------------------------------------------------------- /nx/playerstats.fdh: -------------------------------------------------------------------------------- 1 | //hash:7a858c13 2 | //automatically generated by Makegen 3 | 4 | /* located in caret.cpp */ 5 | 6 | //------------------[referenced from playerstats.cpp]----------------// 7 | Caret *effect(int x, int y, int effectno); 8 | 9 | 10 | /* located in playerstats.cpp */ 11 | 12 | //------------------[referenced from playerstats.cpp]----------------// 13 | void AddHealth(int hp); 14 | void AddXP(int xp, bool quiet); 15 | void SubXP(int xp, bool quiet); 16 | void AddInventory(int item); 17 | void DelInventory(int item); 18 | int FindInventory(int item); 19 | int CheckInventoryList(int item, int *list, int nitems); 20 | void GetWeapon(int wpn, int ammo); 21 | void LoseWeapon(int wpn); 22 | void TradeWeapon(int oldwpn, int newwpn, int ammo); 23 | void AddAmmo(int wpn, int ammo); 24 | void RefillAllAmmo(void); 25 | 26 | 27 | /* located in inventory.cpp */ 28 | 29 | //------------------[referenced from playerstats.cpp]----------------// 30 | int RefreshInventoryScreen(void); 31 | 32 | 33 | /* located in sound/sound.cpp */ 34 | 35 | //------------------[referenced from playerstats.cpp]----------------// 36 | void sound(int snd); 37 | 38 | 39 | /* located in common/stat.cpp */ 40 | 41 | //------------------[referenced from playerstats.cpp]----------------// 42 | void staterr(const char *fmt, ...); 43 | 44 | -------------------------------------------------------------------------------- /nx/profile.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _PROFILE_H 3 | #define _PROFILE_H 4 | 5 | // how many bytes of data long a profile.dat is. 6 | // used by the replays which use the regular profile functions 7 | // to write a savefile then tack their own data onto the end. 8 | #define PROFILE_LENGTH 0x604 9 | 10 | struct Profile 11 | { 12 | int stage; 13 | int songno; 14 | int px, py, pdir; 15 | int hp, maxhp, num_whimstars; 16 | uint32_t equipmask; 17 | 18 | int curWeapon; 19 | struct 20 | { 21 | bool hasWeapon; 22 | int level; 23 | int xp; 24 | int ammo, maxammo; 25 | } weapons[WPN_COUNT]; 26 | 27 | int inventory[MAX_INVENTORY]; 28 | int ninventory; 29 | 30 | bool flags[NUM_GAMEFLAGS]; 31 | 32 | struct 33 | { 34 | int slotno; 35 | int scriptno; 36 | } teleslots[NUM_TELEPORTER_SLOTS]; 37 | int num_teleslots; 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /nx/screeneffect.fdh: -------------------------------------------------------------------------------- 1 | //hash:a8ebd728 2 | //automatically generated by Makegen 3 | 4 | /* located in sound/sound.cpp */ 5 | 6 | //-----------------[referenced from screeneffect.cpp]----------------// 7 | void sound(int snd); 8 | 9 | -------------------------------------------------------------------------------- /nx/settings.fdh: -------------------------------------------------------------------------------- 1 | //hash:db8bcb16 2 | //automatically generated by Makegen 3 | 4 | /* located in settings.cpp */ 5 | 6 | //-------------------[referenced from settings.cpp]------------------// 7 | bool settings_load(Settings *setfile); 8 | static bool tryload(Settings *setfile); 9 | bool settings_save(Settings *setfile); 10 | 11 | 12 | /* located in platform.cpp */ 13 | 14 | //-------------------[referenced from settings.cpp]------------------// 15 | FILE *fileopen(const char *fname, const char *mode); 16 | 17 | 18 | /* located in input.cpp */ 19 | 20 | //-------------------[referenced from settings.cpp]------------------// 21 | void input_set_mappings(int *array); 22 | int input_get_mapping(int keyindex); 23 | 24 | 25 | /* located in common/stat.cpp */ 26 | 27 | //-------------------[referenced from settings.cpp]------------------// 28 | void stat(const char *fmt, ...); 29 | 30 | -------------------------------------------------------------------------------- /nx/settings.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SETTINGS_H 3 | #define _SETTINGS_H 4 | 5 | #include "input.h" 6 | 7 | struct Settings 8 | { 9 | uint16_t version; 10 | int resolution; 11 | int last_save_slot; 12 | bool multisave; 13 | bool files_extracted; 14 | bool show_fps; 15 | bool displayformat; 16 | 17 | bool enable_debug_keys; 18 | bool sound_enabled; 19 | int music_enabled; 20 | 21 | bool instant_quit; 22 | bool emulate_bugs; 23 | bool no_quake_in_hell; 24 | bool inhibit_fullscreen; 25 | 26 | bool skip_intro; 27 | int reserved[8]; 28 | 29 | int input_mappings[INPUT_COUNT]; 30 | }; 31 | 32 | bool settings_load(Settings *settings=NULL); 33 | bool settings_save(Settings *settings=NULL); 34 | 35 | extern Settings *settings; 36 | extern Settings normal_settings; 37 | extern Settings replay_settings; 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /nx/siflib/sectSprites.fdh: -------------------------------------------------------------------------------- 1 | //hash:99f5c088 2 | //automatically generated by Makegen 3 | 4 | /* located in common/bufio.cpp */ 5 | 6 | //--------------[referenced from siflib/sectSprites.cpp]-------------// 7 | uint16_t read_U16(const uint8_t **data, const uint8_t *data_end); 8 | uint8_t read_U8(const uint8_t **data, const uint8_t *data_end); 9 | 10 | 11 | /* located in common/stat.cpp */ 12 | 13 | //--------------[referenced from siflib/sectSprites.cpp]-------------// 14 | void staterr(const char *fmt, ...); 15 | void stat(const char *fmt, ...); 16 | 17 | -------------------------------------------------------------------------------- /nx/siflib/sectStringArray.fdh: -------------------------------------------------------------------------------- 1 | //hash:89fa228c 2 | //automatically generated by Makegen 3 | 4 | /* located in tsc.cpp */ 5 | 6 | //------------[referenced from siflib/sectStringArray.cpp]-----------// 7 | void Clear(); 8 | 9 | 10 | /* located in common/bufio.cpp */ 11 | 12 | //------------[referenced from siflib/sectStringArray.cpp]-----------// 13 | uint16_t read_U16(const uint8_t **data, const uint8_t *data_end); 14 | uint8_t read_U8(const uint8_t **data, const uint8_t *data_end); 15 | 16 | 17 | /* located in common/stat.cpp */ 18 | 19 | //------------[referenced from siflib/sectStringArray.cpp]-----------// 20 | void staterr(const char *fmt, ...); 21 | 22 | -------------------------------------------------------------------------------- /nx/siflib/sectStringArray.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SECT_STRINGARRAY_H 3 | #define _SECT_STRINGARRAY_H 4 | 5 | class StringList; 6 | class DString; 7 | class DBuffer; 8 | 9 | // the SectStringArray handler decodes sif sections which consist of an array 10 | // of pascal strings. This includes SIF_SECTION_SHEETS and SIF_SECTION_DIRECTORY. 11 | 12 | class SIFStringArraySect 13 | { 14 | public: 15 | static bool Decode(const uint8_t *data, int datalen, StringList *out); 16 | static uint8_t *Encode(StringList *strings, int *datalen_out); 17 | 18 | static void ReadPascalString(const uint8_t **data, const uint8_t *data_end, DString *out); 19 | static void WritePascalString(const char *str, DBuffer *out); 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /nx/siflib/sif.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /nx/siflib/sifloader.fdh: -------------------------------------------------------------------------------- 1 | //hash:fa413049 2 | //automatically generated by Makegen 3 | 4 | /* located in platform.cpp */ 5 | 6 | //---------------[referenced from siflib/sifloader.cpp]--------------// 7 | FILE *fileopen(const char *fname, const char *mode); 8 | 9 | 10 | /* located in common/stat.cpp */ 11 | 12 | //---------------[referenced from siflib/sifloader.cpp]--------------// 13 | void staterr(const char *fmt, ...); 14 | void stat(const char *fmt, ...); 15 | 16 | 17 | /* located in common/misc.cpp */ 18 | 19 | //---------------[referenced from siflib/sifloader.cpp]--------------// 20 | uint32_t fgetl(FILE *fp); 21 | void fputl(uint32_t word, FILE *fp); 22 | 23 | -------------------------------------------------------------------------------- /nx/siflib/sifupgrade.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nx/siflib/sifupgrade.cpp -------------------------------------------------------------------------------- /nx/slope.fdh: -------------------------------------------------------------------------------- 1 | //hash:e0b83590 2 | //automatically generated by Makegen 3 | 4 | /* located in slope.cpp */ 5 | 6 | //---------------------[referenced from slope.cpp]-------------------// 7 | bool initslopetable(void); 8 | uint8_t ReadSlopeTable(int x, int y); 9 | bool IsSlopeAtPointList(Object *o, SIFPointList *points); 10 | int CheckStandOnSlope(Object *o); 11 | int CheckBoppedHeadOnSlope(Object *o); 12 | bool movehandleslope(Object *o, int xinertia); 13 | void DrawSlopeTablesOnTiles(); 14 | void DrawSlopeTableOnTile(int table, int tile); 15 | void dumpslopetable(int t); 16 | 17 | 18 | /* located in common/stat.cpp */ 19 | 20 | //---------------------[referenced from slope.cpp]-------------------// 21 | void stat(const char *fmt, ...); 22 | 23 | -------------------------------------------------------------------------------- /nx/slope.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SLOPE_H 3 | #define _SLOPE_H 4 | 5 | // slope types 6 | #define SLOPE_CEIL_FWD1 1 7 | #define SLOPE_CEIL_FWD2 2 8 | #define SLOPE_CEIL_BACK1 3 9 | #define SLOPE_CEIL_BACK2 4 10 | 11 | #define SLOPE_BACK1 5 12 | #define SLOPE_BACK2 6 13 | #define SLOPE_FWD1 7 14 | #define SLOPE_FWD2 8 15 | 16 | #define SLOPE_LAST 8 17 | 18 | struct SlopeTable 19 | { 20 | uint8_t table[TILE_W][TILE_H]; 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /nx/smalfont.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nx/smalfont.bmp -------------------------------------------------------------------------------- /nx/sound/sslib.fdh: -------------------------------------------------------------------------------- 1 | //hash:56e7dcf5 2 | //automatically generated by Makegen 3 | 4 | /* located in sound/sslib.cpp */ 5 | 6 | //------------------[referenced from sound/sslib.cpp]----------------// 7 | char SSInit(void); 8 | void SSClose(void); 9 | void SSReserveChannel(int c); 10 | int SSFindFreeChannel(void); 11 | int SSEnqueueChunk(int c, signed short *buffer, int len, int userdata, void(*FinishedCB)(int, int)); 12 | int SSPlayChunk(int c, signed short *buffer, int len, int userdata, void(*FinishedCB)(int, int)); 13 | char SSChannelPlaying(int c); 14 | int SSGetCurUserData(int c); 15 | int SSGetSamplePos(int c); 16 | void SSAbortChannel(int c); 17 | void SSAbortChannelByUserData(int ud); 18 | void SSSetVolume(int c, int newvol); 19 | void SSLockAudio(void); 20 | void SSUnlockAudio(void); 21 | static int AddBuffer(SSChannel *chan, int bytes); 22 | static void mixaudio(void *unused, uint8_t *stream, int len); 23 | 24 | 25 | /* located in common/stat.cpp */ 26 | 27 | //------------------[referenced from sound/sslib.cpp]----------------// 28 | void staterr(const char *fmt, ...); 29 | void stat(const char *fmt, ...); 30 | 31 | -------------------------------------------------------------------------------- /nx/sound/sslib.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SSLIB_H 3 | #define _SSLIB_H 4 | 5 | #define SAMPLE_RATE 22050 6 | #define MAX_QUEUED_CHUNKS (180 +1) 7 | #define SS_NUM_CHANNELS 16 8 | 9 | struct SSChunk 10 | { 11 | signed short *buffer; 12 | int length; 13 | 14 | signed char *bytebuffer; // same as bytebuffer but in BYTES 15 | int bytelength; // TOTAL length in BYTES 16 | 17 | // current read position. this is within bytebuffer and is in BYTES. 18 | int bytepos; 19 | 20 | int userdata; // user data to be sent to FinishedCallback when finished 21 | }; 22 | 23 | 24 | struct SSChannel 25 | { 26 | SSChunk chunks[MAX_QUEUED_CHUNKS]; 27 | int head, tail; 28 | 29 | int volume; 30 | char reserved; // if 1, can only be played on explicitly, not by passing -1 31 | 32 | int FinishedChunkUserdata[MAX_QUEUED_CHUNKS]; 33 | int nFinishedChunks; 34 | 35 | void (*FinishedCB)(int channel, int chunkid); 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /nx/sprites.sif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nx/sprites.sif -------------------------------------------------------------------------------- /nx/stageboss.fdh: -------------------------------------------------------------------------------- 1 | //hash:0fd34063 2 | //automatically generated by Makegen 3 | 4 | /* located in common/stat.cpp */ 5 | 6 | //-------------------[referenced from stageboss.cpp]-----------------// 7 | void stat(const char *fmt, ...); 8 | void staterr(const char *fmt, ...); 9 | 10 | -------------------------------------------------------------------------------- /nx/stagedata.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include "stagedata.h" 5 | 6 | const char *backdrop_names[] = { 7 | "bk0", 8 | "bkBlue", 9 | "bkGreen", 10 | "bkBlack", 11 | "bkGard", 12 | "bkMaze", 13 | "bkGray", 14 | "bkRed", 15 | "bkWater", 16 | "bkMoon", 17 | "bkFog", 18 | "bkFall", 19 | NULL 20 | }; 21 | 22 | const char *tileset_names[] = { 23 | "0", 24 | "Pens", 25 | "Eggs", 26 | "EggX", 27 | "EggIn", 28 | "Store", 29 | "Weed", 30 | "Barr", 31 | "Maze", 32 | "Sand", 33 | "Mimi", 34 | "Cave", 35 | "River", 36 | "Gard", 37 | "Almond", 38 | "Oside", 39 | "Cent", 40 | "Jail", 41 | "White", 42 | "Fall", 43 | "Hell", 44 | "Labo", 45 | NULL 46 | }; 47 | 48 | -------------------------------------------------------------------------------- /nx/stagedata.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /nx/stagedata.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _STAGEDATA_H 3 | #define _STAGEDATA_H 4 | 5 | //#define NMAPS 120 6 | //extern MapRecord stages[NMAPS]; 7 | 8 | #define NUM_BACKDROPS 12 9 | #define NUM_TILESETS 22 10 | 11 | extern const char *backdrop_names[]; 12 | extern const char *tileset_names[]; 13 | 14 | 15 | #define NPCSET_GUEST 0 16 | #define NPCSET_0 1 17 | #define NPCSET_EGGS1 2 18 | #define NPCSET_RAVIL 3 19 | #define NPCSET_WEED 4 20 | #define NPCSET_MAZE 5 21 | #define NPCSET_SAND 6 22 | #define NPCSET_OMG 7 23 | #define NPCSET_CEMET 8 24 | #define NPCSET_BLLG 9 25 | #define NPCSET_PLANT 10 26 | #define NPCSET_FROG 11 27 | #define NPCSET_CURLY 12 28 | #define NPCSET_STREAM 13 29 | #define NPCSET_IRONH 14 30 | #define NPCSET_TORO 15 31 | #define NPCSET_X 16 32 | #define NPCSET_DARK 17 33 | #define NPCSET_ALMO1 18 34 | #define NPCSET_EGGS2 19 35 | #define NPCSET_TWIND 20 36 | #define NPCSET_MOON 21 37 | #define NPCSET_CENT 22 38 | #define NPCSET_HERI 23 39 | #define NPCSET_RED 24 40 | #define NPCSET_MIZA 25 41 | #define NPCSET_DR 26 42 | #define NPCSET_ALMO2 27 43 | #define NPCSET_KINGS 28 44 | #define NPCSET_HELL 29 45 | #define NPCSET_PRESS 30 46 | #define NPCSET_PRIEST 31 47 | #define NPCSET_BALLOS 32 48 | #define NPCSET_ISLAND 33 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /nx/statusbar.fdh: -------------------------------------------------------------------------------- 1 | //hash:32c2827d 2 | //automatically generated by Makegen 3 | 4 | /* located in statusbar.cpp */ 5 | 6 | //-------------------[referenced from statusbar.cpp]-----------------// 7 | bool statusbar_init(void); 8 | void DrawStatusBar(void); 9 | void DrawAirLeft(int x, int y); 10 | void DrawWeaponAmmo(int x, int y, int wpn); 11 | void DrawWeaponLevel(int x, int y, int wpn); 12 | static void RunStatusBar(void); 13 | void weapon_slide(int dir, int newwpn); 14 | void weapon_introslide(); 15 | void stat_NextWeapon(bool quiet); 16 | void stat_PrevWeapon(bool quiet); 17 | void InitPercentBar(PercentBar *bar, int starting_value); 18 | void RunPercentBar(PercentBar *bar, int current_value); 19 | void DrawPercentBar(PercentBar *bar, int x, int y, int curvalue, int maxvalue, int width); 20 | void DrawNumber(int x, int y, int num); 21 | void DrawPercentage(int x, int y, int fill_sprite, int fsframe, int curvalue, int maxvalue, int width_at_max); 22 | void DrawNumberRAlign(int x, int y, int s, int num); 23 | void DrawTwoDigitNumber(int x, int y, int num); 24 | void DrawDigit(int x, int y, int digit); 25 | void niku_run(); 26 | void niku_draw(int value, bool force_white); 27 | 28 | 29 | /* located in sound/sound.cpp */ 30 | 31 | //-------------------[referenced from statusbar.cpp]-----------------// 32 | void sound(int snd); 33 | 34 | -------------------------------------------------------------------------------- /nx/statusbar.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _STATUSBAR_H 3 | #define _STATUSBAR_H 4 | 5 | struct PercentBar 6 | { 7 | int displayed_value; 8 | int dectimer; 9 | }; 10 | 11 | struct StatusBar 12 | { 13 | int xpflashcount; 14 | int xpflashstate; 15 | }; 16 | 17 | extern StatusBar statusbar; 18 | void niku_draw(int value, bool force_white=false); 19 | 20 | void stat_PrevWeapon(bool quiet=false); 21 | void stat_NextWeapon(bool quiet=false); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /nx/tan_table.h: -------------------------------------------------------------------------------- 1 | 0x0, 0xc9, 0x192, 0x25c, 0x326, 0x3f2, 0x4bf, 0x58d, 0x65d, 2 | 0x72f, 0x803, 0x8db, 0x9b5, 0xa92, 0xb73, 0xc58, 0xd41, 3 | 0xe2f, 0xf22, 0x101b, 0x111a, 0x1220, 0x132e, 0x1443, 0x1561, 4 | 0x1689, 0x17bb, 0x18f9, 0x1a43, 0x1b9a, 0x1d00, 0x1e77, 0x2000, 5 | 0x219c, 0x234e, 0x2518, 0x26fd, 0x2901, 0x2b25, 0x2d6f, 0x2fe4, 6 | 0x3288, 0x3563, 0x387c, 0x3bde, 0x3f92, 0x43a8, 0x4830, 0x4d41, 7 | 0x52f4, 0x596f, 0x60dd, 0x697d, 0x73a2, 0x7fc0, 0x8e80, 0xa0df, 8 | 0xb86b, 0xd7b9, 0x10373, 0x144e6, 0x1b1d0, 0x28b60, 0x51789 9 | -------------------------------------------------------------------------------- /nx/tilekey.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nx/tilekey.dat -------------------------------------------------------------------------------- /nx/tools/SoundList.vbp: -------------------------------------------------------------------------------- 1 | Type=Exe 2 | Form=frmSoundList.frm 3 | Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\WINDOWS\system32\stdole2.tlb#OLE Automation 4 | IconForm="frmSoundList" 5 | Startup="frmSoundList" 6 | Command32="" 7 | Name="Project1" 8 | HelpContextID="0" 9 | CompatibleMode="0" 10 | MajorVer=1 11 | MinorVer=0 12 | RevisionVer=0 13 | AutoIncrementVer=0 14 | ServerSupportFiles=0 15 | CompilationType=0 16 | OptimizationType=0 17 | FavorPentiumPro(tm)=0 18 | CodeViewDebugInfo=0 19 | NoAliasing=0 20 | BoundsCheck=0 21 | OverflowCheck=0 22 | FlPointCheck=0 23 | FDIVCheck=0 24 | UnroundedFP=0 25 | StartMode=0 26 | Unattended=0 27 | Retained=0 28 | ThreadPerObject=0 29 | MaxNumberOfThreads=1 30 | 31 | [MS Transaction Server] 32 | AutoRefresh=1 33 | -------------------------------------------------------------------------------- /nx/tools/SoundList.vbw: -------------------------------------------------------------------------------- 1 | frmSoundList = 88, 100, 900, 577, Z, 66, 75, 878, 552, C 2 | -------------------------------------------------------------------------------- /nx/tools/TileKey.vbp: -------------------------------------------------------------------------------- 1 | Type=Exe 2 | Form=frmTileKey.frm 3 | Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation 4 | IconForm="frmTileKey" 5 | Startup="frmTileKey" 6 | Command32="" 7 | Name="TileKey" 8 | HelpContextID="0" 9 | CompatibleMode="0" 10 | MajorVer=1 11 | MinorVer=0 12 | RevisionVer=0 13 | AutoIncrementVer=0 14 | ServerSupportFiles=0 15 | CompilationType=0 16 | OptimizationType=0 17 | FavorPentiumPro(tm)=0 18 | CodeViewDebugInfo=0 19 | NoAliasing=0 20 | BoundsCheck=0 21 | OverflowCheck=0 22 | FlPointCheck=0 23 | FDIVCheck=0 24 | UnroundedFP=0 25 | StartMode=0 26 | Unattended=0 27 | Retained=0 28 | ThreadPerObject=0 29 | MaxNumberOfThreads=1 30 | 31 | [MS Transaction Server] 32 | AutoRefresh=1 33 | -------------------------------------------------------------------------------- /nx/tools/TileKey.vbw: -------------------------------------------------------------------------------- 1 | frmTileKey = 44, 50, 856, 527, Z, 22, 25, 834, 502, C 2 | -------------------------------------------------------------------------------- /nx/tools/compile_genobjnametable: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo compiling.. 3 | gcc genobjnametable.cpp -o genobjnametable -lstdc++ 4 | rm ../autogen/objnames.cpp 5 | cd ..; tools/genobjnametable; cd tools 6 | -------------------------------------------------------------------------------- /nx/tools/extractmapinfo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nx/tools/extractmapinfo -------------------------------------------------------------------------------- /nx/tools/frmTileKey.frx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nx/tools/frmTileKey.frx -------------------------------------------------------------------------------- /nx/tools/genobjnametable: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nx/tools/genobjnametable -------------------------------------------------------------------------------- /nx/trig.fdh: -------------------------------------------------------------------------------- 1 | //hash:bef9350c 2 | //automatically generated by Makegen 3 | 4 | /* located in trig.cpp */ 5 | 6 | //---------------------[referenced from trig.cpp]--------------------// 7 | char trig_init(void); 8 | void vector_from_angle(uint8_t angle, int speed, int *xs, int *ys); 9 | int xinertia_from_angle(uint8_t angle, int speed); 10 | int yinertia_from_angle(uint8_t angle, int speed); 11 | uint8_t GetAngle(int curx, int cury, int tgtx, int tgty); 12 | void EmFireAngledShot(Object *o, int objtype, int rand_variance, int speed); 13 | void ThrowObjectAtPlayer(Object *o, int rand_variance, int speed); 14 | void ThrowObject(Object *o, int destx, int desty, int rand_variance, int speed); 15 | void ThrowObjectAtAngle(Object *o, uint8_t angle, int speed); 16 | 17 | 18 | /* located in ai/ai.cpp */ 19 | 20 | //---------------------[referenced from trig.cpp]--------------------// 21 | Object *SpawnObjectAtActionPoint(Object *o, int otype); 22 | 23 | 24 | /* located in common/misc.cpp */ 25 | 26 | //---------------------[referenced from trig.cpp]--------------------// 27 | int random(int min, int max); 28 | 29 | -------------------------------------------------------------------------------- /nx/trig.h: -------------------------------------------------------------------------------- 1 | 2 | extern signed int sin_table[256]; 3 | -------------------------------------------------------------------------------- /nxextract/SDL.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nxextract/SDL.dll -------------------------------------------------------------------------------- /nxextract/TextBox/ItemImage.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _ITEMIMAGE_H 3 | #define _ITEMIMAGE_H 4 | 5 | class TB_ItemImage 6 | { 7 | public: 8 | void ResetState(); 9 | void Draw(); 10 | 11 | void SetVisible(bool enable); 12 | void SetSprite(int sprite, int frame); 13 | 14 | private: 15 | bool fVisible; 16 | int fSprite, fFrame; 17 | int fYOffset; 18 | }; 19 | 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /nxextract/TextBox/SaveSelect.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SAVESELECT_H 3 | #define _SAVESELECT_H 4 | 5 | #define SS_LOADING 0 6 | #define SS_SAVING 1 7 | #define MAX_SAVE_SLOTS 5 8 | 9 | class TB_SaveSelect 10 | { 11 | public: 12 | TB_SaveSelect(); 13 | 14 | void ResetState(); 15 | void SetVisible(bool enable, bool saving=SS_LOADING); 16 | 17 | bool IsVisible(); 18 | void Draw(); 19 | 20 | private: 21 | void Run_Input(); 22 | void DrawProfile(int x, int y, int index); 23 | void DrawExtendedInfo(); 24 | 25 | bool fVisible; 26 | bool fSaving; 27 | int fCurSel; 28 | int fNumFiles; 29 | 30 | struct { int x, y, w, h; } fCoords; 31 | }; 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /nxextract/TextBox/StageSelect.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _STAGESELECT_H 3 | #define _STAGESELECT_H 4 | 5 | #define NUM_TELEPORTER_SLOTS 8 6 | 7 | struct Teleporter_Slot 8 | { 9 | int slotno; // which slot # this is (first param to PS+) 10 | int scriptno; // which script is run when selected (2nd param to PS+) 11 | }; 12 | 13 | class TB_StageSelect 14 | { 15 | public: 16 | TB_StageSelect(); 17 | 18 | void ResetState(); 19 | void SetVisible(bool enable); 20 | 21 | void SetSlot(int slotno, int scriptno); 22 | void ClearSlots(); 23 | bool GetSlotByIndex(int index, int *slotno_out=NULL, int *scriptno_out=NULL); 24 | int CountActiveSlots(); 25 | 26 | bool IsVisible(); 27 | void Draw(); 28 | 29 | private: 30 | void HandleInput(); 31 | void MoveSelection(int dir); 32 | void UpdateText(); 33 | 34 | bool fVisible; 35 | int fSlots[NUM_TELEPORTER_SLOTS]; // scripts used for slots 36 | 37 | int fWarpY; 38 | 39 | int fSelectionIndex; 40 | int fSelectionFrame; 41 | 42 | bool fLastButtonDown; 43 | bool fMadeSelection; 44 | }; 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /nxextract/TextBox/YesNoPrompt.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _YESNOPROMPT_H 3 | #define _YESNOPROMPT_H 4 | 5 | enum YNJResult 6 | { 7 | NO, 8 | YES 9 | }; 10 | 11 | class TB_YNJPrompt 12 | { 13 | public: 14 | void SetVisible(bool enable); 15 | void ResetState(); 16 | 17 | void Draw(); 18 | 19 | bool IsVisible() { return fVisible; } 20 | bool ResultReady(); // returns true if the user has selected a result 21 | int GetResult(); // returns YES or NO 22 | 23 | private: 24 | bool fVisible; 25 | struct { int y; } fCoords; 26 | 27 | int fState; 28 | int fTimer; 29 | 30 | int fAnswer; 31 | }; 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /nxextract/ai/IrregularBBox.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _IRREGULARBBOX_H 3 | #define _IRREGULARBBOX_H 4 | 5 | 6 | #define IB_MAX_BBOXES 4 7 | 8 | 9 | class IrregularBBox 10 | { 11 | public: 12 | bool init(Object *associatedObject, int max_rectangles); 13 | void destroy(); 14 | 15 | void set_damage(int dmg); 16 | void transmit_hits(); 17 | 18 | void place(void (*placefunc)(void *userparm), void *userparm); 19 | void set_bbox(int index, int x, int y, int w, int h, uint32_t flags); 20 | 21 | private: 22 | Object *bbox[IB_MAX_BBOXES]; 23 | int num_bboxes; 24 | Object *assoc_object; 25 | 26 | }; 27 | 28 | 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /nxextract/ai/almond/almond.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _ALMOND_H 3 | #define _ALMOND_H 4 | 5 | // states to control the water-level object 6 | #define WL_CALM 10 // calm and slow at set point 7 | 8 | #define WL_CYCLE 20 // cycles between set point and top of screen 9 | #define WL_DOWN 21 // in cycle--currently down 10 | #define WL_UP 22 // in cycle--currently up 11 | 12 | #define WL_STAY_UP 30 // goes to top of screen and doesn't come back down 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /nxextract/ai/balrog_common.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BALROG_COMMON_H 3 | #define _BALROG_COMMON_H 4 | 5 | void balrog_grab_player(Object *o); 6 | bool balrog_toss_player_away(Object *o); 7 | 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /nxextract/ai/boss/balfrog.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BALFROG_H 3 | #define _BALFROG_H 4 | 5 | #include "../IrregularBBox.h" 6 | 7 | class BalfrogBoss : public StageBoss 8 | { 9 | public: 10 | void OnMapEntry(); 11 | void Run(); 12 | 13 | void place_bboxes(); 14 | 15 | private: 16 | void RunDeathAnim(); 17 | void RunEntryAnim(); 18 | 19 | void RunFighting(); 20 | void RunJumping(); 21 | void RunShooting(); 22 | 23 | void SetJumpingSprite(bool enable); 24 | void SpawnFrogs(int objtype, int count); 25 | void SpawnSmoke(int count, int ytop); 26 | 27 | void set_bbox(int index, int x, int y, int w, int h, uint32_t flags); 28 | void transmit_bbox_hits(Object *box); 29 | 30 | Object *o; 31 | 32 | struct 33 | { 34 | int shakeflash; 35 | 36 | int orighp; 37 | int shots_fired; 38 | int attackcounter; 39 | 40 | Object *balrog; // balrog puppet for death scene 41 | 42 | // our group of multiple bboxes to simulate our irregular bounding box. 43 | IrregularBBox bboxes; 44 | int bbox_mode; 45 | 46 | } frog; 47 | }; 48 | 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /nxextract/ai/boss/ballos.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BALLOS_H 3 | #define _BALLOS_H 4 | 5 | #define NUM_EYES 2 6 | enum TRIGDIR { LESS_THAN=0, GREATER_THAN=1 }; 7 | 8 | class BallosBoss : public StageBoss 9 | { 10 | public: 11 | void OnMapEntry(); 12 | void Run(); 13 | void RunAftermove(); 14 | 15 | private: 16 | void RunForm1(Object *o); 17 | void RunForm2(Object *o); 18 | void RunForm3(Object *o); 19 | void RunComeDown(Object *o); 20 | void RunDefeated(Object *o); 21 | 22 | void run_eye(int index); 23 | void place_eye(int index); 24 | void SetEyeStates(int newstate); 25 | 26 | bool passed_xcoord(bool ltgt, int xcoord, bool reset=false); 27 | bool passed_ycoord(bool ltgt, int ycoord, bool reset=false); 28 | 29 | Object *main; 30 | Object *body; 31 | Object *eye[NUM_EYES]; 32 | Object *shield; // top shield to cover eyes from above 33 | }; 34 | 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /nxextract/ai/boss/core.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _COREBOSS_H 3 | #define _COREBOSS_H 4 | 5 | class CoreBoss : public StageBoss 6 | { 7 | public: 8 | void OnMapEntry(); 9 | void OnMapExit(); 10 | void Run(); 11 | 12 | private: 13 | void RunOpenMouth(); 14 | 15 | void StartWaterStream(void); 16 | void StopWaterStream(void); 17 | 18 | Object *o; 19 | Object *pieces[8]; 20 | int hittimer; 21 | }; 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /nxextract/ai/boss/heavypress.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _HEAVYPRESS_H 3 | #define _HEAVYPRESS_H 4 | 5 | 6 | class HeavyPress : public StageBoss 7 | { 8 | public: 9 | void OnMapEntry(); 10 | void Run(); 11 | 12 | private: 13 | void run_defeated(); 14 | void run_passageway(); 15 | 16 | Object *o; 17 | Object *shield_left, *shield_right; 18 | 19 | int uncover_left, uncover_right; 20 | int uncover_y; 21 | 22 | SIFRect fullwidth_bbox; 23 | SIFRect center_bbox; 24 | }; 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /nxextract/ai/boss/ironhead.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _IRONHEAD_H 3 | #define _IRONHEAD_H 4 | 5 | class IronheadBoss : public StageBoss 6 | { 7 | public: 8 | void OnMapEntry(); 9 | void OnMapExit(); 10 | void Run(); 11 | 12 | private: 13 | Object *o; 14 | int hittimer; 15 | }; 16 | 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /nxextract/ai/boss/omega.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _OMEGA_H 3 | #define _OMEGA_H 4 | 5 | 6 | class OmegaBoss : public StageBoss 7 | { 8 | public: 9 | void OnMapEntry(); 10 | void OnMapExit(); 11 | 12 | void Run(); 13 | 14 | private: 15 | 16 | Object *pieces[4]; 17 | 18 | struct 19 | { 20 | int timer; 21 | int animtimer; 22 | 23 | int movedir, movetime; 24 | int nextstate; 25 | 26 | int form; 27 | 28 | int firefreq, startfiring, stopfiring, endfirestate, shotxspd; 29 | int firecounter; 30 | 31 | int leg_descend; 32 | 33 | int orgx, orgy; 34 | 35 | int shaketimer; 36 | int lasthp; 37 | 38 | bool defeated; 39 | } omg; 40 | 41 | }; 42 | 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /nxextract/ai/boss/sisters.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SISTERS_H 3 | #define _SISTERS_H 4 | 5 | // although you will need to add additional copies of the head sprites 6 | // for it to work properly, just try setting this number to something 7 | // like 10 and running the fight! 8 | #define NUM_SISTERS 2 9 | 10 | class SistersBoss : public StageBoss 11 | { 12 | public: 13 | void OnMapEntry(); 14 | void OnMapExit(); 15 | void Run(); 16 | 17 | private: 18 | void run_head(int index); 19 | void head_set_bbox(int index); 20 | void run_body(int index); 21 | 22 | void SetHeadStates(int newstate); 23 | void SetBodyStates(int newstate); 24 | 25 | void SpawnScreenSmoke(int count); 26 | 27 | int mainangle; 28 | 29 | Object *main; 30 | Object *head[NUM_SISTERS]; 31 | Object *body[NUM_SISTERS]; 32 | }; 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /nxextract/ai/boss/undead_core.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _UNDEADCORE_BOSS_H 3 | #define _UNDEADCORE_BOSS_H 4 | 5 | #define NUM_ROTATORS 4 6 | enum BBoxes { BB_UPPER, BB_BACK, BB_LOWER, BB_TARGET, NUM_BBOXES }; 7 | 8 | enum UD_Faces 9 | { 10 | FACE_SKULL, 11 | FACE_TEETH, 12 | FACE_MOUTH, 13 | FACE_MOUTH_LIT, 14 | FACE_NONE 15 | }; 16 | 17 | class UDCoreBoss : public StageBoss 18 | { 19 | public: 20 | void OnMapEntry(); 21 | void OnMapExit(); 22 | void Run(); 23 | void RunAftermove(); 24 | 25 | private: 26 | bool RunDefeated(); 27 | void SpawnFaceSmoke(); 28 | void SpawnPellet(int dir); 29 | void RunHurtFlash(int timer); 30 | 31 | void run_front(Object *o); 32 | void run_face(Object *o); 33 | void run_back(Object *o); 34 | 35 | void move_bboxes(); 36 | void set_bbox_shootable(bool enable); 37 | 38 | Object *create_rotator(int angle, int front); 39 | void run_rotator(Object *o); 40 | void SetRotatorStates(int newstate); 41 | 42 | Object *main; 43 | Object *front, *back; 44 | Object *face; 45 | 46 | Object *rotator[NUM_ROTATORS]; 47 | Object *bbox[NUM_BBOXES]; 48 | 49 | }; 50 | 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /nxextract/ai/boss/x.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _XBOSS_H 3 | #define _XBOSS_H 4 | 5 | enum XBDir 6 | { 7 | UL, UR, LL, LR 8 | }; 9 | 10 | class XBoss : public StageBoss 11 | { 12 | public: 13 | void OnMapEntry(); 14 | void OnMapExit(); 15 | void Run(); 16 | void RunAftermove(); 17 | 18 | private: 19 | void run_tread(int index); 20 | void run_body(int index); 21 | void run_door(int index); 22 | void run_target(int index); 23 | void run_fishy_spawner(int index); 24 | void run_internals(); 25 | 26 | bool AllTargetsDestroyed(); 27 | void Init(); 28 | Object *CreateTread(int x, int y, int sprite); 29 | Object *CreatePiece(int x, int y, int type); 30 | 31 | void SetStates(Object *objects[], int nobjects, int state); 32 | void SetDirs(Object *objects[], int nobjects, int dir); 33 | 34 | void DeleteMonster(); 35 | 36 | Object *mainobject; 37 | Object *body[4]; 38 | Object *treads[4]; 39 | Object *internals; 40 | Object *doors[2]; 41 | Object *targets[4]; 42 | Object *fishspawners[4]; 43 | 44 | Object *piecelist[24]; 45 | int npieces; 46 | 47 | struct 48 | { 49 | bool initilized; 50 | } X; 51 | }; 52 | 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /nxextract/ai/final_battle/doctor.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _DOCTOR_H 3 | #define _DOCTOR_H 4 | 5 | extern int crystal_xmark, crystal_ymark; 6 | extern bool crystal_tofront; 7 | 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /nxextract/ai/weapons/weapons.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _WEAPONS_H 3 | #define _WEAPONS_H 4 | 5 | #include "../stdai.h" 6 | 7 | uint8_t run_shot(Object *o, bool destroys_blocks); 8 | enum run_shot_result 9 | { 10 | RS_NONE = 0, 11 | RS_HIT_ENEMY, 12 | RS_HIT_WALL, 13 | RS_TTL_EXPIRED 14 | }; 15 | 16 | Object *check_hit_enemy(Object *o, uint32_t flags_to_exclude=0); 17 | Object *damage_enemies(Object *o, uint32_t flags_to_exclude=0); 18 | int damage_multiple_enemies(Object *o, uint32_t flags_to_exclude=0); 19 | 20 | void shot_spawn_effect(Object *o, int effectno); 21 | void shot_dissipate(Object *o, int effectno = EFFECT_STARPOOF); 22 | bool shot_destroy_blocks(Object *o); 23 | 24 | bool IsBlockedInShotDir(Object *o); 25 | 26 | // --------------------------------------- 27 | 28 | // from Fireball code, shared with Snake 29 | Object *create_fire_trail(Object *o, int objtype, int level); 30 | 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /nxextract/ai/weapons/whimstar.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _WHIMSTAR_H 3 | #define _WHIMSTAR_H 4 | 5 | 6 | #define MAX_WHIMSTARS 3 7 | 8 | struct Whimstar 9 | { 10 | int x, y; 11 | int xinertia, yinertia; 12 | }; 13 | 14 | struct WhimsicalStar 15 | { 16 | Whimstar stars[MAX_WHIMSTARS]; 17 | int nstars; 18 | int stariter; 19 | }; 20 | 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /nxextract/autogen/asdefs.h: -------------------------------------------------------------------------------- 1 | 2 | // this is a small file that tells AssignSprites.cpp how to do it's job, 3 | // like glue that links it with the rest of the project in a project-independent way. 4 | #include "../nx.h" 5 | 6 | #define ASSIGN_SPRITE(OBJECT, SPRITE) \ 7 | objprop[OBJECT].sprite = SPRITE; 8 | -------------------------------------------------------------------------------- /nxextract/buildscript: -------------------------------------------------------------------------------- 1 | makegen 2 | make -j4 3 | %nx -------------------------------------------------------------------------------- /nxextract/common/DString.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _DSTRING_H 3 | #define _DSTRING_H 4 | 5 | #include "basics.h" 6 | #include "DBuffer.h" 7 | 8 | /* 9 | DString vs. DBuffer 10 | 11 | The difference is that with a DBuffer, if you AppendString() multiple times, 12 | you will get null-terminators in between each string. With a DString, 13 | the strings will be concatenated. You can override this behavior in a DBuffer 14 | by calling AppendStringNoNull instead of AppendString, but there is no function 15 | for inserting NULLs into a DString, as that doesn't make sense. 16 | */ 17 | 18 | class DString 19 | { 20 | public: 21 | DString(); 22 | DString(const char *string); 23 | DString(const char *string, int length); 24 | DString(DString &other); 25 | 26 | void SetTo(const char *string); 27 | void SetTo(const char *string, int length); 28 | void SetTo(DString *other); 29 | void SetTo(DString &other); 30 | 31 | void AppendString(const char *str); 32 | void AppendString(const char *str, int length); 33 | void AppendChar(uchar ch); 34 | 35 | void ReplaceString(const char *repstr_old, const char *repstr_new); 36 | void EnsureAlloc(int min_required); 37 | 38 | void Clear(); 39 | char *String(); 40 | int Length(); 41 | 42 | void ReplaceUnprintableChars(); 43 | 44 | private: 45 | DBuffer fBuffer; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /nxextract/common/FileBuffer.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "FileBuffer.h" 4 | 5 | FileBuffer::FileBuffer() 6 | { 7 | fMaxSize = 0; 8 | fFP = NULL; 9 | } 10 | 11 | void FileBuffer::SetBufferSize(int maxsize) 12 | { 13 | fMaxSize = maxsize; 14 | } 15 | 16 | void FileBuffer::SetFile(FILE *fp) 17 | { 18 | fFP = fp; 19 | } 20 | 21 | /* 22 | void c------------------------------() {} 23 | */ 24 | 25 | void FileBuffer::Write8(uint8_t data) 26 | { 27 | fBuffer.Append8(data); 28 | CheckFlush(fMaxSize); 29 | } 30 | 31 | void FileBuffer::Write16(uint16_t data) 32 | { 33 | fBuffer.Append16(data); 34 | CheckFlush(fMaxSize); 35 | } 36 | 37 | void FileBuffer::Write32(uint32_t data) 38 | { 39 | fBuffer.Append32(data); 40 | CheckFlush(fMaxSize); 41 | } 42 | 43 | /* 44 | void c------------------------------() {} 45 | */ 46 | 47 | void FileBuffer::CheckFlush(int maxsize) 48 | { 49 | if (fBuffer.Length() >= maxsize) 50 | { 51 | if (fFP) 52 | { 53 | //stat("CheckFlush wrote %d bytes", fBuffer.Length()); 54 | fwrite(fBuffer.Data(), fBuffer.Length(), 1, fFP); 55 | fBuffer.Clear(); 56 | } 57 | else 58 | { 59 | staterr("CheckFlush: no file"); 60 | } 61 | } 62 | } 63 | 64 | void FileBuffer::Flush() 65 | { 66 | CheckFlush(0); 67 | } 68 | 69 | void FileBuffer::Dump() 70 | { 71 | fBuffer.Clear(); 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /nxextract/common/FileBuffer.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _FILEBUFFER_H 3 | #define _FILEBUFFER_H 4 | 5 | #include "DBuffer.h" 6 | 7 | 8 | class FileBuffer 9 | { 10 | public: 11 | FileBuffer(); 12 | void SetBufferSize(int maxsize); 13 | void SetFile(FILE *fp); 14 | 15 | void Write8(uint8_t data); 16 | void Write16(uint16_t data); 17 | void Write32(uint32_t data); 18 | 19 | void Flush(); 20 | void Dump(); 21 | 22 | private: 23 | void CheckFlush(int maxsize); 24 | 25 | DBuffer fBuffer; 26 | int fMaxSize; 27 | 28 | FILE *fFP; 29 | }; 30 | 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /nxextract/common/InitList.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _INITLIST_H 3 | #define _INITLIST_H 4 | 5 | #define MAX_INIT_RECORDS 100 6 | 7 | class InitList 8 | { 9 | public: 10 | void AddFunction(void (*func)(void)); 11 | void AddFunction(bool (*func)(void)); 12 | void AddFunction(void *func); 13 | bool CallFunctions(); 14 | 15 | private: 16 | void *fFunctions[MAX_INIT_RECORDS]; 17 | int fCount; // counting on behavior of auto-initilization to 0 18 | }; 19 | 20 | class InitAdder 21 | { 22 | public: 23 | InitAdder(InitList *initlist, void (*func)(void)) { initlist->AddFunction(func); } 24 | InitAdder(InitList *initlist, bool (*func)(void)) { initlist->AddFunction(func); } 25 | InitAdder(InitList &initlist, void (*func)(void)) { initlist.AddFunction(func); } 26 | InitAdder(InitList &initlist, bool (*func)(void)) { initlist.AddFunction(func); } 27 | }; 28 | 29 | #define INITFUNC(TARGET) \ 30 | static void __InitFunc(void); \ 31 | static InitAdder _ia(TARGET, __InitFunc); \ 32 | static void __InitFunc(void) \ 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /nxextract/common/StringList.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _STRINGLIST_H 3 | #define _STRINGLIST_H 4 | 5 | #include "BList.h" 6 | 7 | class StringList : protected BList 8 | { 9 | public: 10 | StringList() { } 11 | 12 | StringList(const StringList &other) 13 | { 14 | *this = other; 15 | } 16 | 17 | virtual ~StringList(); 18 | 19 | void AddString(const char *str); 20 | char *StringAt(int index) const; 21 | bool SetString(int index, const char *newstring); 22 | void MakeEmpty(); 23 | 24 | void Shuffle(); 25 | bool ContainsString(const char *term); 26 | bool ContainsCaseString(const char *term); 27 | void RemoveString(int index); 28 | void RemoveString(const char *str); 29 | void RemoveIString(const char *str); 30 | 31 | void SwapItems(int index1, int index2); 32 | void DumpContents(); 33 | 34 | int32_t CountItems() const { return BList::CountItems(); } 35 | 36 | StringList &operator= (const StringList &other); 37 | bool operator== (const StringList &other) const; 38 | bool operator!= (const StringList &other) const; 39 | }; 40 | 41 | 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /nxextract/common/basics.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BASICS_H 3 | #define _BASICS_H 4 | 5 | #include 6 | 7 | #ifdef __clang__ 8 | #define MAXPATHLEN 256 9 | #else 10 | #include // MAXPATHLEN 11 | #endif 12 | 13 | #ifndef PATH_MAX 14 | #define PATH_MAX 259 15 | #endif 16 | 17 | typedef unsigned char uchar; 18 | 19 | 20 | void stat(const char *fmt, ...); 21 | void staterr(const char *fmt, ...); 22 | #define ASSERT(X) \ 23 | { \ 24 | if (!(X)) \ 25 | { \ 26 | staterr("** ASSERT FAILED: '%s' at %s(%d)", #X, __FILE__, __LINE__); \ 27 | exit(1); \ 28 | } \ 29 | } 30 | 31 | #define SWAP(A, B) { A ^= B; B ^= A; A ^= B; } 32 | 33 | #ifndef MIN 34 | #define MIN(A, B) ( ( (A) < (B) ) ? (A) : (B) ) 35 | #endif 36 | 37 | #ifndef MAX 38 | #define MAX(A, B) ( ( (A) > (B) ) ? (A) : (B) ) 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /nxextract/common/bufio.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BUFIO_H 3 | #define _BUFIO_H 4 | 5 | #include "bufio.fdh" 6 | 7 | void write_Variable(DBuffer *out, const uint8_t *data, int len); 8 | void write_Variable(DBuffer *out, DBuffer *in); 9 | 10 | 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /nxextract/config.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _CONFIG_H 3 | #define _CONFIG_H 4 | 5 | // if set graphics scaling factor is changable at runtime (otherwise it's a #define) 6 | #define CONFIG_MUTABLE_SCALE 7 | 8 | // SDL_ttf support. if turned off SDL_ttf will not be required but only 9 | // bitmap fonts will be supported. 10 | //#define CONFIG_ENABLE_TTF 11 | 12 | // include the Doukutsu data-file extractor in the build 13 | // (it's needed only the first time the program is run). 14 | #define CONFIG_DATA_EXTRACTOR 15 | 16 | // do image scaling in hardware via OpenGL 17 | //#define CONFIG_OPENGL 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /nxextract/debug.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _DEBUG_H 3 | #define _DEBUG_H 4 | 5 | #define DM_PIXEL 0 6 | #define DM_CROSSHAIR 1 7 | #define DM_XLINE 2 8 | #define DM_YLINE 3 9 | #define DM_BOX 4 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /nxextract/dirnames.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | extern const char *data_dir; 4 | extern const char *stage_dir; 5 | extern const char *pic_dir; 6 | extern const char *savegamename; 7 | extern const char *nxdata_dir; 8 | -------------------------------------------------------------------------------- /nxextract/endgame/CredReader.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _CREDITS_READER_H 3 | #define _CREDITS_READER_H 4 | 5 | enum CC 6 | { 7 | CC_TEXT = '[', 8 | CC_SET_XOFF = '+', 9 | CC_BLANK_SPACE = '-', 10 | 11 | CC_JUMP = 'j', 12 | CC_FLAGJUMP = 'f', 13 | CC_LABEL = 'l', 14 | 15 | CC_MUSIC = '!', 16 | CC_FADE_MUSIC = '~', 17 | CC_END = '/' 18 | }; 19 | 20 | // represents a command from the .tsc 21 | struct CredCommand 22 | { 23 | int type; 24 | int parm, parm2; 25 | char text[80]; 26 | 27 | void DumpContents(); 28 | }; 29 | 30 | class CredReader 31 | { 32 | public: 33 | CredReader(); 34 | bool OpenFile(); 35 | void CloseFile(); 36 | bool ReadCommand(CredCommand *cmd); 37 | void Rewind(); 38 | 39 | private: 40 | int ReadNumber(); 41 | char get(); 42 | void unget(); 43 | char peek(); 44 | 45 | char *data; 46 | int dataindex, datalen; 47 | }; 48 | 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /nxextract/endgame/island.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _ISLAND_H 3 | #define _ISLAND_H 4 | 5 | bool island_init(int survives); 6 | void island_tick(); 7 | 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /nxextract/extract/crc.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include "crc.fdh" 6 | 7 | static uint32_t CRC_Table[256]; 8 | static const uint32_t poly = 0x04c11db7; 9 | 10 | void crc_init(void) 11 | { 12 | int i, j; 13 | 14 | for(i=0;i<256;i++) 15 | { 16 | CRC_Table[i] = reflect(i, 8) << 24; 17 | 18 | for(j=0;j<8;j++) 19 | CRC_Table[i] = (CRC_Table[i] << 1) ^ ((CRC_Table[i] & (1 << 31)) ? poly : 0); 20 | 21 | CRC_Table[i] = reflect(CRC_Table[i], 32); 22 | } 23 | } 24 | 25 | uint32_t crc_calc(uint8_t *buf, uint32_t size) 26 | { 27 | uint32_t crc = 0xFFFFFFFF; 28 | 29 | while(size) 30 | { 31 | crc = (crc >> 8) ^ CRC_Table[(crc & 0xFF) ^ *buf++]; 32 | size--; 33 | } 34 | 35 | return (crc ^ 0xFFFFFFFF); 36 | } 37 | 38 | 39 | static uint32_t reflect(uint32_t value, int size) 40 | { 41 | uint32_t newbits = 0; 42 | int i; 43 | 44 | for(i=1;i<=size;i++) 45 | { 46 | if (value & 1) 47 | newbits |= (1 << (size - i)); 48 | 49 | value >>= 1; 50 | } 51 | 52 | return newbits; 53 | } 54 | 55 | 56 | -------------------------------------------------------------------------------- /nxextract/floattext.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _FLOATTEXT_H 3 | #define _FLOATTEXT_H 4 | 5 | #define FT_Y_START -4 // this starts it exactly centered, since the font is 8px tall 6 | #define FT_Y_HOLD -19 7 | #define FT_Y_RISEAWAY (FT_Y_HOLD - 8) 8 | 9 | enum FloatTextStates 10 | { 11 | FT_IDLE, 12 | FT_RISE, 13 | FT_HOLD, 14 | FT_SCROLL_AWAY, 15 | }; 16 | 17 | class FloatText 18 | { 19 | public: 20 | FloatText(int sprite); 21 | ~FloatText(); 22 | void Reset(); 23 | 24 | void AddQty(int amt); 25 | bool IsScrollingAway(); 26 | 27 | void UpdatePos(Object *assoc_object); 28 | 29 | static void DrawAll(); 30 | static void DeleteAll(); 31 | static void ResetAll(void); 32 | 33 | bool ObjectDestroyed; 34 | 35 | private: 36 | void Draw(); 37 | 38 | uint8_t state; 39 | 40 | int yoff; // how much we've risen 41 | int shownAmount; 42 | int sprite; // allows selecting font 43 | int timer; 44 | 45 | SDL_Rect cliprect; 46 | int objX, objY; // the center pixel of the associated object (de-CSFd) 47 | 48 | 49 | FloatText *next, *prev; 50 | static FloatText *first, *last; 51 | }; 52 | 53 | 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /nxextract/font.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nxextract/font.ttf -------------------------------------------------------------------------------- /nxextract/graphics/palette.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _PALETTE_H 3 | #define _PALETTE_H 4 | 5 | 6 | 7 | 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /nxextract/graphics/safemode.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SAFEMODE_H 3 | #define _SAFEMODE_H 4 | 5 | enum // special Y positioning arguments for moveto 6 | { 7 | SM_UPPER_THIRD = -1, 8 | SM_CENTER = -2, 9 | SM_LOWER_THIRD = -3, 10 | SM_NONE = -4, 11 | SM_MIDUPPER_Y = -5 12 | }; 13 | 14 | namespace safemode 15 | { 16 | bool init(); 17 | void close(); 18 | 19 | void moveto(int y); 20 | bool print(const char *fmt, ...); 21 | void clear(); 22 | 23 | void status(const char *fmt, ...); 24 | void clearstatus(); 25 | 26 | int run_until_key(bool delay=true); 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /nxextract/graphics/sprites.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SPRITES_H 3 | #define _SPRITES_H 4 | 5 | #define MAX_SPRITESHEETS 64 6 | #define MAX_SPRITES 512 7 | 8 | #include "../siflib/sif.h" 9 | extern SIFSprite sprites[MAX_SPRITES]; 10 | 11 | 12 | namespace Sprites 13 | { 14 | bool Init(); 15 | void Close(); 16 | void FlushSheets(); 17 | 18 | static void LoadSheetIfNeeded(int spr); 19 | 20 | static void BlitSprite(int x, int y, int s, int frame, uint8_t dir, \ 21 | int xoff, int yoff, int wd, int ht); 22 | 23 | 24 | void draw_sprite(int x, int y, int s, int frame=0, uint8_t dir=0); 25 | void draw_sprite_at_dp(int x, int y, int s, int frame=0, uint8_t dir=0); 26 | void draw_sprite_clipped(int x, int y, int s, int frame, uint8_t dir, int clipx1, int clipx2, int clipy1, int clipy2); 27 | void draw_sprite_clip_width(int x, int y, int s, int frame, int wd); 28 | void draw_sprite_chopped(int x, int y, int s, int frame, int wd, int repeat_at); 29 | void draw_sprite_repeating_x(int x, int y, int s, int frame, int wd); 30 | 31 | NXSurface *get_spritesheet(int sheetno); 32 | int create_spritesheet(int wd, int ht); 33 | void draw_sprite_to_surface(NXSurface *dst, int x, int y, int s, int frame, uint8_t dir); 34 | 35 | }; 36 | 37 | 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /nxextract/graphics/tileset.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _TILESET_H 3 | #define _TILESET_H 4 | 5 | #define TILE_W 16 6 | #define TILE_H 16 7 | 8 | namespace Tileset 9 | { 10 | bool Init(); 11 | void Close(); 12 | 13 | bool Load(int new_tileset); 14 | void Reload(); 15 | void draw_tile(int x, int y, int t); 16 | 17 | NXSurface *GetSurface(); 18 | }; 19 | 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /nxextract/input.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _INPUT_H 3 | #define _INPUT_H 4 | 5 | enum INPUTS 6 | { 7 | LEFTKEY, RIGHTKEY, UPKEY, DOWNKEY, 8 | JUMPKEY, FIREKEY, 9 | PREVWPNKEY, NEXTWPNKEY, 10 | INVENTORYKEY, MAPSYSTEMKEY, 11 | 12 | ESCKEY, 13 | F1KEY, 14 | F2KEY, 15 | F3KEY, 16 | F4KEY, 17 | F5KEY, 18 | F6KEY, 19 | F7KEY, 20 | F8KEY, 21 | F9KEY, 22 | F10KEY, 23 | F11KEY, 24 | F12KEY, 25 | 26 | FREEZE_FRAME_KEY, 27 | FRAME_ADVANCE_KEY, 28 | DEBUG_FLY_KEY, 29 | 30 | INPUT_COUNT 31 | }; 32 | 33 | #define LASTCONTROLKEY MAPSYSTEMKEY 34 | 35 | #define DEBUG_GOD_KEY F1KEY 36 | #define DEBUG_MOVE_KEY F2KEY 37 | #define DEBUG_SAVE_KEY F4KEY 38 | #define FFWDKEY F5KEY 39 | 40 | extern bool inputs[INPUT_COUNT]; 41 | extern bool lastinputs[INPUT_COUNT]; 42 | extern int last_sdl_key; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /nxextract/intro/intro.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _INTRO_H 3 | #define _INTRO_H 4 | 5 | 6 | bool intro_init(int param); 7 | void intro_tick(); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /nxextract/intro/title.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _TITLE_H 3 | #define _TITLE_H 4 | 5 | 6 | bool title_init(int param); 7 | void title_tick(); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /nxextract/map_system.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _MAPSYSTEM_H 3 | #define _MAPSYSTEM_H 4 | 5 | 6 | bool ms_init(int param); 7 | void ms_tick(void); 8 | void ms_close(void); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /nxextract/maprecord.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _MAPRECORD_H 3 | #define _MAPRECORD_H 4 | 5 | #define MAX_STAGES 120 6 | struct MapRecord 7 | { 8 | char filename[32]; 9 | char stagename[35]; 10 | 11 | uint8_t tileset; 12 | uint8_t bg_no; 13 | uint8_t scroll_type; 14 | uint8_t bossNo; 15 | uint8_t NPCset1; 16 | uint8_t NPCset2; 17 | }; 18 | extern MapRecord stages[MAX_STAGES]; 19 | extern int num_stages; 20 | 21 | #define STAGE_SAND 10 22 | #define STAGE_START_POINT 13 23 | #define STAGE_IRONH 31 24 | #define STAGE_BOULDER_CHAMBER 44 25 | #define STAGE_MAZE_M 45 26 | #define STAGE_ALMOND 47 27 | #define STAGE_WATERWAY 48 28 | #define STAGE_KINGS_TABLE 65 29 | #define STAGE_HELL1 80 30 | #define STAGE_HELL2 81 31 | #define STAGE_HELL3 82 32 | #define STAGE_HELL4 84 33 | #define STAGE_HELL42 85 34 | #define STAGE_STATUE_CHAMBER 86 35 | #define STAGE_SEAL_CHAMBER 87 36 | #define STAGE_SEAL_CHAMBER_2 92 37 | #define STAGE_CORRIDOR 88 38 | #define STAGE_KINGS 72 // intro 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /nxextract/nxce/buildscript: -------------------------------------------------------------------------------- 1 | cd .. 2 | makegen wince.ml +q 3 | #tools/genobjnametable 4 | LD_LIBRARY_PATH="/opt/lib32/usr/lib/" make -j4 5 | 6 | %cd nxce 7 | %~/dev/jlime/ceremote/ceremote 192.168.131.201 8 | hide 9 | -------------------------------------------------------------------------------- /nxextract/nxce/remotescript: -------------------------------------------------------------------------------- 1 | send ../nxce.exe \nxce\nxce.exe 2 | exec \nxce\nxce.exe 3 | exit 4 | -------------------------------------------------------------------------------- /nxextract/pause/message.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _MESSAGE_H 3 | #define _MESSAGE_H 4 | 5 | #include "options.h" 6 | namespace Options { 7 | 8 | class Message : public FocusHolder 9 | { 10 | public: 11 | Message(const char *msg, const char *msg2 = NULL); 12 | ~Message(); 13 | 14 | void Draw(); 15 | void RunInput(); 16 | 17 | int *rawKeyReturn; 18 | void (*on_dismiss)(Message *msg); 19 | 20 | private: 21 | char *fMsg, *fMsg2; 22 | int fMsgX, fMsgY; 23 | int fMsg2X, fMsg2Y; 24 | 25 | int fShowDelay; 26 | }; 27 | 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /nxextract/pause/options.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _OPTIONS_H 3 | #define _OPTIONS_H 4 | 5 | namespace Options 6 | { 7 | // class for something like a dialog box that can hold the focus. 8 | // there is a stack of them. everyone in the stack is drawn, 9 | // and the topmost one receives HandleKey events. 10 | class FocusHolder 11 | { 12 | public: 13 | virtual ~FocusHolder() { } 14 | 15 | virtual void Draw() = 0; 16 | virtual void RunInput() = 0; 17 | }; 18 | 19 | 20 | class FocusStack : public BList 21 | { 22 | public: 23 | FocusHolder *ItemAt(int index) { return (FocusHolder *)BList::ItemAt(index); } 24 | }; 25 | 26 | 27 | void init_objects(); 28 | void close_objects(); 29 | void run_and_draw_objects(void); 30 | Object *create_object(int x, int y, int type); 31 | 32 | }; // end namespace 33 | 34 | 35 | bool options_init(int param); 36 | void options_tick(void); 37 | void options_close(void); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /nxextract/pause/pause.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "../nx.h" 3 | #include "pause.fdh" 4 | 5 | bool pause_init(int param) 6 | { 7 | memset(lastinputs, 1, sizeof(lastinputs)); 8 | return 0; 9 | } 10 | 11 | void pause_tick() 12 | { 13 | ClearScreen(BLACK); 14 | 15 | int cx = (SCREEN_WIDTH / 2) - (sprites[SPR_RESETPROMPT].w / 2); 16 | int cy = (SCREEN_HEIGHT / 2) - (sprites[SPR_RESETPROMPT].h / 2); 17 | draw_sprite(cx, cy, SPR_RESETPROMPT); 18 | 19 | const char *str = "F3:Options"; 20 | cx = (SCREEN_WIDTH / 2) - (GetFontWidth(str, 0) / 2) - 4; 21 | cy = (SCREEN_HEIGHT - 8) - GetFontHeight(); 22 | int f3wd = font_draw(cx, cy, "F3", 0); 23 | font_draw(cx + f3wd, cy, ":Options", 0, &bluefont); 24 | 25 | // resume 26 | if (justpushed(F1KEY)) 27 | { 28 | lastinputs[F1KEY] = true; 29 | game.pause(false); 30 | return; 31 | } 32 | 33 | // reset 34 | if (justpushed(F2KEY)) 35 | { 36 | lastinputs[F2KEY] = true; 37 | game.reset(); 38 | return; 39 | } 40 | 41 | // exit 42 | if (justpushed(ESCKEY)) 43 | { 44 | lastinputs[ESCKEY] = true; 45 | game.running = false; 46 | return; 47 | } 48 | } 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /nxextract/pause/pause.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _PAUSE_H 3 | #define _PAUSE_H 4 | 5 | 6 | bool pause_init(int retmode); 7 | void pause_tick(void); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /nxextract/platform.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include "config.h" 5 | #include "platform.fdh" 6 | 7 | #ifndef __SDLSHIM__ 8 | 9 | FILE *fileopen(const char *fname, const char *mode) 10 | { 11 | return fopen(fname, mode); 12 | } 13 | 14 | #else 15 | 16 | FILE *fileopen(const char *fname, const char *mode) 17 | { 18 | return SDLS_fopen(fname, mode); 19 | } 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /nxextract/platform.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _PLATFORM_H 3 | #define _PLATFORM_H 4 | 5 | extern "C" 6 | { 7 | void platform_sync_to_vblank(void); 8 | }; 9 | 10 | 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /nxextract/platform/Linux/vbesync.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #define DRM_VBLANK_RELATIVE 0x1 7 | #if 0 8 | void platform_sync_to_vblank(void) 9 | { 10 | static char initilized = 0; 11 | static int fd; 12 | int ret; 13 | 14 | if (!initilized) 15 | { 16 | initilized = 1; 17 | 18 | printf("Linux vbesync: opening DRM card interface...\n"); 19 | fd = open("/dev/dri/card0", O_RDWR); 20 | if (fd == -1) 21 | { 22 | printf("Failed to open DRM interface; sync-to-vblank will not be done.\n"); 23 | return; 24 | } 25 | 26 | printf("Linux vbesync: DRM-based sync-to-vblank activated.\n"); 27 | } 28 | else if (fd == -1) 29 | { 30 | return; 31 | } 32 | 33 | drm_wait_vblank_t vbl; 34 | 35 | vbl.request.type = DRM_VBLANK_RELATIVE; 36 | vbl.request.sequence = 1; 37 | 38 | do 39 | { 40 | ret = ioctl(fd, DRM_IOCTL_WAIT_VBLANK, vbl); 41 | vbl.request.type &= ~DRM_VBLANK_RELATIVE; 42 | } 43 | while(ret && errno == EINTR); 44 | 45 | } 46 | #endif 47 | -------------------------------------------------------------------------------- /nxextract/profile.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _PROFILE_H 3 | #define _PROFILE_H 4 | 5 | // how many bytes of data long a profile.dat is. 6 | // used by the replays which use the regular profile functions 7 | // to write a savefile then tack their own data onto the end. 8 | #define PROFILE_LENGTH 0x604 9 | 10 | struct Profile 11 | { 12 | int stage; 13 | int songno; 14 | int px, py, pdir; 15 | int hp, maxhp, num_whimstars; 16 | uint32_t equipmask; 17 | 18 | int curWeapon; 19 | struct 20 | { 21 | bool hasWeapon; 22 | int level; 23 | int xp; 24 | int ammo, maxammo; 25 | } weapons[WPN_COUNT]; 26 | 27 | int inventory[MAX_INVENTORY]; 28 | int ninventory; 29 | 30 | bool flags[NUM_GAMEFLAGS]; 31 | 32 | struct 33 | { 34 | int slotno; 35 | int scriptno; 36 | } teleslots[NUM_TELEPORTER_SLOTS]; 37 | int num_teleslots; 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /nxextract/settings.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SETTINGS_H 3 | #define _SETTINGS_H 4 | 5 | #include "input.h" 6 | 7 | struct Settings 8 | { 9 | uint16_t version; 10 | int resolution; 11 | int last_save_slot; 12 | bool multisave; 13 | bool files_extracted; 14 | bool show_fps; 15 | bool displayformat; 16 | 17 | bool enable_debug_keys; 18 | bool sound_enabled; 19 | int music_enabled; 20 | 21 | bool instant_quit; 22 | bool emulate_bugs; 23 | bool no_quake_in_hell; 24 | bool inhibit_fullscreen; 25 | 26 | bool skip_intro; 27 | int reserved[8]; 28 | 29 | int input_mappings[INPUT_COUNT]; 30 | }; 31 | 32 | bool settings_load(Settings *settings=NULL); 33 | bool settings_save(Settings *settings=NULL); 34 | 35 | extern Settings *settings; 36 | extern Settings normal_settings; 37 | extern Settings replay_settings; 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /nxextract/siflib/sectStringArray.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SECT_STRINGARRAY_H 3 | #define _SECT_STRINGARRAY_H 4 | 5 | class StringList; 6 | class DString; 7 | class DBuffer; 8 | 9 | // the SectStringArray handler decodes sif sections which consist of an array 10 | // of pascal strings. This includes SIF_SECTION_SHEETS and SIF_SECTION_DIRECTORY. 11 | 12 | class SIFStringArraySect 13 | { 14 | public: 15 | static bool Decode(const uint8_t *data, int datalen, StringList *out); 16 | static uint8_t *Encode(StringList *strings, int *datalen_out); 17 | 18 | static void ReadPascalString(const uint8_t **data, const uint8_t *data_end, DString *out); 19 | static void WritePascalString(const char *str, DBuffer *out); 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /nxextract/siflib/sifupgrade.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nxextract/siflib/sifupgrade.cpp -------------------------------------------------------------------------------- /nxextract/slope.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SLOPE_H 3 | #define _SLOPE_H 4 | 5 | // slope types 6 | #define SLOPE_CEIL_FWD1 1 7 | #define SLOPE_CEIL_FWD2 2 8 | #define SLOPE_CEIL_BACK1 3 9 | #define SLOPE_CEIL_BACK2 4 10 | 11 | #define SLOPE_BACK1 5 12 | #define SLOPE_BACK2 6 13 | #define SLOPE_FWD1 7 14 | #define SLOPE_FWD2 8 15 | 16 | #define SLOPE_LAST 8 17 | 18 | struct SlopeTable 19 | { 20 | uint8_t table[TILE_W][TILE_H]; 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /nxextract/smalfont.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nxextract/smalfont.bmp -------------------------------------------------------------------------------- /nxextract/sound/sslib.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SSLIB_H 3 | #define _SSLIB_H 4 | 5 | #define SAMPLE_RATE 22050 6 | #define MAX_QUEUED_CHUNKS (180 +1) 7 | #define SS_NUM_CHANNELS 16 8 | 9 | struct SSChunk 10 | { 11 | signed short *buffer; 12 | int length; 13 | 14 | signed char *bytebuffer; // same as bytebuffer but in BYTES 15 | int bytelength; // TOTAL length in BYTES 16 | 17 | // current read position. this is within bytebuffer and is in BYTES. 18 | int bytepos; 19 | 20 | int userdata; // user data to be sent to FinishedCallback when finished 21 | }; 22 | 23 | 24 | struct SSChannel 25 | { 26 | SSChunk chunks[MAX_QUEUED_CHUNKS]; 27 | int head, tail; 28 | 29 | int volume; 30 | char reserved; // if 1, can only be played on explicitly, not by passing -1 31 | 32 | int FinishedChunkUserdata[MAX_QUEUED_CHUNKS]; 33 | int nFinishedChunks; 34 | 35 | void (*FinishedCB)(int channel, int chunkid); 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /nxextract/sprites.sif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nxextract/sprites.sif -------------------------------------------------------------------------------- /nxextract/stagedata.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include "stagedata.h" 5 | 6 | const char *backdrop_names[] = { 7 | "bk0", 8 | "bkBlue", 9 | "bkGreen", 10 | "bkBlack", 11 | "bkGard", 12 | "bkMaze", 13 | "bkGray", 14 | "bkRed", 15 | "bkWater", 16 | "bkMoon", 17 | "bkFog", 18 | "bkFall", 19 | NULL 20 | }; 21 | 22 | const char *tileset_names[] = { 23 | "0", 24 | "Pens", 25 | "Eggs", 26 | "EggX", 27 | "EggIn", 28 | "Store", 29 | "Weed", 30 | "Barr", 31 | "Maze", 32 | "Sand", 33 | "Mimi", 34 | "Cave", 35 | "River", 36 | "Gard", 37 | "Almond", 38 | "Oside", 39 | "Cent", 40 | "Jail", 41 | "White", 42 | "Fall", 43 | "Hell", 44 | "Labo", 45 | NULL 46 | }; 47 | 48 | -------------------------------------------------------------------------------- /nxextract/stagedata.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _STAGEDATA_H 3 | #define _STAGEDATA_H 4 | 5 | //#define NMAPS 120 6 | //extern MapRecord stages[NMAPS]; 7 | 8 | #define NUM_BACKDROPS 12 9 | #define NUM_TILESETS 22 10 | 11 | extern const char *backdrop_names[]; 12 | extern const char *tileset_names[]; 13 | 14 | 15 | #define NPCSET_GUEST 0 16 | #define NPCSET_0 1 17 | #define NPCSET_EGGS1 2 18 | #define NPCSET_RAVIL 3 19 | #define NPCSET_WEED 4 20 | #define NPCSET_MAZE 5 21 | #define NPCSET_SAND 6 22 | #define NPCSET_OMG 7 23 | #define NPCSET_CEMET 8 24 | #define NPCSET_BLLG 9 25 | #define NPCSET_PLANT 10 26 | #define NPCSET_FROG 11 27 | #define NPCSET_CURLY 12 28 | #define NPCSET_STREAM 13 29 | #define NPCSET_IRONH 14 30 | #define NPCSET_TORO 15 31 | #define NPCSET_X 16 32 | #define NPCSET_DARK 17 33 | #define NPCSET_ALMO1 18 34 | #define NPCSET_EGGS2 19 35 | #define NPCSET_TWIND 20 36 | #define NPCSET_MOON 21 37 | #define NPCSET_CENT 22 38 | #define NPCSET_HERI 23 39 | #define NPCSET_RED 24 40 | #define NPCSET_MIZA 25 41 | #define NPCSET_DR 26 42 | #define NPCSET_ALMO2 27 43 | #define NPCSET_KINGS 28 44 | #define NPCSET_HELL 29 45 | #define NPCSET_PRESS 30 46 | #define NPCSET_PRIEST 31 47 | #define NPCSET_BALLOS 32 48 | #define NPCSET_ISLAND 33 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /nxextract/statusbar.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _STATUSBAR_H 3 | #define _STATUSBAR_H 4 | 5 | struct PercentBar 6 | { 7 | int displayed_value; 8 | int dectimer; 9 | }; 10 | 11 | struct StatusBar 12 | { 13 | int xpflashcount; 14 | int xpflashstate; 15 | }; 16 | 17 | extern StatusBar statusbar; 18 | void niku_draw(int value, bool force_white=false); 19 | 20 | void stat_PrevWeapon(bool quiet=false); 21 | void stat_NextWeapon(bool quiet=false); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /nxextract/tilekey.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nxextract/tilekey.dat -------------------------------------------------------------------------------- /nxextract/tools/SoundList.vbp: -------------------------------------------------------------------------------- 1 | Type=Exe 2 | Form=frmSoundList.frm 3 | Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\WINDOWS\system32\stdole2.tlb#OLE Automation 4 | IconForm="frmSoundList" 5 | Startup="frmSoundList" 6 | Command32="" 7 | Name="Project1" 8 | HelpContextID="0" 9 | CompatibleMode="0" 10 | MajorVer=1 11 | MinorVer=0 12 | RevisionVer=0 13 | AutoIncrementVer=0 14 | ServerSupportFiles=0 15 | CompilationType=0 16 | OptimizationType=0 17 | FavorPentiumPro(tm)=0 18 | CodeViewDebugInfo=0 19 | NoAliasing=0 20 | BoundsCheck=0 21 | OverflowCheck=0 22 | FlPointCheck=0 23 | FDIVCheck=0 24 | UnroundedFP=0 25 | StartMode=0 26 | Unattended=0 27 | Retained=0 28 | ThreadPerObject=0 29 | MaxNumberOfThreads=1 30 | 31 | [MS Transaction Server] 32 | AutoRefresh=1 33 | -------------------------------------------------------------------------------- /nxextract/tools/SoundList.vbw: -------------------------------------------------------------------------------- 1 | frmSoundList = 88, 100, 900, 577, Z, 66, 75, 878, 552, C 2 | -------------------------------------------------------------------------------- /nxextract/tools/TileKey.vbp: -------------------------------------------------------------------------------- 1 | Type=Exe 2 | Form=frmTileKey.frm 3 | Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation 4 | IconForm="frmTileKey" 5 | Startup="frmTileKey" 6 | Command32="" 7 | Name="TileKey" 8 | HelpContextID="0" 9 | CompatibleMode="0" 10 | MajorVer=1 11 | MinorVer=0 12 | RevisionVer=0 13 | AutoIncrementVer=0 14 | ServerSupportFiles=0 15 | CompilationType=0 16 | OptimizationType=0 17 | FavorPentiumPro(tm)=0 18 | CodeViewDebugInfo=0 19 | NoAliasing=0 20 | BoundsCheck=0 21 | OverflowCheck=0 22 | FlPointCheck=0 23 | FDIVCheck=0 24 | UnroundedFP=0 25 | StartMode=0 26 | Unattended=0 27 | Retained=0 28 | ThreadPerObject=0 29 | MaxNumberOfThreads=1 30 | 31 | [MS Transaction Server] 32 | AutoRefresh=1 33 | -------------------------------------------------------------------------------- /nxextract/tools/TileKey.vbw: -------------------------------------------------------------------------------- 1 | frmTileKey = 44, 50, 856, 527, Z, 22, 25, 834, 502, C 2 | -------------------------------------------------------------------------------- /nxextract/tools/compile_genobjnametable: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo compiling.. 3 | gcc genobjnametable.cpp -o genobjnametable -lstdc++ 4 | rm ../autogen/objnames.cpp 5 | cd ..; tools/genobjnametable; cd tools 6 | -------------------------------------------------------------------------------- /nxextract/tools/extractmapinfo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nxextract/tools/extractmapinfo -------------------------------------------------------------------------------- /nxextract/tools/frmTileKey.frx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nxextract/tools/frmTileKey.frx -------------------------------------------------------------------------------- /nxextract/tools/genobjnametable: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/histat/dc-nx/daf26f82ae82081947c07380b38d4089f41fda60/nxextract/tools/genobjnametable -------------------------------------------------------------------------------- /nxextract/trig.h: -------------------------------------------------------------------------------- 1 | 2 | extern signed int sin_table[256]; 3 | -------------------------------------------------------------------------------- /sdlshim/SDL/audio.fdh: -------------------------------------------------------------------------------- 1 | //hash:257c20bb 2 | //automatically generated by Makegen 3 | 4 | /* located in SDL/audio.cpp */ 5 | 6 | //-------------------[referenced from SDL/audio.cpp]-----------------// 7 | int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained); 8 | void SDL_PauseAudio(int pause_on); 9 | void SDL_LockAudio(void); 10 | void SDL_UnlockAudio(void); 11 | void SDL_CloseAudio(void); 12 | void SDL_MixAudio(uint8_t *dst, const uint8_t *src, uint32_t len, int volume); 13 | 14 | -------------------------------------------------------------------------------- /sdlshim/SDL/audio.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _AUDIO_H 3 | #define _AUDIO_H 4 | 5 | #define SDL_MIX_MAXVOLUME 128 6 | 7 | typedef struct 8 | { 9 | int freq; 10 | uint16_t format; 11 | uint8_t channels; 12 | uint8_t silence; 13 | uint16_t samples; 14 | uint32_t size; 15 | void (*callback)(void *userdata, uint8_t *stream, int len); 16 | void *userdata; 17 | } SDL_AudioSpec; 18 | 19 | #define AUDIO_S16 0x01 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /sdlshim/SDL/bmploader.fdh: -------------------------------------------------------------------------------- 1 | //hash:2f0b97b7 2 | //automatically generated by Makegen 3 | 4 | /* located in ../sdlshim/console.cpp */ 5 | 6 | //-----------[referenced from ../sdlshim/SDL/bmploader.cpp]----------// 7 | void stat(const char *str, ...); 8 | void staterr(const char *str, ...); 9 | 10 | 11 | /* located in ../sdlshim/file.cpp */ 12 | 13 | //-----------[referenced from ../sdlshim/SDL/bmploader.cpp]----------// 14 | FILE *SDLS_fopen(const char *fname, const char *mode); 15 | 16 | 17 | /* located in ../sdlshim/SDL/bmploader.cpp */ 18 | 19 | //-----------[referenced from ../sdlshim/SDL/bmploader.cpp]----------// 20 | uint16_t *bmp_load(const char *fname, BMPHeader *hdr); 21 | static int Pad4(int invalue); 22 | 23 | -------------------------------------------------------------------------------- /sdlshim/SDL/bmploader.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BMPLOADER_H 3 | #define _BMPLOADER_H 4 | 5 | #define BMP_HEADER_LEN 0x36 6 | 7 | struct BMPHeader 8 | { 9 | uint16_t type; 10 | uint32_t filesize; 11 | uint32_t reserved; 12 | uint32_t data_offset; 13 | 14 | uint32_t info_size; 15 | 16 | uint32_t bmWidth, bmHeight; 17 | uint16_t planes; 18 | uint16_t bpp; 19 | 20 | uint32_t biCompression; 21 | uint32_t biSizeImage; 22 | uint32_t biXPelsPerMeter; 23 | uint32_t biYPelsPerMeter; 24 | uint32_t biColorsUsed; 25 | uint32_t biColorsImportant; 26 | }; 27 | 28 | 29 | 30 | 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /sdlshim/SDL/event.fdh: -------------------------------------------------------------------------------- 1 | //hash:ccd673bf 2 | //automatically generated by Makegen 3 | 4 | /* located in SDL/event.cpp */ 5 | 6 | //-------------------[referenced from SDL/event.cpp]-----------------// 7 | bool SDLS_EventInit(void); 8 | void SDLS_EventQuit(void); 9 | int SDL_PollEvent(SDL_Event *event); 10 | void SDL_PumpEvents(); 11 | LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 12 | void SDL_PushEvent(SDL_Event *event); 13 | const char *SDL_GetKeyName(SDLKey key); 14 | void SDL_WarpMouse(uint16_t x, uint16_t y); 15 | void SDL_WM_SetCaption(const char *title, const char *icon); 16 | uint8_t SDL_GetAppState(void); 17 | static bool create_window(void); 18 | static int vk_to_sdlk(uint8_t vcode, uint8_t last, bool *is_seq_start); 19 | 20 | -------------------------------------------------------------------------------- /sdlshim/SDL/event.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _EVENT_H 3 | #define _EVENT_H 4 | 5 | #include "SDL_keysym.h" 6 | 7 | typedef struct 8 | { 9 | uint8_t sym; 10 | uint8_t scancode; 11 | } SDL_keysym; 12 | 13 | typedef struct 14 | { 15 | uint8_t type; 16 | SDL_keysym keysym; 17 | } SDL_KeyboardEvent; 18 | 19 | typedef struct 20 | { 21 | uint8_t type; 22 | uint16_t x, y; 23 | int16_t xrel, yrel; 24 | } SDL_MouseMotionEvent; 25 | 26 | typedef struct 27 | { 28 | uint8_t type; 29 | uint8_t button; 30 | uint16_t x, y; 31 | } SDL_MouseButtonEvent; 32 | 33 | typedef struct 34 | { 35 | uint8_t type; 36 | } SDL_QuitEvent; 37 | 38 | typedef union 39 | { 40 | uint8_t type; 41 | SDL_KeyboardEvent key; 42 | SDL_MouseMotionEvent motion; 43 | SDL_MouseButtonEvent button; 44 | SDL_QuitEvent quit; 45 | } SDL_Event; 46 | 47 | 48 | typedef enum 49 | { 50 | SDL_KEYDOWN = 1, 51 | SDL_KEYUP, 52 | SDL_MOUSEMOTION, 53 | SDL_MOUSEBUTTONDOWN, 54 | SDL_MOUSEBUTTONUP, 55 | SDL_QUIT 56 | } SDL_EventType; 57 | 58 | 59 | #define SDL_APPMOUSEFOCUS 0x01 60 | #define SDL_APPINPUTFOCUS 0x02 61 | #define SDL_APPACTIVE 0x04 62 | 63 | #endif 64 | 65 | -------------------------------------------------------------------------------- /sdlshim/SDL/fastblit.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _FASTBLIT_H 3 | #define _FASTBLIT_H 4 | 5 | // r0 : UL-corner of destination surface address 6 | // r1 : pitch of destination surface, minus width of source image, *2 (words to bytes) 7 | 8 | // r2 : pointer to data pool 9 | // r3-r10: current colors 10 | typedef void (*FastBlitFunction)(uint8_t *dest, int sfcpitch); 11 | 12 | #define NUM_CREGS 8 // how many registers to use for holding colors 13 | #define FIRST_CREG 3 // reg number of first color register (e.g. r3) 14 | 15 | // how long a run can be before it's collapsed into a loop 16 | #define FB_LOOP_THRESHOLD 6 17 | 18 | 19 | struct FastBlit 20 | { 21 | FastBlitFunction entry_point; 22 | uint8_t *buffer; 23 | int length; 24 | }; 25 | 26 | 27 | struct Sprite 28 | { 29 | uint8_t *image; 30 | uint8_t *mask; 31 | int width, height; 32 | 33 | FastBlit fastblit; 34 | }; 35 | 36 | // structure used while generating a FastBlit 37 | struct FBGen 38 | { 39 | DBuffer *code, *pool; 40 | 41 | int creg[NUM_CREGS]; 42 | int next_creg; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /sdlshim/SDL/init.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include "SDL.h" 5 | #include "../shim.h" 6 | #include "init.fdh" 7 | 8 | #undef main 9 | bool did_quit = false; 10 | 11 | 12 | int SDL_Init(int what) 13 | { 14 | return 0; 15 | } 16 | 17 | void SDL_Quit(void) 18 | { 19 | if (!did_quit) 20 | { 21 | did_quit = true; 22 | 23 | SDLS_EventQuit(); 24 | SDLS_CloseScreen(); 25 | SDL_CloseAudio(); 26 | console_close(); 27 | close_hardware(); 28 | } 29 | } 30 | 31 | /* 32 | void c------------------------------() {} 33 | */ 34 | 35 | int main(int argc, char *argv[]) 36 | { 37 | if (init_hardware()) return 1; 38 | if (SDLS_EventInit()) return 1; 39 | if (console_init()) return 1; 40 | 41 | return SDL_main(argc, argv); 42 | } 43 | 44 | 45 | -------------------------------------------------------------------------------- /sdlshim/SDL/init.fdh: -------------------------------------------------------------------------------- 1 | //hash:66d487bd 2 | //automatically generated by Makegen 3 | 4 | /* located in ../sdlshim/gapi.cpp */ 5 | 6 | //--------------[referenced from ../sdlshim/SDL/init.cpp]------------// 7 | void gapi_close(); 8 | bool gapi_init(void); 9 | 10 | 11 | /* located in ../sdlshim/console.cpp */ 12 | 13 | //--------------[referenced from ../sdlshim/SDL/init.cpp]------------// 14 | void console_close(void); 15 | bool console_init(void); 16 | 17 | 18 | /* located in ../sdlshim/SDL/init.cpp */ 19 | 20 | //--------------[referenced from ../sdlshim/SDL/init.cpp]------------// 21 | int SDL_Init(int what); 22 | void SDL_Quit(void); 23 | 24 | 25 | /* located in ../sdlshim/SDL/screen.cpp */ 26 | 27 | //--------------[referenced from ../sdlshim/SDL/init.cpp]------------// 28 | void SDLS_CloseScreen(); 29 | 30 | 31 | /* located in ../sdlshim/SDL/event.cpp */ 32 | 33 | //--------------[referenced from ../sdlshim/SDL/init.cpp]------------// 34 | void SDLS_EventQuit(void); 35 | bool SDLS_EventInit(void); 36 | 37 | -------------------------------------------------------------------------------- /sdlshim/SDL/init.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _INIT_H 3 | #define _INIT_H 4 | 5 | #define SDL_INIT_TIMER 0x00000001 6 | #define SDL_INIT_AUDIO 0x00000010 7 | #define SDL_INIT_VIDEO 0x00000020 8 | #define SDL_INIT_CDROM 0x00000100 9 | #define SDL_INIT_JOYSTICK 0x00000200 10 | #define SDL_INIT_HAPTIC 0x00001000 11 | #define SDL_INIT_NOPARACHUTE 0x00100000 /* Don't catch fatal signals */ 12 | #define SDL_INIT_EVENTTHREAD 0x01000000 /* Not supported on all OS's */ 13 | #define SDL_INIT_EVERYTHING 0x0000FFFF 14 | 15 | 16 | 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /sdlshim/SDL/misc.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "shim.h" 3 | 4 | uint32_t SDL_GetTicks() 5 | { 6 | return timer_ms_gettime64(); 7 | } 8 | 9 | void SDL_Delay(int ms) 10 | { 11 | thd_sleep(ms); 12 | } 13 | 14 | /* 15 | void c------------------------------() {} 16 | */ 17 | 18 | const char *SDL_GetError(void) 19 | { 20 | return "Unknown Error"; 21 | } 22 | -------------------------------------------------------------------------------- /sdlshim/SDL/misc.fdh: -------------------------------------------------------------------------------- 1 | //hash:6b4529fd 2 | //automatically generated by Makegen 3 | 4 | /* located in ../sdlshim/SDL/misc.cpp */ 5 | 6 | //--------------[referenced from ../sdlshim/SDL/misc.cpp]------------// 7 | uint32_t SDL_GetTicks(); 8 | void SDL_Delay(int ms); 9 | const char *SDL_GetError(void); 10 | 11 | -------------------------------------------------------------------------------- /sdlshim/aica/clib.c: -------------------------------------------------------------------------------- 1 | #include "clib.h" 2 | 3 | void * memset(void *ptr, int value, size_t num) 4 | { 5 | uint32_t location = (uint32_t)ptr; 6 | uint32_t value32 = (value & 0xFF) | ((value << 8) & 0xFF00) | ((value << 16) & 0xFF0000) | ((value << 24) & 0xFF000000); 7 | 8 | // Clear any prefixed misaligned bits. 9 | while ((num > 0) && (location & 0x3)) 10 | { 11 | *((uint8_t *)location++) = value; 12 | num--; 13 | } 14 | 15 | // Clear aligned faster now. 16 | while (num >= 4) 17 | { 18 | *((uint32_t *)location) = value32; 19 | num -= 4; 20 | location += 4; 21 | } 22 | 23 | // Clear any dangling misaligned bits. 24 | while (num > 0) 25 | { 26 | *((uint8_t *)location++) = value; 27 | num--; 28 | } 29 | 30 | return ptr; 31 | } 32 | -------------------------------------------------------------------------------- /sdlshim/aica/clib.h: -------------------------------------------------------------------------------- 1 | #ifndef __CLIB_H 2 | #define __CLIB_H 3 | 4 | #include 5 | #include 6 | 7 | void * memset(void *ptr, int value, size_t num); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /sdlshim/arm/Makefile: -------------------------------------------------------------------------------- 1 | ronindir=../../libronin 2 | ARMFLAGS=-mcpu=arm7 -ffreestanding -O5 -funroll-loops 3 | ARMFLAGS+= -I$(ronindir)/include -I. 4 | 5 | 6 | arm_pxt_code.h: arm_pxt_code.bin 7 | ./encode_armcode.pike < $< > $@ 8 | 9 | arm_pxt_code.bin: arm_pxt_code.elf 10 | arm-elf-objcopy -O binary $< $@ 11 | 12 | arm_pxt_code.elf: arm_pxt_code.o 13 | arm-elf-gcc $(ARMFLAGS) -Wl,-Ttext,0 -nostdlib -nostartfiles -o $@ $^ -lgcc -lgcc 14 | 15 | arm_pxt_code.o: arm_pxt_code.c 16 | arm-elf-gcc -c -Wall $(ARMFLAGS) -o $@ $< 17 | 18 | dump: arm_pxt_code.elf 19 | arm-elf-objdump -D $< > dump 20 | 21 | clean: 22 | rm -f *.o *.bin *.elf 23 | -------------------------------------------------------------------------------- /sdlshim/arm/encode_armcode.pike: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pike 2 | 3 | int main(int argc, array(string) argv) 4 | { 5 | string code = Stdio.File("stdin")->read(); 6 | write("unsigned int arm_pxt_code[] = {\n"); 7 | foreach(code/24.0, string l) 8 | write(sprintf("%{ 0x%:08x,%}\n", 9 | column(map(l/4.0, array_sscanf, "%-4c"), 0))); 10 | write("};\n"); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /sdlshim/arm/sound_pxt.h: -------------------------------------------------------------------------------- 1 | 2 | #define PXT_NUM_CHANNELS 14 3 | 4 | struct pxt_status { 5 | int samplepos; 6 | }; 7 | 8 | struct pxt_buffer { 9 | int buffer; 10 | int len; 11 | }; 12 | 13 | 14 | #define CMD_SET_LOOP(n) (0x30|(n)) 15 | #define CMD_SET_PLAYCHAN(n) (0x40|(n)) 16 | #define CMD_SET_FREEPOS(n) (0x50|(n)) 17 | #define CMD_SET_PAUSECHAN(n) (0x60|(n)) 18 | 19 | #define PXT_STATUS_ADDR (0x40400) 20 | #define PXT_BUFFER_ADDR (0x40500) 21 | #define SPU_BASE_ADDR (0x41000) 22 | 23 | #define PXT_STATUS ((volatile struct pxt_status *)(void *)(0xa0800000+PXT_STATUS_ADDR)) 24 | 25 | #define PXT_BUFFER(n) ((volatile struct pxt_buffer *)(void *)(0xa0800000+PXT_BUFFER_ADDR+sizeof(pxt_buffer)*(n))) 26 | 27 | -------------------------------------------------------------------------------- /sdlshim/audio.fdh: -------------------------------------------------------------------------------- 1 | //hash:a0feb72b 2 | //automatically generated by Makegen 3 | 4 | /* located in console.cpp */ 5 | 6 | //---------------------[referenced from audio.cpp]-------------------// 7 | void stat(const char *str, ...); 8 | 9 | 10 | /* located in audio.cpp */ 11 | 12 | //---------------------[referenced from audio.cpp]-------------------// 13 | bool audio_init(void); 14 | void audio_close(void); 15 | void audio_set_callback(void (*cb)(void *)); 16 | void audio_submit_block(uint8_t *blockdata, int size); 17 | void audio_handle_finished(void); 18 | static void CALLBACK waveOutProc(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2); 19 | static WAVEHDR *GetNextFinishedBlock(void); 20 | void audio_lock(void); 21 | void audio_unlock(void); 22 | 23 | -------------------------------------------------------------------------------- /sdlshim/buildscript: -------------------------------------------------------------------------------- 1 | makegen 2 | export LD_LIBRARY_PATH="/opt/lib32/usr/lib/"; make -j4 3 | %~/dev/jlime/ceremote/ceremote 192.168.131.201 4 | hide -------------------------------------------------------------------------------- /sdlshim/common/BList.fdh: -------------------------------------------------------------------------------- 1 | //hash:a9f7ebe7 2 | //automatically generated by Makegen 3 | 4 | /* located in common/BList.cpp */ 5 | 6 | //-----------------[referenced from common/BList.cpp]----------------// 7 | move_items(void** items, int32 offset, int32 count); 8 | || (toIndex < 0)); 9 | 10 | -------------------------------------------------------------------------------- /sdlshim/common/DBuffer.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /sdlshim/common/DString.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /sdlshim/common/DString.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _DSTRING_H 3 | #define _DSTRING_H 4 | 5 | #include "basics.h" 6 | #include "DBuffer.h" 7 | 8 | /* 9 | DString vs. DBuffer 10 | 11 | The difference is that with a DBuffer, if you AppendString() multiple times, 12 | you will get null-terminators in between each string. With a DString, 13 | the strings will be concatenated. You can override this behavior in a DBuffer 14 | by calling AppendStringNoNull instead of AppendString, but there is no function 15 | for inserting NULLs into a DString, as that doesn't make sense. 16 | */ 17 | 18 | class DString 19 | { 20 | public: 21 | DString(); 22 | DString(const char *string); 23 | DString(const char *string, int length); 24 | 25 | void SetTo(const char *string); 26 | void SetTo(const char *string, int length); 27 | void SetTo(DString *other); 28 | 29 | void AppendString(const char *str); 30 | void AppendString(const char *str, int length); 31 | void AppendChar(uchar ch); 32 | 33 | void ReplaceString(const char *oldstring, const char *newstring); 34 | 35 | void EnsureAlloc(int min_required); 36 | 37 | void Clear(); 38 | char *String(); 39 | int Length(); 40 | 41 | void ReplaceUnprintableChars(); 42 | 43 | private: 44 | DBuffer fBuffer; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /sdlshim/common/Queue.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include "Queue.h" 5 | 6 | Queue::Queue(queue_freer_func func) 7 | : fFreeItemFunc(func) 8 | { 9 | 10 | } 11 | 12 | Queue::~Queue() 13 | { 14 | fLock.Lock(); 15 | 16 | if (fFreeItemFunc) 17 | { 18 | for(int i=0; 19 | void *item = fQueue.ItemAt(i); 20 | i++) 21 | { 22 | (*fFreeItemFunc)(item); 23 | } 24 | } 25 | 26 | fQueue.MakeEmpty(); 27 | } 28 | 29 | /* 30 | void c------------------------------() {} 31 | */ 32 | 33 | void Queue::EnqueueItem(void *item) 34 | { 35 | fLock.Lock(); 36 | fQueue.AddItem(item); 37 | fLock.Unlock(); 38 | } 39 | 40 | void *Queue::GetNextItem() 41 | { 42 | fLock.Lock(); 43 | void *item = fQueue.RemoveItem((int32)0); 44 | fLock.Unlock(); 45 | 46 | return item; 47 | } 48 | 49 | int Queue::GetItemCount() 50 | { 51 | int count; 52 | 53 | fLock.Lock(); 54 | count = fQueue.CountItems(); 55 | fLock.Unlock(); 56 | 57 | return count; 58 | } 59 | 60 | 61 | -------------------------------------------------------------------------------- /sdlshim/common/Queue.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /sdlshim/common/Queue.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _QUEUE_H 3 | #define _QUEUE_H 4 | 5 | typedef void (*queue_freer_func)(void *item); 6 | 7 | 8 | class Queue 9 | { 10 | public: 11 | Queue(queue_freer_func func); 12 | ~Queue(); 13 | 14 | void EnqueueItem(void *item); 15 | void *GetNextItem(); 16 | int GetItemCount(); 17 | 18 | // --------------------------------------- 19 | 20 | BList fQueue; 21 | BLocker fLock; 22 | 23 | queue_freer_func fFreeItemFunc; 24 | 25 | }; 26 | 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /sdlshim/common/ThreadFlag.fdh: -------------------------------------------------------------------------------- 1 | //hash:bd91a8ee 2 | //automatically generated by Makegen 3 | 4 | /* located in bemu/sys.cpp */ 5 | 6 | //---------------[referenced from common/ThreadFlag.cpp]-------------// 7 | void snooze(int time); 8 | int32 atomic_add(vint32 *atomicVariable, int32 addValue); 9 | 10 | 11 | /* located in bemu/Semaphores.cpp */ 12 | 13 | //---------------[referenced from common/ThreadFlag.cpp]-------------// 14 | sem_id create_sem(uint32 thread_count, const char *name); 15 | status_t delete_sem(sem_id semaphore); 16 | status_t acquire_sem_etc(sem_id semaphore, uint32 count, uint32 flags, bigtime_t timeout); 17 | 18 | 19 | /* located in bemu/Threading.cpp */ 20 | 21 | //---------------[referenced from common/ThreadFlag.cpp]-------------// 22 | thread_id spawn_thread(thread_func func, const char *name, int32 priority, void *data); 23 | status_t resume_thread(thread_id thread); 24 | status_t kill_thread(thread_id thread); 25 | 26 | 27 | /* located in common/stat.cpp */ 28 | 29 | //---------------[referenced from common/ThreadFlag.cpp]-------------// 30 | void stat(const char *str, ...); 31 | 32 | 33 | /* located in common/ThreadFlag.cpp */ 34 | 35 | //---------------[referenced from common/ThreadFlag.cpp]-------------// 36 | status_t _tfwt_one(void *a); 37 | status_t _tfwt_two(void *a); 38 | 39 | -------------------------------------------------------------------------------- /sdlshim/common/ThreadFlag.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | // for ThreadFlag::WaitTwo 5 | #define TF_ONE 0 6 | #define TF_TIMED_OUT 1 7 | #define TF_TWO 2 8 | 9 | class ThreadFlag 10 | { 11 | public: 12 | ThreadFlag(); 13 | ~ThreadFlag(); 14 | 15 | void Raise(); 16 | 17 | void WaitUntilRaised(); 18 | bool WaitUntilRaised(bigtime_t timeout_ms); 19 | bool IsRaised(); 20 | 21 | static int WaitTwo(ThreadFlag *flag1, ThreadFlag *flag2, bigtime_t timeout_ms); 22 | 23 | private: 24 | sem_id fSemaphore; 25 | sem_id fOrgSemaphore; 26 | }; 27 | -------------------------------------------------------------------------------- /sdlshim/common/atree.fdh: -------------------------------------------------------------------------------- 1 | //hash:dd9515ec 2 | //automatically generated by Makegen 3 | 4 | /* located in common/atree.cpp */ 5 | 6 | //-----------------[referenced from common/atree.cpp]----------------// 7 | static void RecursiveFree(ATNode *tree, uchar rlevel); 8 | static ATNode *NewATNode(); 9 | static inline ATNode *follow_tree(ATNode **node); 10 | static void DoForEachInternal(ATNode *node, long addy, int level, ATreeCallback func, void *userdata); 11 | 12 | -------------------------------------------------------------------------------- /sdlshim/common/atree.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | struct ATNode 4 | { 5 | // unlike QSNodes, an ATNode is always exactly 4 levels deep. 6 | // thus there is no 4th level; once at the 3rd level, all the 7 | // branches point to answers, using the answer[] array. 8 | union 9 | { 10 | ATNode *nodes[256]; 11 | void *answers[256]; 12 | }; 13 | }; 14 | 15 | // fromitem: the "key" (map_from) of the entry 16 | // toitem: the object (map_to) of the entry 17 | typedef void (*ATreeCallback)(void *fromitem, void *toitem, void *userdata); 18 | 19 | 20 | class ATree 21 | { 22 | public: 23 | ATree(); 24 | ~ATree(); 25 | 26 | void AddMapping(void *map_from, void *map_to); 27 | void *Lookup(void *map_from); 28 | void Delete(void *object_to_delete); 29 | void DoForEach(ATreeCallback func, void *userdata); 30 | 31 | private: 32 | ATNode *BaseNode; 33 | }; 34 | -------------------------------------------------------------------------------- /sdlshim/common/bufio.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BUFIO_H 3 | #define _BUFIO_H 4 | 5 | #include "bufio.fdh" 6 | 7 | void write_Variable(DBuffer *out, const uint8_t *data, int len); 8 | void write_Variable(DBuffer *out, DBuffer *in); 9 | 10 | 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /sdlshim/common/curses.fdh: -------------------------------------------------------------------------------- 1 | //hash:54fe7b97 2 | //automatically generated by Makegen 3 | 4 | /* located in ../common/doscon.cpp */ 5 | 6 | //---------------[referenced from ../common/doscon.cpp]--------------// 7 | void set_colors(); 8 | void textcolor(int c); 9 | void textbg(int c); 10 | void clrscr(); 11 | void stat(const char *str, ...); 12 | void statnocr(const char *str, ...); 13 | void staterr(const char *str, ...); 14 | void coninhibitupdate(bool enable); 15 | int conwidth(); 16 | int conheight(); 17 | void gotoxy(int x, int y); 18 | int wherex(); 19 | int wherey(); 20 | void sound(int freq, int time_ms); 21 | int getkey(); 22 | int waitkey(); 23 | void init_curses(); 24 | void close_curses(); 25 | 26 | -------------------------------------------------------------------------------- /sdlshim/common/iord.fdh: -------------------------------------------------------------------------------- 1 | //hash:ee3057c2 2 | //automatically generated by Makegen 3 | 4 | /* located in ../common/stat.cpp */ 5 | 6 | //----------------[referenced from ../common/iord.cpp]---------------// 7 | void stat(const char *str, ...); 8 | 9 | 10 | /* located in ../common/iord.cpp */ 11 | 12 | //----------------[referenced from ../common/iord.cpp]---------------// 13 | static bool open_program(const char *program, char *args[], pid_t *pid_out, int *inpipe_out, int *outpipe_out); 14 | static void close_program(pid_t pid, int inpipe, int outpipe); 15 | 16 | -------------------------------------------------------------------------------- /sdlshim/common/iord.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _IORD_H 3 | #define _IORD_H 4 | 5 | #define MAX_LINE_BUFFER 32768 6 | 7 | class iord 8 | { 9 | public: 10 | iord(); 11 | ~iord(); 12 | 13 | bool startprogram(const char *path, const char *additional_args[]); 14 | bool stopprogram(void); 15 | 16 | char *readline(); 17 | void sendline(const char *line); 18 | void clearline(); 19 | 20 | bool running; 21 | 22 | private: 23 | pid_t m_pid; 24 | int m_inpipe, m_outpipe; 25 | 26 | char m_buffer[MAX_LINE_BUFFER]; 27 | int m_buffer_len; 28 | int m_buffer_cursor; 29 | 30 | char m_line[MAX_LINE_BUFFER]; 31 | int m_line_len; 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /sdlshim/common/quicksearch.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /sdlshim/common/quicksearch.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _QS_H 3 | #define _QS_H 4 | 5 | class QSTree 6 | { 7 | public: 8 | QSTree(); 9 | ~QSTree(); 10 | 11 | void AddMapping(const char *str, void *answer); 12 | void AddMapping(const char *str, int32_t answer); 13 | 14 | void *Lookup(const char *str); 15 | int32_t LookupInt(const char *str); 16 | 17 | void Delete(const char *str); 18 | void MakeEmpty(); 19 | 20 | private: 21 | QSTree *branch[256]; 22 | void *answer; 23 | bool has_answer; 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /sdlshim/common/stat.fdh: -------------------------------------------------------------------------------- 1 | //hash:43c37efb 2 | //automatically generated by Makegen 3 | 4 | /* located in ../common/stat.cpp */ 5 | 6 | //----------------[referenced from ../common/stat.cpp]---------------// 7 | void SetLogFilename(const char *f); 8 | void stat(const char *str, ...); 9 | void statnocr(const char *str, ...); 10 | void staterr(const char *str, ...); 11 | const char *GetTimestamp(void); 12 | 13 | -------------------------------------------------------------------------------- /sdlshim/common/tcpstuff.fdh: -------------------------------------------------------------------------------- 1 | //hash:4719355b 2 | //automatically generated by Makegen 3 | 4 | /* located in ../common/tcpstuff.cpp */ 5 | 6 | //--------------[referenced from ../common/tcpstuff.cpp]-------------// 7 | int senddata(uint32_t sock, const uint8_t *packet, int len); 8 | int sendstr(uint32_t sock, const char *str); 9 | int sendnow(uint32_t sock, const uint8_t *packet, int len); 10 | void net_flush(uint32_t sock); 11 | int chkread(uint32_t sock); 12 | int chkwrite(uint32_t sock); 13 | bool net_setnonblock(uint32_t sock, bool enable); 14 | bool net_nodelay(uint32_t sock, int flag); 15 | char *decimalip(uint32_t ip); 16 | uint32_t net_dnslookup(const char *host); 17 | uint32_t net_connect(uint32_t ip, uint16_t port, int timeout_ms); 18 | uint32_t net_open_and_listen(uint16_t port, bool reuse_addr); 19 | char net_listen_socket(uint32_t sock, uint32_t listen_ip, uint16_t listen_port); 20 | uint32_t net_accept(uint32_t s, uint32_t *connected_ip); 21 | 22 | 23 | /* located in ../common/stat.cpp */ 24 | 25 | //--------------[referenced from ../common/tcpstuff.cpp]-------------// 26 | void staterr(const char *str, ...); 27 | void stat(const char *str, ...); 28 | 29 | -------------------------------------------------------------------------------- /sdlshim/common/tcpstuff.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _TCPSTUFF_H 3 | #define _TCPSTUFF_H 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /sdlshim/common/timer.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | #include "timer.h" 6 | 7 | //static struct timeval start_tv; 8 | //bool time_inited = false; 9 | 10 | // return the current tick count in milliseconds 11 | tstamp timer(void) 12 | { 13 | struct timeval tv; 14 | uint64_t result; 15 | 16 | // this is done in-line instead of using a separate initilization function 17 | // because statically-allocated C++ classes may have constructors which 18 | // could call timer() before the initilization function gets a chance to run. 19 | /*if (!time_inited) 20 | { 21 | time_inited = true; 22 | gettimeofday(&start_tv, NULL); 23 | 24 | // by subtracting one second we make the time the program started = 1000ms; 25 | // this ensures that timer() couldn't ever return 0, which is used in many places 26 | // to mean an invalid timestamp. 27 | start_tv.tv_sec--; 28 | }*/ 29 | 30 | gettimeofday(&tv, NULL); 31 | 32 | // subtract the epoch time from when the program started, 33 | // so that 32-bit values wrap only after 49.7 days of actual program uptime, 34 | // instead of arbitrary points in time spaced 49 days apart. 35 | //tv.tv_sec -= start_tv.tv_sec; 36 | //tv.tv_usec -= start_tv.tv_usec; 37 | 38 | result = tv.tv_sec; 39 | result *= 1000; 40 | result += (tv.tv_usec / 1000); 41 | return (tstamp)result; 42 | } 43 | -------------------------------------------------------------------------------- /sdlshim/common/timer.fdh: -------------------------------------------------------------------------------- 1 | //hash:ab321710 2 | //automatically generated by Makegen 3 | 4 | /* located in ../common/timer.cpp */ 5 | 6 | //----------------[referenced from ../common/timer.cpp]--------------// 7 | tstamp timer(void); 8 | 9 | -------------------------------------------------------------------------------- /sdlshim/common/timer.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _TIMER_H 3 | #define _TIMER_H 4 | 5 | #include 6 | typedef uint64_t tstamp; 7 | 8 | tstamp timer(void); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /sdlshim/common/udpstuff.fdh: -------------------------------------------------------------------------------- 1 | //hash:de03d704 2 | //automatically generated by Makegen 3 | 4 | /* located in curses/tcpstuff.cpp */ 5 | 6 | //--------------[referenced from ../common/udpstuff.cpp]-------------// 7 | int chkwrite(uint32_t sock); 8 | 9 | 10 | /* located in ../common/stat.cpp */ 11 | 12 | //--------------[referenced from ../common/udpstuff.cpp]-------------// 13 | void staterr(const char *str, ...); 14 | 15 | 16 | /* located in ../common/udpstuff.cpp */ 17 | 18 | //--------------[referenced from ../common/udpstuff.cpp]-------------// 19 | uint32_t udp_createsocket(uint16_t port); 20 | uint32_t udp_createsocket_anyport(uint16_t *port_out); 21 | void udp_send(uint32_t sock, const uint8_t *data, int len, uint32_t ip, uint16_t port); 22 | int udp_recv(uint32_t sock, uint8_t *buffer, int buffer_size, uint32_t *ip_out, uint16_t *port_out); 23 | 24 | -------------------------------------------------------------------------------- /sdlshim/common/udpstuff.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _UDPSTUFF_H 3 | #define _UDPSTUFF_H 4 | 5 | #include "tcpstuff.h" 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /sdlshim/file.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include "file.fdh" 6 | 7 | static bool GetFullFilename(const char *fname, char *buffer) 8 | { 9 | //printf("%s:%s\n",__func__, fname); 10 | 11 | const char *p; 12 | int i; 13 | int len; 14 | //int pos; 15 | char *path = buffer; 16 | 17 | len = strlen(fname); 18 | 19 | //pos = 0; 20 | for(i=0; i 3 | 4 | // stupid compiler requires this doesn't provide it itself. 5 | // stubbing this out seems it won't break anything unless we use exceptions 6 | extern "C" 7 | { 8 | void __mingwthr_key_dtor(DWORD key, void (*dtor) (void *)) 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /sdlshim/hacks.fdh: -------------------------------------------------------------------------------- 1 | //hash:64132369 2 | //automatically generated by Makegen 3 | 4 | /* located in hacks.cpp */ 5 | 6 | //---------------------[referenced from hacks.cpp]-------------------// 7 | void __mingwthr_key_dtor(DWORD key, void (*dtor) (void *)); 8 | 9 | -------------------------------------------------------------------------------- /sdlshim/icon_data_2bpp.h: -------------------------------------------------------------------------------- 1 | /* 16 x 16 */ 2 | static unsigned char hey_icon_2bpp[] = { 3 | 0xff, 0xff, 0xf0, 0x0f, 0x80, 0x01, 0x00, 0x00, 0x48, 0x2a, 0x4b, 0xaa, 0x7a, 0x3a, 0x4b, 0x92, 4 | 0x4a, 0x10, 0x03, 0x82, 0x00, 0x00, 0x80, 0x01, 0xf0, 0x0f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0xff, 5 | 0 }; 6 | 7 | /* 32 x 8 */ 8 | static unsigned char z_icon_2bpp[] = { 9 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81,0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0x87, 0xe7,0xff,0xcf, 0xef, 0xe7, 0xdf, 0xcf, 0xdf, 0xdf,0xdf, 0xcf, 0x87, 0x81, 0xff, 0xff, 0xff, 0xff, 10 | 0 }; 11 | 12 | -------------------------------------------------------------------------------- /sdlshim/impl: -------------------------------------------------------------------------------- 1 | 2 | nx: completely remove dependency on SDL_ttf when compiled for 240x320 mode 3 | 4 | SDL_GetVideoInfo() 5 | SDL_SetColors - or investigate whether we remove this from nx? 6 | -------------------------------------------------------------------------------- /sdlshim/libsh4.h: -------------------------------------------------------------------------------- 1 | #ifndef ASSEMBLER 2 | #include "libsh4/sh4.h" 3 | #include "libsh4/sh4float.h" 4 | #include "libsh4/sq.h" 5 | #endif 6 | #include "libsh4/gbr.h" 7 | #include "libsh4/trapa.h" 8 | -------------------------------------------------------------------------------- /sdlshim/libsh4/gbr.h: -------------------------------------------------------------------------------- 1 | #ifndef GBR_H 2 | #define GBR_H 3 | 4 | #define GBR_WORD_BASE (64) 5 | #define GBR_LONG_BASE (128) 6 | #define GBR_SIZE (512) 7 | 8 | 9 | #define GBR_BYTE_OFS(idx) (idx) 10 | #define GBR_WORD_OFS(idx) (GBR_WORD_BASE + (idx) * 2) 11 | #define GBR_LONG_OFS(idx) (GBR_LONG_BASE + (idx) * 4) 12 | 13 | #define GBR_ERRNO_PTR GBR_LONG_OFS(0) 14 | #define GBR_DBGCON_PTR GBR_LONG_OFS(1) 15 | #define GBR_MATRIX_STACK GBR_LONG_OFS(2) 16 | #define GBR_MATRIX_STACK_MIN GBR_LONG_OFS(3) 17 | #define GBR_MATRIX_STACK_MAX GBR_LONG_OFS(4) 18 | #define GBR_POLYGON_COUNT GBR_LONG_OFS(5) 19 | #define GBR_VERTEX_COUNT GBR_LONG_OFS(6) 20 | #define GBR_CONTEXT_COUNT GBR_LONG_OFS(7) 21 | #define GBR_OPAQUE_LIST_PTR GBR_LONG_OFS(8) 22 | #define GBR_OPAQUE_MOD_LIST_PTR GBR_LONG_OFS(9) 23 | #define GBR_BLEND_LIST_PTR GBR_LONG_OFS(10) 24 | #define GBR_BLEND_MOD_LIST_PTR GBR_LONG_OFS(11) 25 | #define GBR_PUNCH_LIST_PTR GBR_LONG_OFS(12) 26 | #define GBR_TACHYON_WRITE_DST GBR_LONG_OFS(13) 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /sdlshim/libsh4/trapa.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBSH4_TRAPA 2 | #define LIBSH4_TRAPA 3 | 4 | #define TRAPA_DUMP_REGS 1 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /sdlshim/makelist.ml: -------------------------------------------------------------------------------- 1 | 2 | > 17 | main.cpp 18 | support.cpp 19 | gapi.cpp 20 | console.cpp 21 | file.cpp 22 | 23 | SDL/init.cpp 24 | SDL/screen.cpp 25 | SDL/bmploader.cpp 26 | SDL/event.cpp 27 | SDL/audio.cpp 28 | SDL/misc.cpp 29 | 30 | asm.s : ASM 31 | hacks.cpp 32 | 33 | common/misc.cpp 34 | common/DBuffer.cpp 35 | common/BList.cpp 36 | << 37 | -------------------------------------------------------------------------------- /sdlshim/private.h: -------------------------------------------------------------------------------- 1 | #ifndef PRIVATE_H_INCLUDED 2 | #define PRIVATE_H_INCLUDED 3 | 4 | #if defined(__cplusplus) || defined(c_plusplus) 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | void _audio_init(); 11 | void _audio_free(); 12 | 13 | #if defined(__cplusplus) || defined(c_plusplus) 14 | } 15 | #endif 16 | 17 | #endif 18 | 19 | -------------------------------------------------------------------------------- /sdlshim/remotescript: -------------------------------------------------------------------------------- 1 | send sdlshim.exe \Temp\sdlshim.exe 2 | exec \Temp\sdlshim.exe 3 | exit 4 | -------------------------------------------------------------------------------- /sdlshim/scrnsave.h: -------------------------------------------------------------------------------- 1 | #ifndef _SCRNSAVE_H_ 2 | #define _SCRNSAVE_H_ 3 | 4 | 5 | typedef struct tagBITMAPFILEHEADER { 6 | unsigned short bfType; 7 | unsigned long bfSize; 8 | unsigned short bfReserved1; 9 | unsigned short bfReserved2; 10 | unsigned long bfOffBits; 11 | } __attribute__ ((packed)) BITMAPFILEHEADER; 12 | 13 | typedef struct tagBITMAPINFOHEADER{ 14 | unsigned long biSize; 15 | long biWidth; 16 | long biHeight; 17 | unsigned short biPlanes; 18 | unsigned short biBitCount; 19 | unsigned long biCompression; 20 | unsigned long biSizeImage; 21 | long biXPixPerMeter; 22 | long biYPixPerMeter; 23 | unsigned long biClrUsed; 24 | unsigned long biClrImporant; 25 | } __attribute__ ((packed)) BITMAPINFOHEADER; 26 | 27 | 28 | int sd_init(void); 29 | bool screensave(void); 30 | int sd_exit(void); 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /sdlshim/shim.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SHIM_H 3 | #define _SHIM_H 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "common/DBuffer.h" 14 | #include "common/BList.h" 15 | #include "SDL/SDL.h" 16 | 17 | int init_hardware(); 18 | void close_hardware(); 19 | void update_audio(); 20 | extern void *screen_tx[]; 21 | 22 | extern uint16_t *vram; 23 | #define SCREEN_WIDTH 320 24 | #define SCREEN_HEIGHT 240 25 | #define SCREEN_PITCH (SCREEN_WIDTH * 2) 26 | #define VRAM_SIZE (SCREEN_HEIGHT * SCREEN_PITCH) 27 | 28 | #define FONT_WIDTH 8 29 | #define FONT_HEIGHT 8 30 | #define SCREEN_CHARS_WIDTH (SCREEN_WIDTH/FONT_WIDTH) 31 | #define SCREEN_CHARS_HEIGHT (SCREEN_HEIGHT/FONT_HEIGHT) 32 | 33 | #define SCREEN_BUFFER_SIZE 4 34 | 35 | 36 | #define RING_BUFFER_SAMPLES 44100 37 | #define SAMPLES_TO_BYTES(n) ((n)<<1) 38 | 39 | extern FILE *SDLS_fopen(const char *fname, const char *mode); 40 | 41 | extern void cursor_run(void); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /sdlshim/silayout: -------------------------------------------------------------------------------- 1 | 0 : VERSION 2 | 4 : RESERVED 3 | /home/katy/dev/sdlshim/makelist.ml 4 | 0 : active 5 | 37 : nlines 6 | 0 : scroll_y 7 | 0 : cursor_x 8 | 21 : cursor_y 9 | 0 : cursor_mode 10 | 0 : selection_present 11 | - 12 | /home/katy/dev/sdlshim/main.cpp 13 | 0 : active 14 | 98 : nlines 15 | 17 : scroll_y 16 | 5 : cursor_x 17 | 17 : cursor_y 18 | 0 : cursor_mode 19 | 0 : selection_present 20 | - 21 | /home/katy/dev/sdlshim/SDL/screen.cpp 22 | 0 : active 23 | 404 : nlines 24 | 115 : scroll_y 25 | 0 : cursor_x 26 | 143 : cursor_y 27 | 0 : cursor_mode 28 | 0 : selection_present 29 | - 30 | /home/katy/dev/sdlshim/gapi.cpp 31 | 1 : active 32 | 95 : nlines 33 | 50 : scroll_y 34 | 9 : cursor_x 35 | 58 : cursor_y 36 | 0 : cursor_mode 37 | 0 : selection_present 38 | - 39 | *END* 40 | -------------------------------------------------------------------------------- /sdlshim/sound/sslib.fdh: -------------------------------------------------------------------------------- 1 | //hash:56e7dcf5 2 | //automatically generated by Makegen 3 | 4 | /* located in sound/sslib.cpp */ 5 | 6 | //------------------[referenced from sound/sslib.cpp]----------------// 7 | char SSInit(void); 8 | void SSClose(void); 9 | void SSReserveChannel(int c); 10 | int SSFindFreeChannel(void); 11 | int SSEnqueueChunk(int c, signed short *buffer, int len, int userdata, void(*FinishedCB)(int, int)); 12 | int SSPlayChunk(int c, signed short *buffer, int len, int userdata, void(*FinishedCB)(int, int)); 13 | char SSChannelPlaying(int c); 14 | int SSGetCurUserData(int c); 15 | int SSGetSamplePos(int c); 16 | void SSAbortChannel(int c); 17 | void SSAbortChannelByUserData(int ud); 18 | void SSSetVolume(int c, int newvol); 19 | void SSLockAudio(void); 20 | void SSUnlockAudio(void); 21 | static int AddBuffer(SSChannel *chan, int bytes); 22 | static void mixaudio(void *unused, uint8_t *stream, int len); 23 | 24 | 25 | /* located in common/stat.cpp */ 26 | 27 | //------------------[referenced from sound/sslib.cpp]----------------// 28 | void staterr(const char *fmt, ...); 29 | void stat(const char *fmt, ...); 30 | 31 | -------------------------------------------------------------------------------- /sdlshim/sound/sslib.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SSLIB_H 3 | #define _SSLIB_H 4 | 5 | #define SAMPLE_RATE 22050 6 | #define MAX_QUEUED_CHUNKS (180 +1) 7 | #define SS_NUM_CHANNELS 16 8 | 9 | struct SSChunk 10 | { 11 | signed short *buffer; 12 | int length; 13 | 14 | signed char *bytebuffer; // same as bytebuffer but in BYTES 15 | int bytelength; // TOTAL length in BYTES 16 | 17 | // current read position. this is within bytebuffer and is in BYTES. 18 | int bytepos; 19 | 20 | int userdata; // user data to be sent to FinishedCallback when finished 21 | }; 22 | 23 | 24 | struct SSChannel 25 | { 26 | SSChunk chunks[MAX_QUEUED_CHUNKS]; 27 | int head, tail; 28 | 29 | int volume; 30 | char reserved; // if 1, can only be played on explicitly, not by passing -1 31 | 32 | int FinishedChunkUserdata[MAX_QUEUED_CHUNKS]; 33 | int nFinishedChunks; 34 | 35 | void (*FinishedCB)(int channel, int chunkid); 36 | }; 37 | 38 | char SSInit(void); 39 | void SSClose(void); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /sdlshim/sslib.fdh: -------------------------------------------------------------------------------- 1 | //hash:b653e551 2 | //automatically generated by Makegen 3 | 4 | /* located in console.cpp */ 5 | 6 | //---------------------[referenced from sslib.cpp]-------------------// 7 | void stat(const char *str, ...); 8 | void staterr(const char *str, ...); 9 | 10 | 11 | /* located in audio.cpp */ 12 | 13 | //---------------------[referenced from sslib.cpp]-------------------// 14 | bool audio_init(void); 15 | void audio_close(void); 16 | void audio_lock(void); 17 | void audio_unlock(void); 18 | 19 | 20 | /* located in sslib.cpp */ 21 | 22 | //---------------------[referenced from sslib.cpp]-------------------// 23 | bool SSInit(void); 24 | void SSClose(void); 25 | void SSReserveChannel(int c); 26 | int SSFindFreeChannel(void); 27 | int SSEnqueueChunk(int c, signed short *buffer, int len, void *userdata, void(*FinishedCB)(int, void *)); 28 | int SSPlayChunk(int c, signed short *buffer, int len, void *userdata, void(*FinishedCB)(int, void *)); 29 | char SSChannelPlaying(int c); 30 | void *SSGetCurUserData(int c); 31 | int SSGetSamplePos(int c); 32 | void SSAbortChannel(int c); 33 | void SSAbortChannelByUserData(void *ud); 34 | void SSSetVolume(int c, int newvol); 35 | void SSLockAudio(void); 36 | void SSUnlockAudio(void); 37 | static int AddBuffer(SSChannel *chan, int bytes); 38 | void SSRunMixer(void); 39 | 40 | -------------------------------------------------------------------------------- /sdlshim/sslib.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SSLIB_H 3 | #define _SSLIB_H 4 | 5 | #define MAX_QUEUED_CHUNKS (180 +1) 6 | #define SS_NUM_CHANNELS 32 7 | #define SAMPLE_RATE 22050 8 | #define SDL_MIX_MAXVOLUME 128 9 | 10 | struct SSChunk 11 | { 12 | signed short *buffer; 13 | int length; 14 | 15 | signed char *bytebuffer; // same as bytebuffer but in BYTES 16 | int bytelength; // TOTAL length in BYTES 17 | 18 | // current read position. this is within bytebuffer and is in BYTES. 19 | int bytepos; 20 | 21 | void *userdata; // user data to be sent to FinishedCallback when finished 22 | }; 23 | 24 | 25 | struct SSChannel 26 | { 27 | SSChunk chunks[MAX_QUEUED_CHUNKS]; 28 | int head, tail; 29 | 30 | int volume; 31 | bool reserved; // if 1, can only be played on explicitly, not by passing -1 32 | 33 | void *FinishedChunkUserdata[MAX_QUEUED_CHUNKS]; 34 | int nFinishedChunks; 35 | 36 | void (*FinishedCB)(int channel, void *userdata); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /sdlshim/support.fdh: -------------------------------------------------------------------------------- 1 | //hash:6c64e221 2 | //automatically generated by Makegen 3 | 4 | /* located in ../sdlshim/support.cpp */ 5 | 6 | //--------------[referenced from ../sdlshim/support.cpp]-------------// 7 | WCHAR *QuickToUnicode(const char *str); 8 | void *malloc_aligned(size_t size); 9 | void free_aligned(void *ptr); 10 | 11 | -------------------------------------------------------------------------------- /sdlshim/vmu.h: -------------------------------------------------------------------------------- 1 | #ifndef _VMU_H 2 | #define _VMU_H 3 | 4 | bool vmfile_search(const char *fname, int *vm); 5 | bool vmfile_exists(const char *fname); 6 | bool save_to_vmu(int unit, const char *filename, const char *buf, int buf_len); 7 | bool load_from_vmu(int unit, const char *filename, char *buf, int *buf_len); 8 | bool delete_file_vmu(int unit, const char *filename); 9 | bool rename_vmu_file(int unit, const char *oldpath, const char *newpath); 10 | 11 | #endif 12 | 13 | --------------------------------------------------------------------------------