├── LICENSE ├── Makefile ├── Makefile.nspire ├── ObjManager.cpp ├── ObjManager.fdh ├── ObjManager.h ├── README.md ├── 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 ├── cave.tns ├── cavestorynspire.zip ├── 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 ├── 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 ├── endpic.h ├── 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 ├── main.cpp ├── main.fdh ├── makelist.ml ├── map.cpp ├── map.fdh ├── map.h ├── map_system.cpp ├── map_system.fdh ├── map_system.h ├── maprecord.h ├── niku.cpp ├── niku.fdh ├── npc.h ├── nspire.h ├── nspire_back.h ├── 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 ├── 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 ├── tilekey.dat ├── tools ├── SoundList.vbp ├── SoundList.vbw ├── TileKey.vbp ├── TileKey.vbw ├── compile_genobjnametable ├── extractmapinfo.c ├── extractpxt.cpp ├── frmSoundList.frm ├── frmTileKey.frm ├── frmTileKey.frx └── genobjnametable.cpp ├── trig.cpp ├── trig.fdh ├── trig.h ├── tsc.cpp ├── tsc.fdh ├── tsc.h ├── tsc_cmdtbl.cpp ├── vararray.h └── wince.ml /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | NX Engine (Cave Story) for TI Nspire 2 | ============================== 3 | 4 | Ported to TI Nspire by gameblabla. 5 | A bit slow unfortunely, overcloking is advised. 6 | 7 | Modified to work on TI Nspire with Ndless. 8 | To compile : 9 | make -f Makefile.nspire 10 | 11 | Make sure you exported Ndless-SDK path before ! -------------------------------------------------------------------------------- /TextBox/ItemImage.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | The powerup display for textboxes. 4 | E.g. when you get a life capsule or new weapon and 5 | it shows you a picture of it. 6 | */ 7 | 8 | #include "../nx.h" 9 | #include "ItemImage.h" 10 | #include "ItemImage.fdh" 11 | 12 | #define ITEMBOX_W 76 13 | #define ITEMBOX_H 32 14 | 15 | #define ITEMBOX_X 128 16 | #define ITEMBOX_Y 120 17 | 18 | /* 19 | void c------------------------------() {} 20 | */ 21 | 22 | void TB_ItemImage::ResetState() 23 | { 24 | fVisible = false; 25 | } 26 | 27 | void TB_ItemImage::SetVisible(bool enable) 28 | { 29 | fVisible = enable; 30 | } 31 | 32 | void TB_ItemImage::SetSprite(int sprite, int frame) 33 | { 34 | fSprite = sprite; 35 | fFrame = frame; 36 | fYOffset = 1; 37 | } 38 | 39 | /* 40 | void c------------------------------() {} 41 | */ 42 | 43 | void TB_ItemImage::Draw(void) 44 | { 45 | if (!fVisible) 46 | return; 47 | 48 | // animate moving item downwards into box 49 | int desty = (ITEMBOX_H / 2) - (sprites[fSprite].h / 2); 50 | if (++fYOffset > desty) fYOffset = desty; 51 | 52 | // draw the box frame 53 | TextBox::DrawFrame(ITEMBOX_X, ITEMBOX_Y, ITEMBOX_W, ITEMBOX_H); 54 | 55 | // draw the item 56 | int x = ITEMBOX_X + ((ITEMBOX_W / 2) - (sprites[fSprite].w / 2)); 57 | if (sprites[fSprite].w == 14) x--; // hack for ArmsIcons 58 | 59 | draw_sprite(x, ITEMBOX_Y + fYOffset, fSprite, fFrame); 60 | } 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /TextBox/ItemImage.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/boss/balfrog.fdh: -------------------------------------------------------------------------------- 1 | //hash:c7373ca9 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //----------------[referenced from ai/boss/balfrog.cpp]--------------// 7 | void quake(int quaketime, int snd); 8 | 9 | 10 | /* located in ObjManager.cpp */ 11 | 12 | //----------------[referenced from ai/boss/balfrog.cpp]--------------// 13 | Object *CreateObject(int x, int y, int type); 14 | 15 | 16 | /* located in tsc.cpp */ 17 | 18 | //----------------[referenced from ai/boss/balfrog.cpp]--------------// 19 | ScriptInstance *StartScript(int scriptno, int pageno); 20 | 21 | 22 | /* located in trig.cpp */ 23 | 24 | //----------------[referenced from ai/boss/balfrog.cpp]--------------// 25 | void EmFireAngledShot(Object *o, int objtype, int rand_variance, int speed); 26 | 27 | 28 | /* located in ai/sym/smoke.cpp */ 29 | 30 | //----------------[referenced from ai/boss/balfrog.cpp]--------------// 31 | void SmokeXY(int x, int y, int nclouds, int rangex, int rangey, Object *push_behind); 32 | 33 | 34 | /* located in ai/boss/balfrog.cpp */ 35 | 36 | //----------------[referenced from ai/boss/balfrog.cpp]--------------// 37 | static void call_place_bboxes(void *balfrog); 38 | void ondeath_balfrog(Object *o); 39 | 40 | 41 | /* located in sound/sound.cpp */ 42 | 43 | //----------------[referenced from ai/boss/balfrog.cpp]--------------// 44 | void sound(int snd); 45 | 46 | 47 | /* located in common/misc.cpp */ 48 | 49 | //----------------[referenced from ai/boss/balfrog.cpp]--------------// 50 | int random(int min, int max); 51 | 52 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/boss/core.fdh: -------------------------------------------------------------------------------- 1 | //hash:90a7f1af 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //-----------------[referenced from ai/boss/core.cpp]----------------// 7 | void quake(int quaketime, int snd); 8 | 9 | 10 | /* located in ObjManager.cpp */ 11 | 12 | //-----------------[referenced from ai/boss/core.cpp]----------------// 13 | Object *CreateObject(int x, int y, int type); 14 | 15 | 16 | /* located in caret.cpp */ 17 | 18 | //-----------------[referenced from ai/boss/core.cpp]----------------// 19 | Caret *effect(int x, int y, int effectno); 20 | 21 | 22 | /* located in trig.cpp */ 23 | 24 | //-----------------[referenced from ai/boss/core.cpp]----------------// 25 | void EmFireAngledShot(Object *o, int objtype, int rand_variance, int speed); 26 | 27 | 28 | /* located in ai/ai.cpp */ 29 | 30 | //-----------------[referenced from ai/boss/core.cpp]----------------// 31 | void ai_animate2(Object *o); 32 | 33 | 34 | /* located in ai/sym/smoke.cpp */ 35 | 36 | //-----------------[referenced from ai/boss/core.cpp]----------------// 37 | void SmokeXY(int x, int y, int nclouds, int rangex, int rangey, Object *push_behind); 38 | 39 | 40 | /* located in ai/boss/core.cpp */ 41 | 42 | //-----------------[referenced from ai/boss/core.cpp]----------------// 43 | void ai_core_front(Object *o); 44 | void ai_core_back(Object *o); 45 | static Object *CreateMinicore(Object *core); 46 | void ai_minicore(Object *o); 47 | void ai_minicore_shot(Object *o); 48 | void ai_core_ghostie(Object *o); 49 | void ai_core_blast(Object *o); 50 | 51 | 52 | /* located in sound/sound.cpp */ 53 | 54 | //-----------------[referenced from ai/boss/core.cpp]----------------// 55 | void sound(int snd); 56 | void StartStreamSound(int freq); 57 | void StopLoopSounds(void); 58 | 59 | 60 | /* located in common/stat.cpp */ 61 | 62 | //-----------------[referenced from ai/boss/core.cpp]----------------// 63 | void stat(const char *fmt, ...); 64 | 65 | 66 | /* located in common/misc.cpp */ 67 | 68 | //-----------------[referenced from ai/boss/core.cpp]----------------// 69 | int random(int min, int max); 70 | 71 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/boss/heavypress.fdh: -------------------------------------------------------------------------------- 1 | //hash:e63ba074 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //--------------[referenced from ai/boss/heavypress.cpp]-------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in map.cpp */ 11 | 12 | //--------------[referenced from ai/boss/heavypress.cpp]-------------// 13 | void map_ChangeTileWithSmoke(int x, int y, int newtile, int nclouds, bool boomflash, Object *push_behind); 14 | 15 | 16 | /* located in caret.cpp */ 17 | 18 | //--------------[referenced from ai/boss/heavypress.cpp]-------------// 19 | Caret *effect(int x, int y, int effectno); 20 | 21 | 22 | /* located in ai/ai.cpp */ 23 | 24 | //--------------[referenced from ai/boss/heavypress.cpp]-------------// 25 | void KillObjectsOfType(int type); 26 | 27 | 28 | /* located in ai/hell/ballos_priest.cpp */ 29 | 30 | //--------------[referenced from ai/boss/heavypress.cpp]-------------// 31 | static void run_defeated(Object *o); 32 | 33 | 34 | /* located in ai/sym/smoke.cpp */ 35 | 36 | //--------------[referenced from ai/boss/heavypress.cpp]-------------// 37 | Object *SmokePuff(int x, int y); 38 | void SmokeXY(int x, int y, int nclouds, int rangex, int rangey, Object *push_behind); 39 | 40 | 41 | /* located in ai/boss/heavypress.cpp */ 42 | 43 | //--------------[referenced from ai/boss/heavypress.cpp]-------------// 44 | void ai_hp_lightning(Object *o); 45 | 46 | 47 | /* located in sound/sound.cpp */ 48 | 49 | //--------------[referenced from ai/boss/heavypress.cpp]-------------// 50 | void sound(int snd); 51 | 52 | 53 | /* located in common/misc.cpp */ 54 | 55 | //--------------[referenced from ai/boss/heavypress.cpp]-------------// 56 | int random(int min, int max); 57 | 58 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/boss/ironhead.fdh: -------------------------------------------------------------------------------- 1 | //hash:c8dc1e1c 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //---------------[referenced from ai/boss/ironhead.cpp]--------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in caret.cpp */ 11 | 12 | //---------------[referenced from ai/boss/ironhead.cpp]--------------// 13 | Caret *effect(int x, int y, int effectno); 14 | 15 | 16 | /* located in tsc.cpp */ 17 | 18 | //---------------[referenced from ai/boss/ironhead.cpp]--------------// 19 | ScriptInstance *StartScript(int scriptno, int pageno); 20 | 21 | 22 | /* located in ai/ai.cpp */ 23 | 24 | //---------------[referenced from ai/boss/ironhead.cpp]--------------// 25 | Object *SpawnObjectAtActionPoint(Object *o, int otype); 26 | void KillObjectsOfType(int type); 27 | 28 | 29 | /* located in ai/boss/ironhead.cpp */ 30 | 31 | //---------------[referenced from ai/boss/ironhead.cpp]--------------// 32 | static void ironh_smokecloud(Object *o); 33 | void ondeath_ironhead(Object *o); 34 | void ai_ironh_fishy(Object *o); 35 | void ai_ironh_shot(Object *o); 36 | void ai_brick_spawner(Object *o); 37 | void ai_ironh_brick(Object *o); 38 | void ai_ikachan_spawner(Object *o); 39 | void ai_ikachan(Object *o); 40 | void ai_motion_wall(Object *o); 41 | 42 | 43 | /* located in sound/sound.cpp */ 44 | 45 | //---------------[referenced from ai/boss/ironhead.cpp]--------------// 46 | void sound(int snd); 47 | 48 | 49 | /* located in common/misc.cpp */ 50 | 51 | //---------------[referenced from ai/boss/ironhead.cpp]--------------// 52 | int random(int min, int max); 53 | 54 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/boss/omega.fdh: -------------------------------------------------------------------------------- 1 | //hash:9b689842 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //-----------------[referenced from ai/boss/omega.cpp]---------------// 7 | Object *CreateObject(int x, int y, int type); 8 | bool hitdetect(Object *o1, Object *o2); 9 | 10 | 11 | /* located in caret.cpp */ 12 | 13 | //-----------------[referenced from ai/boss/omega.cpp]---------------// 14 | Caret *effect(int x, int y, int effectno); 15 | 16 | 17 | /* located in player.cpp */ 18 | 19 | //-----------------[referenced from ai/boss/omega.cpp]---------------// 20 | void hurtplayer(int damage); 21 | 22 | 23 | /* located in tsc.cpp */ 24 | 25 | //-----------------[referenced from ai/boss/omega.cpp]---------------// 26 | ScriptInstance *StartScript(int scriptno, int pageno); 27 | 28 | 29 | /* located in ai/ai.cpp */ 30 | 31 | //-----------------[referenced from ai/boss/omega.cpp]---------------// 32 | Object *SpawnObjectAtActionPoint(Object *o, int otype); 33 | void KillObjectsOfType(int type); 34 | 35 | 36 | /* located in ai/sym/smoke.cpp */ 37 | 38 | //-----------------[referenced from ai/boss/omega.cpp]---------------// 39 | Object *SmokePuff(int x, int y); 40 | 41 | 42 | /* located in ai/boss/omega.cpp */ 43 | 44 | //-----------------[referenced from ai/boss/omega.cpp]---------------// 45 | void ondeath_omega_body(Object *o); 46 | void ai_omega_shot(Object *o); 47 | 48 | 49 | /* located in sound/sound.cpp */ 50 | 51 | //-----------------[referenced from ai/boss/omega.cpp]---------------// 52 | void sound(int snd); 53 | bool sound_is_playing(int snd); 54 | void sound_stop(int snd); 55 | 56 | 57 | /* located in common/misc.cpp */ 58 | 59 | //-----------------[referenced from ai/boss/omega.cpp]---------------// 60 | int random(int min, int max); 61 | 62 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/egg/egg2.fdh: -------------------------------------------------------------------------------- 1 | //hash:88c9cad7 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //------------------[referenced from ai/egg/egg2.cpp]----------------// 7 | void quake(int quaketime, int snd); 8 | 9 | 10 | /* located in ObjManager.cpp */ 11 | 12 | //------------------[referenced from ai/egg/egg2.cpp]----------------// 13 | bool hitdetect(Object *o1, Object *o2); 14 | Object *CreateObject(int x, int y, int type); 15 | 16 | 17 | /* located in caret.cpp */ 18 | 19 | //------------------[referenced from ai/egg/egg2.cpp]----------------// 20 | Caret *effect(int x, int y, int effectno); 21 | 22 | 23 | /* located in trig.cpp */ 24 | 25 | //------------------[referenced from ai/egg/egg2.cpp]----------------// 26 | void ThrowObject(Object *o, int destx, int desty, int rand_variance, int speed); 27 | 28 | 29 | /* located in ai/ai.cpp */ 30 | 31 | //------------------[referenced from ai/egg/egg2.cpp]----------------// 32 | Object *SpawnObjectAtActionPoint(Object *o, int otype); 33 | 34 | 35 | /* located in ai/egg/egg2.cpp */ 36 | 37 | //------------------[referenced from ai/egg/egg2.cpp]----------------// 38 | void ai_dragon_zombie(Object *o); 39 | void ai_falling_spike_small(Object *o); 40 | void ai_falling_spike_large(Object *o); 41 | void ai_counter_bomb(Object *o); 42 | void ai_counter_bomb_number(Object *o); 43 | 44 | 45 | /* located in ai/sym/smoke.cpp */ 46 | 47 | //------------------[referenced from ai/egg/egg2.cpp]----------------// 48 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 49 | void SmokeXY(int x, int y, int nclouds, int rangex, int rangey, Object *push_behind); 50 | 51 | 52 | /* located in sound/sound.cpp */ 53 | 54 | //------------------[referenced from ai/egg/egg2.cpp]----------------// 55 | void sound(int snd); 56 | 57 | 58 | /* located in common/misc.cpp */ 59 | 60 | //------------------[referenced from ai/egg/egg2.cpp]----------------// 61 | int random(int min, int max); 62 | 63 | -------------------------------------------------------------------------------- /ai/egg/igor.fdh: -------------------------------------------------------------------------------- 1 | //hash:2a6475dd 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //------------------[referenced from ai/egg/igor.cpp]----------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in trig.cpp */ 11 | 12 | //------------------[referenced from ai/egg/igor.cpp]----------------// 13 | void ThrowObjectAtAngle(Object *o, uint8_t angle, int speed); 14 | 15 | 16 | /* located in ai/ai.cpp */ 17 | 18 | //------------------[referenced from ai/egg/igor.cpp]----------------// 19 | Object *SpawnObjectAtActionPoint(Object *o, int otype); 20 | 21 | 22 | /* located in ai/egg/igor.cpp */ 23 | 24 | //------------------[referenced from ai/egg/igor.cpp]----------------// 25 | void ai_npc_igor(Object *o); 26 | void ai_boss_igor(Object *o); 27 | void ai_boss_igor_defeated(Object *o); 28 | static void smoke_puff(Object *o, bool initial); 29 | 30 | 31 | /* located in ai/sym/smoke.cpp */ 32 | 33 | //------------------[referenced from ai/egg/igor.cpp]----------------// 34 | void SmokeSide(Object *o, int nclouds, int dir); 35 | void SmokeBoomUp(Object *o); 36 | 37 | 38 | /* located in sound/sound.cpp */ 39 | 40 | //------------------[referenced from ai/egg/igor.cpp]----------------// 41 | void sound(int snd); 42 | 43 | 44 | /* located in common/misc.cpp */ 45 | 46 | //------------------[referenced from ai/egg/igor.cpp]----------------// 47 | int random(int min, int max); 48 | 49 | -------------------------------------------------------------------------------- /ai/final_battle/balcony.fdh: -------------------------------------------------------------------------------- 1 | //hash:3e8a2223 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //------------[referenced from ai/final_battle/balcony.cpp]----------// 7 | void quake(int quaketime, int snd); 8 | 9 | 10 | /* located in ObjManager.cpp */ 11 | 12 | //------------[referenced from ai/final_battle/balcony.cpp]----------// 13 | Object *CreateObject(int x, int y, int type); 14 | 15 | 16 | /* located in trig.cpp */ 17 | 18 | //------------[referenced from ai/final_battle/balcony.cpp]----------// 19 | void ThrowObjectAtAngle(Object *o, uint8_t angle, int speed); 20 | 21 | 22 | /* located in ai/ai.cpp */ 23 | 24 | //------------[referenced from ai/final_battle/balcony.cpp]----------// 25 | Object *SpawnObjectAtActionPoint(Object *o, int otype); 26 | 27 | 28 | /* located in ai/final_battle/balcony.cpp */ 29 | 30 | //------------[referenced from ai/final_battle/balcony.cpp]----------// 31 | void ai_helicopter(Object *o); 32 | void ai_helicopter_blade(Object *o); 33 | void ai_igor_balcony(Object *o); 34 | void ai_falling_block_spawner(Object *o); 35 | void ai_falling_block(Object *o); 36 | 37 | 38 | /* located in ai/sym/smoke.cpp */ 39 | 40 | //------------[referenced from ai/final_battle/balcony.cpp]----------// 41 | void SmokeSide(Object *o, int nclouds, int dir); 42 | 43 | 44 | /* located in sound/sound.cpp */ 45 | 46 | //------------[referenced from ai/final_battle/balcony.cpp]----------// 47 | void sound(int snd); 48 | 49 | 50 | /* located in common/misc.cpp */ 51 | 52 | //------------[referenced from ai/final_battle/balcony.cpp]----------// 53 | int random(int min, int max); 54 | 55 | -------------------------------------------------------------------------------- /ai/final_battle/doctor.fdh: -------------------------------------------------------------------------------- 1 | //hash:40ec33bf 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //------------[referenced from ai/final_battle/doctor.cpp]-----------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in trig.cpp */ 11 | 12 | //------------[referenced from ai/final_battle/doctor.cpp]-----------// 13 | void ThrowObjectAtAngle(Object *o, uint8_t angle, int speed); 14 | int xinertia_from_angle(uint8_t angle, int speed); 15 | int yinertia_from_angle(uint8_t angle, int speed); 16 | 17 | 18 | /* located in ai/ai.cpp */ 19 | 20 | //------------[referenced from ai/final_battle/doctor.cpp]-----------// 21 | Object *SpawnObjectAtActionPoint(Object *o, int otype); 22 | 23 | 24 | /* located in ai/final_battle/doctor.cpp */ 25 | 26 | //------------[referenced from ai/final_battle/doctor.cpp]-----------// 27 | void ai_boss_doctor(Object *o); 28 | void ai_doctor_shot(Object *o); 29 | void ai_doctor_shot_trail(Object *o); 30 | void ai_doctor_blast(Object *o); 31 | void aftermove_red_crystal(Object *o); 32 | void ai_doctor_crowned(Object *o); 33 | 34 | 35 | /* located in ai/final_battle/doctor_common.cpp */ 36 | 37 | //------------[referenced from ai/final_battle/doctor.cpp]-----------// 38 | void dr_tp_out_init(Object *o); 39 | bool dr_tp_out(Object *o); 40 | void dr_tp_in_init(Object *o); 41 | bool dr_tp_in(Object *o); 42 | Object *dr_create_red_crystal(int x, int y); 43 | 44 | 45 | /* located in sound/sound.cpp */ 46 | 47 | //------------[referenced from ai/final_battle/doctor.cpp]-----------// 48 | void sound(int snd); 49 | 50 | 51 | /* located in common/misc.cpp */ 52 | 53 | //------------[referenced from ai/final_battle/doctor.cpp]-----------// 54 | int random(int min, int max); 55 | 56 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/final_battle/doctor_common.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "../stdai.h" 3 | #include "doctor_common.fdh" 4 | 5 | int crystal_xmark, crystal_ymark; 6 | bool crystal_tofront; 7 | 8 | 9 | Object *dr_create_red_crystal(int x, int y) 10 | { 11 | Object *upper_xtal; 12 | 13 | // we have to create these with the one which will bring itself to front 14 | // already having higher zorder (create it 2nd), because the code to 15 | // run aftermoves currently doesn't create a list first and so running 16 | // BringToFront from an aftermove can cause it's AI to be executed twice. 17 | CreateObject(x, y, OBJ_RED_CRYSTAL)->dir = RIGHT; 18 | (upper_xtal = CreateObject(x, y, OBJ_RED_CRYSTAL))->dir = LEFT; 19 | 20 | return upper_xtal; 21 | } 22 | 23 | /* 24 | void c------------------------------() {} 25 | */ 26 | 27 | void dr_tp_out_init(Object *o) 28 | { 29 | o->ResetClip(); 30 | o->clip_enable = true; 31 | 32 | sound(SND_TELEPORT); 33 | o->shaketime = 0; // show any waiting damage numbers NOW 34 | } 35 | 36 | bool dr_tp_out(Object *o) 37 | { 38 | o->clipy1 += 2; 39 | o->clipy2 -= 2; 40 | 41 | if (o->clipy1 >= o->clipy2) 42 | { 43 | o->clip_enable = false; 44 | o->invisible = true; 45 | 46 | return true; 47 | } 48 | 49 | return false; 50 | } 51 | 52 | /* 53 | void c------------------------------() {} 54 | */ 55 | 56 | void dr_tp_in_init(Object *o) 57 | { 58 | o->clipy1 = o->clipy2 = (sprites[o->sprite].h / 2); 59 | o->clip_enable = true; 60 | o->invisible = false; 61 | } 62 | 63 | bool dr_tp_in(Object *o) 64 | { 65 | o->clipy1 -= 2; 66 | o->clipy2 += 2; 67 | 68 | if (o->clipy1 <= 0 || o->clipy2 >= sprites[o->sprite].h) 69 | { 70 | o->clip_enable = false; 71 | o->ResetClip(); 72 | return true; 73 | } 74 | 75 | return false; 76 | } 77 | 78 | 79 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/final_battle/doctor_frenzied.fdh: -------------------------------------------------------------------------------- 1 | //hash:2211b55e 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //--------[referenced from ai/final_battle/doctor_frenzied.cpp]------// 7 | void quake(int quaketime, int snd); 8 | 9 | 10 | /* located in ObjManager.cpp */ 11 | 12 | //--------[referenced from ai/final_battle/doctor_frenzied.cpp]------// 13 | Object *CreateObject(int x, int y, int type); 14 | 15 | 16 | /* located in player.cpp */ 17 | 18 | //--------[referenced from ai/final_battle/doctor_frenzied.cpp]------// 19 | void hurtplayer(int damage); 20 | 21 | 22 | /* located in ai/ai.cpp */ 23 | 24 | //--------[referenced from ai/final_battle/doctor_frenzied.cpp]------// 25 | void KillObjectsOfType(int type); 26 | 27 | 28 | /* located in ai/final_battle/doctor_frenzied.cpp */ 29 | 30 | //--------[referenced from ai/final_battle/doctor_frenzied.cpp]------// 31 | void ai_boss_doctor_frenzied(Object *o); 32 | static void run_jumps(Object *o); 33 | static void run_red_dash(Object *o); 34 | static void run_mega_bats(Object *o); 35 | static void run_teleport(Object *o); 36 | static void run_init(Object *o); 37 | static void run_defeat(Object *o); 38 | static void do_redsplode(Object *o); 39 | static void run_red_drip(Object *o); 40 | void ai_doctor_bat(Object *o); 41 | 42 | 43 | /* located in ai/final_battle/doctor_common.cpp */ 44 | 45 | //--------[referenced from ai/final_battle/doctor_frenzied.cpp]------// 46 | void dr_tp_out_init(Object *o); 47 | bool dr_tp_out(Object *o); 48 | void dr_tp_in_init(Object *o); 49 | bool dr_tp_in(Object *o); 50 | 51 | 52 | /* located in sound/sound.cpp */ 53 | 54 | //--------[referenced from ai/final_battle/doctor_frenzied.cpp]------// 55 | void sound(int snd); 56 | 57 | 58 | /* located in common/misc.cpp */ 59 | 60 | //--------[referenced from ai/final_battle/doctor_frenzied.cpp]------// 61 | int random(int min, int max); 62 | 63 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/final_battle/sidekicks.fdh: -------------------------------------------------------------------------------- 1 | //hash:afaf6e59 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //-----------[referenced from ai/final_battle/sidekicks.cpp]---------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in caret.cpp */ 11 | 12 | //-----------[referenced from ai/final_battle/sidekicks.cpp]---------// 13 | Caret *effect(int x, int y, int effectno); 14 | 15 | 16 | /* located in trig.cpp */ 17 | 18 | //-----------[referenced from ai/final_battle/sidekicks.cpp]---------// 19 | void vector_from_angle(uint8_t angle, int speed, int *xs, int *ys); 20 | uint8_t GetAngle(int curx, int cury, int tgtx, int tgty); 21 | void ThrowObjectAtPlayer(Object *o, int rand_variance, int speed); 22 | void ThrowObject(Object *o, int destx, int desty, int rand_variance, int speed); 23 | 24 | 25 | /* located in ai/ai.cpp */ 26 | 27 | //-----------[referenced from ai/final_battle/sidekicks.cpp]---------// 28 | void KillObjectsOfType(int type); 29 | 30 | 31 | /* located in ai/final_battle/sidekicks.cpp */ 32 | 33 | //-----------[referenced from ai/final_battle/sidekicks.cpp]---------// 34 | void ai_misery_frenzied(Object *o); 35 | static Object *fm_spawn_missile(Object *o, int angindex); 36 | void ai_misery_critter(Object *o); 37 | void ai_misery_bat(Object *o); 38 | void ai_misery_missile(Object *o); 39 | void ai_sue_frenzied(Object *o); 40 | static void sue_somersault(Object *o); 41 | static void sue_dash(Object *o); 42 | static void set_ignore_solid(Object *o); 43 | static void sidekick_run_defeated(Object *o, int health); 44 | 45 | 46 | /* located in sound/sound.cpp */ 47 | 48 | //-----------[referenced from ai/final_battle/sidekicks.cpp]---------// 49 | void sound(int snd); 50 | 51 | 52 | /* located in common/misc.cpp */ 53 | 54 | //-----------[referenced from ai/final_battle/sidekicks.cpp]---------// 55 | int random(int min, int max); 56 | 57 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/hell/ballos_misc.fdh: -------------------------------------------------------------------------------- 1 | //hash:5423cebb 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //--------------[referenced from ai/hell/ballos_misc.cpp]------------// 7 | void quake(int quaketime, int snd); 8 | 9 | 10 | /* located in ObjManager.cpp */ 11 | 12 | //--------------[referenced from ai/hell/ballos_misc.cpp]------------// 13 | Object *CreateObject(int x, int y, int type); 14 | 15 | 16 | /* located in map.cpp */ 17 | 18 | //--------------[referenced from ai/hell/ballos_misc.cpp]------------// 19 | void map_ChangeTileWithSmoke(int x, int y, int newtile, int nclouds, bool boomflash, Object *push_behind); 20 | 21 | 22 | /* located in ai/hell/ballos_misc.cpp */ 23 | 24 | //--------------[referenced from ai/hell/ballos_misc.cpp]------------// 25 | void ai_ballos_skull(Object *o); 26 | void ai_ballos_spikes(Object *o); 27 | void ai_green_devil_spawner(Object *o); 28 | void ai_green_devil(Object *o); 29 | void ai_bute_sword_red(Object *o); 30 | void ai_bute_archer_red(Object *o); 31 | void ai_wall_collapser(Object *o); 32 | 33 | 34 | /* located in ai/sym/smoke.cpp */ 35 | 36 | //--------------[referenced from ai/hell/ballos_misc.cpp]------------// 37 | Object *SmokePuff(int x, int y); 38 | 39 | 40 | /* located in sound/sound.cpp */ 41 | 42 | //--------------[referenced from ai/hell/ballos_misc.cpp]------------// 43 | void sound(int snd); 44 | 45 | 46 | /* located in common/misc.cpp */ 47 | 48 | //--------------[referenced from ai/hell/ballos_misc.cpp]------------// 49 | int random(int min, int max); 50 | 51 | -------------------------------------------------------------------------------- /ai/hell/ballos_priest.fdh: -------------------------------------------------------------------------------- 1 | //hash:23301a33 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //-------------[referenced from ai/hell/ballos_priest.cpp]-----------// 7 | void megaquake(int quaketime, int snd); 8 | 9 | 10 | /* located in ObjManager.cpp */ 11 | 12 | //-------------[referenced from ai/hell/ballos_priest.cpp]-----------// 13 | Object *CreateObject(int x, int y, int type); 14 | 15 | 16 | /* located in caret.cpp */ 17 | 18 | //-------------[referenced from ai/hell/ballos_priest.cpp]-----------// 19 | Caret *effect(int x, int y, int effectno); 20 | 21 | 22 | /* located in ai/hell/ballos_priest.cpp */ 23 | 24 | //-------------[referenced from ai/hell/ballos_priest.cpp]-----------// 25 | void ai_ballos_priest(Object *o); 26 | static void run_flight(Object *o); 27 | static void spawn_bones(Object *o, int dir); 28 | static void run_lightning(Object *o); 29 | static void run_intro(Object *o); 30 | static void run_defeated(Object *o); 31 | void ai_ballos_target(Object *o); 32 | void ai_ballos_bone_spawner(Object *o); 33 | void ai_ballos_bone(Object *o); 34 | 35 | 36 | /* located in ai/sym/smoke.cpp */ 37 | 38 | //-------------[referenced from ai/hell/ballos_priest.cpp]-----------// 39 | void SmokeXY(int x, int y, int nclouds, int rangex, int rangey, Object *push_behind); 40 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 41 | 42 | 43 | /* located in sound/sound.cpp */ 44 | 45 | //-------------[referenced from ai/hell/ballos_priest.cpp]-----------// 46 | void sound(int snd); 47 | 48 | 49 | /* located in common/misc.cpp */ 50 | 51 | //-------------[referenced from ai/hell/ballos_priest.cpp]-----------// 52 | int random(int min, int max); 53 | 54 | -------------------------------------------------------------------------------- /ai/last_cave/last_cave.fdh: -------------------------------------------------------------------------------- 1 | //hash:6dac387f 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //------------[referenced from ai/last_cave/last_cave.cpp]-----------// 7 | void quake(int quaketime, int snd); 8 | 9 | 10 | /* located in ObjManager.cpp */ 11 | 12 | //------------[referenced from ai/last_cave/last_cave.cpp]-----------// 13 | Object *CreateObject(int x, int y, int type); 14 | 15 | 16 | /* located in caret.cpp */ 17 | 18 | //------------[referenced from ai/last_cave/last_cave.cpp]-----------// 19 | Caret *effect(int x, int y, int effectno); 20 | 21 | 22 | /* located in trig.cpp */ 23 | 24 | //------------[referenced from ai/last_cave/last_cave.cpp]-----------// 25 | void EmFireAngledShot(Object *o, int objtype, int rand_variance, int speed); 26 | 27 | 28 | /* located in ai/last_cave/last_cave.cpp */ 29 | 30 | //------------[referenced from ai/last_cave/last_cave.cpp]-----------// 31 | void ai_proximity_press_vert(Object *o); 32 | void ai_critter_hopping_red(Object *o); 33 | void ai_lava_drip_spawner(Object *o); 34 | void ai_lava_drip(Object *o); 35 | void ai_red_bat_spawner(Object *o); 36 | void ai_red_bat(Object *o); 37 | void ai_red_demon(Object *o); 38 | void ai_press_vert(Object *o); 39 | 40 | 41 | /* located in ai/sym/smoke.cpp */ 42 | 43 | //------------[referenced from ai/last_cave/last_cave.cpp]-----------// 44 | void SmokeSide(Object *o, int nclouds, int dir); 45 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 46 | 47 | 48 | /* located in sound/sound.cpp */ 49 | 50 | //------------[referenced from ai/last_cave/last_cave.cpp]-----------// 51 | void sound(int snd); 52 | 53 | 54 | /* located in common/misc.cpp */ 55 | 56 | //------------[referenced from ai/last_cave/last_cave.cpp]-----------// 57 | int random(int min, int max); 58 | 59 | -------------------------------------------------------------------------------- /ai/maze/balrog_boss_missiles.fdh: -------------------------------------------------------------------------------- 1 | //hash:ce2d6225 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //---------[referenced from ai/maze/balrog_boss_missiles.cpp]--------// 7 | void quake(int quaketime, int snd); 8 | 9 | 10 | /* located in caret.cpp */ 11 | 12 | //---------[referenced from ai/maze/balrog_boss_missiles.cpp]--------// 13 | Caret *effect(int x, int y, int effectno); 14 | 15 | 16 | /* located in player.cpp */ 17 | 18 | //---------[referenced from ai/maze/balrog_boss_missiles.cpp]--------// 19 | void hurtplayer(int damage); 20 | 21 | 22 | /* located in ai/ai.cpp */ 23 | 24 | //---------[referenced from ai/maze/balrog_boss_missiles.cpp]--------// 25 | Object *SpawnObjectAtActionPoint(Object *o, int otype); 26 | 27 | 28 | /* located in ai/maze/balrog_boss_missiles.cpp */ 29 | 30 | //---------[referenced from ai/maze/balrog_boss_missiles.cpp]--------// 31 | void ai_balrog_boss_missiles(Object *o); 32 | void ondeath_balrog_boss_missiles(Object *o); 33 | static void walking_animation(Object *o); 34 | void ai_balrog_missile(Object *o); 35 | 36 | 37 | /* located in ai/sym/smoke.cpp */ 38 | 39 | //---------[referenced from ai/maze/balrog_boss_missiles.cpp]--------// 40 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 41 | 42 | 43 | /* located in ai/balrog_common.cpp */ 44 | 45 | //---------[referenced from ai/maze/balrog_boss_missiles.cpp]--------// 46 | void balrog_grab_player(Object *o); 47 | bool balrog_toss_player_away(Object *o); 48 | 49 | 50 | /* located in sound/sound.cpp */ 51 | 52 | //---------[referenced from ai/maze/balrog_boss_missiles.cpp]--------// 53 | void sound(int snd); 54 | 55 | 56 | /* located in common/misc.cpp */ 57 | 58 | //---------[referenced from ai/maze/balrog_boss_missiles.cpp]--------// 59 | int random(int min, int max); 60 | 61 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/maze/labyrinth_m.fdh: -------------------------------------------------------------------------------- 1 | //hash:00879ec8 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //--------------[referenced from ai/maze/labyrinth_m.cpp]------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in caret.cpp */ 11 | 12 | //--------------[referenced from ai/maze/labyrinth_m.cpp]------------// 13 | Caret *effect(int x, int y, int effectno); 14 | 15 | 16 | /* located in trig.cpp */ 17 | 18 | //--------------[referenced from ai/maze/labyrinth_m.cpp]------------// 19 | void vector_from_angle(uint8_t angle, int speed, int *xs, int *ys); 20 | 21 | 22 | /* located in ai/ai.cpp */ 23 | 24 | //--------------[referenced from ai/maze/labyrinth_m.cpp]------------// 25 | Object *SpawnObjectAtActionPoint(Object *o, int otype); 26 | 27 | 28 | /* located in ai/maze/labyrinth_m.cpp */ 29 | 30 | //--------------[referenced from ai/maze/labyrinth_m.cpp]------------// 31 | void ai_firewhirr(Object *o); 32 | void ai_firewhirr_shot(Object *o); 33 | void ai_gaudi_egg(Object *o); 34 | void ai_fuzz_core(Object *o); 35 | void ai_fuzz(Object *o); 36 | void aftermove_fuzz(Object *o); 37 | void ai_buyobuyo_base(Object *o); 38 | void ai_buyobuyo(Object *o); 39 | 40 | 41 | /* located in ai/sym/smoke.cpp */ 42 | 43 | //--------------[referenced from ai/maze/labyrinth_m.cpp]------------// 44 | void SmokeSide(Object *o, int nclouds, int dir); 45 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 46 | 47 | 48 | /* located in sound/sound.cpp */ 49 | 50 | //--------------[referenced from ai/maze/labyrinth_m.cpp]------------// 51 | void sound(int snd); 52 | 53 | 54 | /* located in common/misc.cpp */ 55 | 56 | //--------------[referenced from ai/maze/labyrinth_m.cpp]------------// 57 | int random(int min, int max); 58 | 59 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/maze/pooh_black.fdh: -------------------------------------------------------------------------------- 1 | //hash:cf376552 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //--------------[referenced from ai/maze/pooh_black.cpp]-------------// 7 | void quake(int quaketime, int snd); 8 | 9 | 10 | /* located in ObjManager.cpp */ 11 | 12 | //--------------[referenced from ai/maze/pooh_black.cpp]-------------// 13 | Object *CreateObject(int x, int y, int type); 14 | 15 | 16 | /* located in ai/ai.cpp */ 17 | 18 | //--------------[referenced from ai/maze/pooh_black.cpp]-------------// 19 | void KillObjectsOfType(int type); 20 | 21 | 22 | /* located in ai/maze/pooh_black.cpp */ 23 | 24 | //--------------[referenced from ai/maze/pooh_black.cpp]-------------// 25 | void ai_pooh_black(Object *o); 26 | void ai_pooh_black_bubble(Object *o); 27 | void ai_pooh_black_dying(Object *o); 28 | 29 | 30 | /* located in ai/sym/smoke.cpp */ 31 | 32 | //--------------[referenced from ai/maze/pooh_black.cpp]-------------// 33 | void SmokeSide(Object *o, int nclouds, int dir); 34 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 35 | 36 | 37 | /* located in sound/sound.cpp */ 38 | 39 | //--------------[referenced from ai/maze/pooh_black.cpp]-------------// 40 | void sound(int snd); 41 | 42 | 43 | /* located in common/misc.cpp */ 44 | 45 | //--------------[referenced from ai/maze/pooh_black.cpp]-------------// 46 | int random(int min, int max); 47 | 48 | -------------------------------------------------------------------------------- /ai/npc/balrog.fdh: -------------------------------------------------------------------------------- 1 | //hash:f6097911 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //-----------------[referenced from ai/npc/balrog.cpp]---------------// 7 | void megaquake(int quaketime, int snd); 8 | void quake(int quaketime, int snd); 9 | 10 | 11 | /* located in ObjManager.cpp */ 12 | 13 | //-----------------[referenced from ai/npc/balrog.cpp]---------------// 14 | Object *CreateObject(int x, int y, int type); 15 | 16 | 17 | /* located in map.cpp */ 18 | 19 | //-----------------[referenced from ai/npc/balrog.cpp]---------------// 20 | void map_ChangeTileWithSmoke(int x, int y, int newtile, int nclouds, bool boomflash, Object *push_behind); 21 | 22 | 23 | /* located in tsc.cpp */ 24 | 25 | //-----------------[referenced from ai/npc/balrog.cpp]---------------// 26 | int GetCurrentScript(void); 27 | 28 | 29 | /* located in ai/ai.cpp */ 30 | 31 | //-----------------[referenced from ai/npc/balrog.cpp]---------------// 32 | void randblink(Object *o, int blinkframe, int blinktime, int prob); 33 | bool DoTeleportOut(Object *o, int slowness); 34 | void DeleteObjectsOfType(int type); 35 | 36 | 37 | /* located in ai/npc/balrog.cpp */ 38 | 39 | //-----------------[referenced from ai/npc/balrog.cpp]---------------// 40 | void onspawn_balrog(Object *o); 41 | void ai_balrog(Object *o); 42 | void ai_balrog_drop_in(Object *o); 43 | void ai_balrog_bust_in(Object *o); 44 | void balrog_walk_init(Object *o); 45 | void balrog_walk_animation(Object *o); 46 | 47 | 48 | /* located in ai/sym/smoke.cpp */ 49 | 50 | //-----------------[referenced from ai/npc/balrog.cpp]---------------// 51 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 52 | void SmokeSide(Object *o, int nclouds, int dir); 53 | 54 | 55 | /* located in sound/sound.cpp */ 56 | 57 | //-----------------[referenced from ai/npc/balrog.cpp]---------------// 58 | void sound(int snd); 59 | 60 | 61 | /* located in common/misc.cpp */ 62 | 63 | //-----------------[referenced from ai/npc/balrog.cpp]---------------// 64 | int random(int min, int max); 65 | 66 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/npc/misery.fdh: -------------------------------------------------------------------------------- 1 | //hash:1c683b9c 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //-----------------[referenced from ai/npc/misery.cpp]---------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in map.cpp */ 11 | 12 | //-----------------[referenced from ai/npc/misery.cpp]---------------// 13 | Object *FindObjectByID2(int id2); 14 | 15 | 16 | /* located in trig.cpp */ 17 | 18 | //-----------------[referenced from ai/npc/misery.cpp]---------------// 19 | void ThrowObject(Object *o, int destx, int desty, int rand_variance, int speed); 20 | 21 | 22 | /* located in ai/ai.cpp */ 23 | 24 | //-----------------[referenced from ai/npc/misery.cpp]---------------// 25 | bool DoTeleportIn(Object *o, int slowness); 26 | void randblink(Object *o, int blinkframe, int blinktime, int prob); 27 | 28 | 29 | /* located in ai/npc/misery.cpp */ 30 | 31 | //-----------------[referenced from ai/npc/misery.cpp]---------------// 32 | void ai_misery_float(Object *o); 33 | void ai_miserys_bubble(Object *o); 34 | static Object *mbubble_find_target(void); 35 | void ai_misery_stand(Object *o); 36 | 37 | 38 | /* located in sound/sound.cpp */ 39 | 40 | //-----------------[referenced from ai/npc/misery.cpp]---------------// 41 | void sound(int snd); 42 | 43 | 44 | /* located in common/stat.cpp */ 45 | 46 | //-----------------[referenced from ai/npc/misery.cpp]---------------// 47 | void stat(const char *fmt, ...); 48 | void staterr(const char *fmt, ...); 49 | 50 | 51 | /* located in common/misc.cpp */ 52 | 53 | //-----------------[referenced from ai/npc/misery.cpp]---------------// 54 | int random(int min, int max); 55 | 56 | -------------------------------------------------------------------------------- /ai/npc/npcguest.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "../stdai.h" 3 | #include "npcguest.fdh" 4 | 5 | INITFUNC(AIRoutines) 6 | { 7 | ONTICK(OBJ_MAHIN, ai_npc_mahin); 8 | 9 | ONSPAWN(OBJ_YAMASHITA_FLOWERS, onspawn_set_frame_from_id2); 10 | ONTICK(OBJ_YAMASHITA_PAVILION, ai_yamashita_pavilion); 11 | 12 | ONTICK(OBJ_CHTHULU, ai_chthulu); 13 | 14 | GENERIC_NPC_NOFACEPLAYER(OBJ_DR_GERO); 15 | GENERIC_NPC_NOFACEPLAYER(OBJ_NURSE_HASUMI); 16 | } 17 | 18 | /* 19 | void c------------------------------() {} 20 | */ 21 | 22 | void ai_chthulu(Object *o) 23 | { 24 | if (!o->state) 25 | { 26 | o->SnapToGround(); 27 | o->state = 1; 28 | } 29 | 30 | // open eyes when player comes near 31 | o->frame = (pdistlx((48<state) 39 | { 40 | case 0: 41 | o->SnapToGround(); 42 | o->state = 1; 43 | o->frame = 2; 44 | 45 | case 1: // facing away 46 | break; 47 | 48 | case 2: // talking to player 49 | o->frame = 0; 50 | randblink(o); 51 | break; 52 | } 53 | } 54 | 55 | /* 56 | void c------------------------------() {} 57 | */ 58 | 59 | // Sandaime's Pavilion from Yamashita Farm 60 | void ai_yamashita_pavilion(Object *o) 61 | { 62 | if (!o->state) 63 | { 64 | if (o->dir == LEFT) 65 | { // Sandaime present 66 | o->state = 1; 67 | } 68 | else 69 | { // Sandaime gone 70 | o->x -= (TILE_W << CSF); 71 | o->state = 2; 72 | o->frame = 2; 73 | } 74 | } 75 | 76 | if (o->state == 1) 77 | { 78 | o->frame = 0; 79 | randblink(o); 80 | } 81 | } 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/sand/curly_boss.fdh: -------------------------------------------------------------------------------- 1 | //hash:676e013b 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //--------------[referenced from ai/sand/curly_boss.cpp]-------------// 7 | bool hitdetect(Object *o1, Object *o2); 8 | 9 | 10 | /* located in caret.cpp */ 11 | 12 | //--------------[referenced from ai/sand/curly_boss.cpp]-------------// 13 | Caret *effect(int x, int y, int effectno); 14 | 15 | 16 | /* located in player.cpp */ 17 | 18 | //--------------[referenced from ai/sand/curly_boss.cpp]-------------// 19 | void hurtplayer(int damage); 20 | 21 | 22 | /* located in ai/ai.cpp */ 23 | 24 | //--------------[referenced from ai/sand/curly_boss.cpp]-------------// 25 | Object *SpawnObjectAtActionPoint(Object *o, int otype); 26 | 27 | 28 | /* located in ai/sand/curly_boss.cpp */ 29 | 30 | //--------------[referenced from ai/sand/curly_boss.cpp]-------------// 31 | void ai_curly_boss(Object *o); 32 | static void curlyboss_fire(Object *o, int dir); 33 | void ai_curlyboss_shot(Object *o); 34 | 35 | 36 | /* located in ai/weapons/weapons.cpp */ 37 | 38 | //--------------[referenced from ai/sand/curly_boss.cpp]-------------// 39 | bool IsBlockedInShotDir(Object *o); 40 | void shot_spawn_effect(Object *o, int effectno); 41 | 42 | 43 | /* located in sound/sound.cpp */ 44 | 45 | //--------------[referenced from ai/sand/curly_boss.cpp]-------------// 46 | void sound(int snd); 47 | bool sound_is_playing(int snd); 48 | 49 | 50 | /* located in common/misc.cpp */ 51 | 52 | //--------------[referenced from ai/sand/curly_boss.cpp]-------------// 53 | int random(int min, int max); 54 | 55 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/sand/toroko_frenzied.fdh: -------------------------------------------------------------------------------- 1 | //hash:d1502efe 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //------------[referenced from ai/sand/toroko_frenzied.cpp]----------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in caret.cpp */ 11 | 12 | //------------[referenced from ai/sand/toroko_frenzied.cpp]----------// 13 | Caret *effect(int x, int y, int effectno); 14 | 15 | 16 | /* located in trig.cpp */ 17 | 18 | //------------[referenced from ai/sand/toroko_frenzied.cpp]----------// 19 | void ThrowObjectAtPlayer(Object *o, int rand_variance, int speed); 20 | 21 | 22 | /* located in ai/ai.cpp */ 23 | 24 | //------------[referenced from ai/sand/toroko_frenzied.cpp]----------// 25 | void aftermove_StickToLinkedActionPoint(Object *o); 26 | 27 | 28 | /* located in ai/sand/toroko_frenzied.cpp */ 29 | 30 | //------------[referenced from ai/sand/toroko_frenzied.cpp]----------// 31 | void ai_toroko_frenzied(Object *o); 32 | void ai_toroko_block(Object *o); 33 | void aftermove_toroko_block(Object *o); 34 | void ai_toroko_flower(Object *o); 35 | 36 | 37 | /* located in ai/sym/smoke.cpp */ 38 | 39 | //------------[referenced from ai/sand/toroko_frenzied.cpp]----------// 40 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 41 | Object *SmokePuff(int x, int y); 42 | 43 | 44 | /* located in sound/sound.cpp */ 45 | 46 | //------------[referenced from ai/sand/toroko_frenzied.cpp]----------// 47 | void sound(int snd); 48 | bool sound_is_playing(int snd); 49 | 50 | 51 | /* located in common/misc.cpp */ 52 | 53 | //------------[referenced from ai/sand/toroko_frenzied.cpp]----------// 54 | int random(int min, int max); 55 | 56 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/village/ma_pignon.fdh: -------------------------------------------------------------------------------- 1 | //hash:976221c5 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //-------------[referenced from ai/village/ma_pignon.cpp]------------// 7 | void quake(int quaketime, int snd); 8 | 9 | 10 | /* located in ObjManager.cpp */ 11 | 12 | //-------------[referenced from ai/village/ma_pignon.cpp]------------// 13 | Object *CreateObject(int x, int y, int type); 14 | 15 | 16 | /* located in caret.cpp */ 17 | 18 | //-------------[referenced from ai/village/ma_pignon.cpp]------------// 19 | Caret *effect(int x, int y, int effectno); 20 | 21 | 22 | /* located in ai/ai.cpp */ 23 | 24 | //-------------[referenced from ai/village/ma_pignon.cpp]------------// 25 | void randblink(Object *o, int blinkframe, int blinktime, int prob); 26 | void KillObjectsOfType(int type); 27 | 28 | 29 | /* located in ai/village/ma_pignon.cpp */ 30 | 31 | //-------------[referenced from ai/village/ma_pignon.cpp]------------// 32 | void ai_ma_pignon(Object *o); 33 | void ai_ma_pignon_rock(Object *o); 34 | void ai_ma_pignon_clone(Object *o); 35 | 36 | 37 | /* located in sound/sound.cpp */ 38 | 39 | //-------------[referenced from ai/village/ma_pignon.cpp]------------// 40 | void sound(int snd); 41 | 42 | 43 | /* located in common/misc.cpp */ 44 | 45 | //-------------[referenced from ai/village/ma_pignon.cpp]------------// 46 | int random(int min, int max); 47 | 48 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/weapons/missile.fdh: -------------------------------------------------------------------------------- 1 | //hash:52b1c23b 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //--------------[referenced from ai/weapons/missile.cpp]-------------// 7 | Object *CreateObject(int x, int y, int type); 8 | 9 | 10 | /* located in caret.cpp */ 11 | 12 | //--------------[referenced from ai/weapons/missile.cpp]-------------// 13 | Caret *effect(int x, int y, int effectno); 14 | 15 | 16 | /* located in trig.cpp */ 17 | 18 | //--------------[referenced from ai/weapons/missile.cpp]-------------// 19 | void vector_from_angle(uint8_t angle, int speed, int *xs, int *ys); 20 | 21 | 22 | /* located in ai/weapons/weapons.cpp */ 23 | 24 | //--------------[referenced from ai/weapons/missile.cpp]-------------// 25 | Object *damage_enemies(Object *o, uint32_t flags_to_exclude); 26 | void shot_dissipate(Object *o, int effectno); 27 | int damage_all_enemies_in_bb(Object *o, uint32_t flags_to_exclude); 28 | 29 | 30 | /* located in ai/weapons/missile.cpp */ 31 | 32 | //--------------[referenced from ai/weapons/missile.cpp]-------------// 33 | void ai_missile_shot(Object *o); 34 | void ai_missile_boom_spawner(Object *o); 35 | static void missilehitsmoke(Object *o); 36 | 37 | 38 | /* located in sound/sound.cpp */ 39 | 40 | //--------------[referenced from ai/weapons/missile.cpp]-------------// 41 | void sound(int snd); 42 | 43 | 44 | /* located in common/misc.cpp */ 45 | 46 | //--------------[referenced from ai/weapons/missile.cpp]-------------// 47 | int random(int min, int max); 48 | 49 | -------------------------------------------------------------------------------- /ai/weapons/nemesis.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "weapons.h" 3 | #include "nemesis.fdh" 4 | 5 | 6 | INITFUNC(AIRoutines) 7 | { 8 | ONTICK(OBJ_NEMESIS_SHOT, ai_nemesis_shot); 9 | ONTICK(OBJ_NEMESIS_SHOT_CURLY, ai_nemesis_shot); 10 | } 11 | 12 | /* 13 | void c------------------------------() {} 14 | */ 15 | 16 | void ai_nemesis_shot(Object *o) 17 | { 18 | if (run_shot(o, (o->shot.level != 2))) 19 | return; 20 | 21 | // smoke trails on level 1 22 | if (o->shot.level == 0) 23 | { 24 | // observe, first smokecloud is on 3rd frame; 25 | // it goes BLUE, YELLOW, BLUE--that's when the first cloud appears. 26 | if ((++o->timer % 4) == 3) 27 | { 28 | int x, y, xi, yi; 29 | 30 | switch(o->shot.dir) 31 | { 32 | case RIGHT: 33 | { 34 | x = o->Left(); 35 | y = o->CenterY(); 36 | xi = 0x200; 37 | yi = random(-0x200, 0x200); 38 | } 39 | break; 40 | 41 | case LEFT: 42 | { 43 | x = o->Right(); 44 | y = o->CenterY(); 45 | xi = -0x200; 46 | yi = random(-0x200, 0x200); 47 | } 48 | break; 49 | 50 | case UP: 51 | { 52 | x = o->CenterX(); 53 | y = o->Bottom(); 54 | xi = random(-0x200, 0x200); 55 | yi = -0x200; 56 | } 57 | break; 58 | 59 | case DOWN: 60 | { 61 | x = o->CenterX(); 62 | y = o->Top(); 63 | xi = random(-0x200, 0x200); 64 | yi = 0x200; 65 | } 66 | break; 67 | } 68 | 69 | x += o->xinertia; 70 | y += o->yinertia; 71 | 72 | Object *smoke = CreateObject(x, y, OBJ_SMOKE_CLOUD); 73 | smoke->xinertia = xi; 74 | smoke->yinertia = yi; 75 | smoke->PushBehind(o); 76 | 77 | if (o->timer2 == 0) 78 | { 79 | smoke->frame = 3; 80 | o->timer2 = 1; 81 | } 82 | else if (random(0, 1)) 83 | { 84 | smoke->frame = 1; 85 | } 86 | } 87 | } 88 | 89 | o->frame ^= 1; 90 | } 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/weapons/weapons.fdh: -------------------------------------------------------------------------------- 1 | //hash:b29df477 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //--------------[referenced from ai/weapons/weapons.cpp]-------------// 7 | bool hitdetect(Object *o1, Object *o2); 8 | 9 | 10 | /* located in caret.cpp */ 11 | 12 | //--------------[referenced from ai/weapons/weapons.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/weapons.cpp]-------------// 19 | uint8_t run_shot(Object *o, bool destroys_blocks); 20 | Object *check_hit_enemy(Object *shot, uint32_t flags_to_exclude); 21 | Object *damage_enemies(Object *o, uint32_t flags_to_exclude); 22 | int damage_all_enemies_in_bb(Object *o, uint32_t flags_to_exclude); 23 | void shot_spawn_effect(Object *o, int effectno); 24 | void shot_dissipate(Object *o, int effectno); 25 | bool shot_destroy_blocks(Object *o); 26 | bool IsBlockedInShotDir(Object *o); 27 | 28 | 29 | /* located in ai/sym/smoke.cpp */ 30 | 31 | //--------------[referenced from ai/weapons/weapons.cpp]-------------// 32 | void SmokeCloudsSlow(int x, int y, int nclouds); 33 | 34 | 35 | /* located in sound/sound.cpp */ 36 | 37 | //--------------[referenced from ai/weapons/weapons.cpp]-------------// 38 | void sound(int snd); 39 | 40 | 41 | /* located in common/stat.cpp */ 42 | 43 | //--------------[referenced from ai/weapons/weapons.cpp]-------------// 44 | void staterr(const char *fmt, ...); 45 | 46 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/weed/balrog_boss_flying.fdh: -------------------------------------------------------------------------------- 1 | //hash:4e9001fb 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //----------[referenced from ai/weed/balrog_boss_flying.cpp]---------// 7 | void quake(int quaketime, int snd); 8 | 9 | 10 | /* located in ObjManager.cpp */ 11 | 12 | //----------[referenced from ai/weed/balrog_boss_flying.cpp]---------// 13 | Object *CreateObject(int x, int y, int type); 14 | 15 | 16 | /* located in caret.cpp */ 17 | 18 | //----------[referenced from ai/weed/balrog_boss_flying.cpp]---------// 19 | Caret *effect(int x, int y, int effectno); 20 | 21 | 22 | /* located in trig.cpp */ 23 | 24 | //----------[referenced from ai/weed/balrog_boss_flying.cpp]---------// 25 | void EmFireAngledShot(Object *o, int objtype, int rand_variance, int speed); 26 | 27 | 28 | /* located in ai/ai.cpp */ 29 | 30 | //----------[referenced from ai/weed/balrog_boss_flying.cpp]---------// 31 | void KillObjectsOfType(int type); 32 | 33 | 34 | /* located in ai/weed/balrog_boss_flying.cpp */ 35 | 36 | //----------[referenced from ai/weed/balrog_boss_flying.cpp]---------// 37 | void ai_balrog_boss_flying(Object *o); 38 | void ondeath_balrog_boss_flying(Object *o); 39 | void ai_balrog_shot_bounce(Object *o); 40 | 41 | 42 | /* located in ai/sym/smoke.cpp */ 43 | 44 | //----------[referenced from ai/weed/balrog_boss_flying.cpp]---------// 45 | void SmokeSide(Object *o, int nclouds, int dir); 46 | 47 | 48 | /* located in sound/sound.cpp */ 49 | 50 | //----------[referenced from ai/weed/balrog_boss_flying.cpp]---------// 51 | void sound(int snd); 52 | 53 | 54 | /* located in common/misc.cpp */ 55 | 56 | //----------[referenced from ai/weed/balrog_boss_flying.cpp]---------// 57 | int random(int min, int max); 58 | 59 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ai/weed/weed.fdh: -------------------------------------------------------------------------------- 1 | //hash:55189a91 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //-----------------[referenced from ai/weed/weed.cpp]----------------// 7 | void quake(int quaketime, int snd); 8 | 9 | 10 | /* located in caret.cpp */ 11 | 12 | //-----------------[referenced from ai/weed/weed.cpp]----------------// 13 | Caret *effect(int x, int y, int effectno); 14 | 15 | 16 | /* located in ai/ai.cpp */ 17 | 18 | //-----------------[referenced from ai/weed/weed.cpp]----------------// 19 | Object *SpawnObjectAtActionPoint(Object *o, int otype); 20 | void randblink(Object *o, int blinkframe, int blinktime, int prob); 21 | 22 | 23 | /* located in ai/weed/weed.cpp */ 24 | 25 | //-----------------[referenced from ai/weed/weed.cpp]----------------// 26 | void ai_critter(Object *o); 27 | void ai_bat_hang(Object *o); 28 | void ai_bat_circle(Object *o); 29 | void ai_jelly(Object *o); 30 | void ai_giant_jelly(Object *o); 31 | void ai_mannan(Object *o); 32 | void ai_mannan_shot(Object *o); 33 | void ai_frog(Object *o); 34 | void ai_hey_spawner(Object *o); 35 | void ai_motorbike(Object *o); 36 | void ai_malco(Object *o); 37 | void ai_malco_broken(Object *o); 38 | 39 | 40 | /* located in ai/sym/smoke.cpp */ 41 | 42 | //-----------------[referenced from ai/weed/weed.cpp]----------------// 43 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 44 | 45 | 46 | /* located in sound/sound.cpp */ 47 | 48 | //-----------------[referenced from ai/weed/weed.cpp]----------------// 49 | void sound(int snd); 50 | 51 | 52 | /* located in common/misc.cpp */ 53 | 54 | //-----------------[referenced from ai/weed/weed.cpp]----------------// 55 | int random(int min, int max); 56 | 57 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /autogen/objnames.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /autogen/stagedata.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /buildscript: -------------------------------------------------------------------------------- 1 | makegen 2 | make -j4 3 | %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 | -------------------------------------------------------------------------------- /cave.tns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gameblabla/nxengine-nspire/711c889b637ef86bfd5a84ed4d89bfe55b0a5286/cave.tns -------------------------------------------------------------------------------- /cavestorynspire.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gameblabla/nxengine-nspire/711c889b637ef86bfd5a84ed4d89bfe55b0a5286/cavestorynspire.zip -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /common/BList.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2007, Haiku, Inc. All Rights Reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _BE_LIST_H 6 | #define _BE_LIST_H 7 | 8 | 9 | #include "SupportDefs.h" 10 | 11 | 12 | class BList { 13 | public: 14 | BList(int32 count = 20); 15 | BList(const BList& anotherList); 16 | virtual ~BList(); 17 | 18 | virtual BList& operator =(const BList &); 19 | 20 | /* Adding and removing items. */ 21 | bool AddItem(const void* item, int32 index); 22 | bool AddItem(const void* item); 23 | bool AddList(const BList* list, int32 index); 24 | bool AddList(const BList* list); 25 | bool RemoveItem(void* item); 26 | void* RemoveItem(int32 index); 27 | bool RemoveItems(int32 index, int32 count); 28 | bool ReplaceItem(int32 index, void* newItem); 29 | virtual void MakeEmpty(); 30 | 31 | // Reorder items 32 | void SortItems(int (*compareFunc)(const void*, const void*)); 33 | bool SwapItems(int32 indexA, int32 indexB); 34 | bool MoveItem(int32 fromIndex, int32 toIndex); 35 | 36 | // Retrieve items 37 | void* ItemAt(int32 index) const; 38 | void* FirstItem() const; 39 | void* ItemAtFast(int32) const; 40 | // does not check the array bounds! 41 | 42 | void* LastItem() const; 43 | void* Items() const; 44 | 45 | // Query 46 | bool HasItem(void* item) const; 47 | int32 IndexOf(void* item) const; 48 | int32 CountItems() const; 49 | bool IsEmpty() const; 50 | 51 | // Iteration 52 | void DoForEach(bool (*func)(void* item)); 53 | void DoForEach(bool (*func)(void* item, void* arg2), void *arg2); 54 | 55 | private: 56 | bool _ResizeArray(int32 count); 57 | 58 | void** fObjectList; 59 | int32 fPhysicalSize; 60 | int32 fItemCount; 61 | int32 fBlockSize; 62 | int32 fResizeThreshold; 63 | uint32 _reserved[1]; 64 | }; 65 | 66 | #endif // _BE_LIST_H 67 | -------------------------------------------------------------------------------- /common/DBuffer.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /common/InitList.cpp: -------------------------------------------------------------------------------- 1 | 2 | // this is a combination of some C++ and preprocessor magic which allows a 3 | // group of initilization functions to be declared across many different 4 | // source files and then at the appropriate time all can be called at once. 5 | // The "trick" is that it automatically works for all modules linked to the 6 | // program so you don't have to keep a handmade list anywhere of the names 7 | // of the initilization functions. This is used by the AI functions to initilize 8 | // all the function pointers etc for the various creatures. 9 | #include "InitList.h" 10 | #include "InitList.fdh" 11 | 12 | void InitList::AddFunction(void (*func)(void)) 13 | { 14 | AddFunction((void *)func); 15 | } 16 | 17 | void InitList::AddFunction(bool (*func)(void)) 18 | { 19 | AddFunction((void *)func); 20 | } 21 | 22 | void InitList::AddFunction(void *func) 23 | { 24 | //stat("AddFunction (void)%08x [%d]", func, fCount); 25 | if (fCount >= MAX_INIT_RECORDS) 26 | return; 27 | 28 | fFunctions[fCount++] = (void *)func; 29 | } 30 | 31 | /* 32 | void c------------------------------() {} 33 | */ 34 | 35 | bool InitList::CallFunctions() 36 | { 37 | int i; 38 | 39 | if (fCount >= MAX_INIT_RECORDS) 40 | { 41 | stat("InitList::CallFunctions(%08x): too many initializers", this); 42 | return 1; 43 | } 44 | 45 | stat("InitList::CallFunctions(%08x): executing %d functions...", this, fCount); 46 | 47 | for(i=0;iAddFunction(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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /common/bufio.fdh: -------------------------------------------------------------------------------- 1 | //hash:f4b316a6 2 | //automatically generated by Makegen 3 | 4 | /* located in common/bufio.cpp */ 5 | 6 | //-----------------[referenced from common/bufio.cpp]----------------// 7 | uint8_t read_U8(const uint8_t **data, const uint8_t *data_end); 8 | uint16_t read_U16(const uint8_t **data, const uint8_t *data_end); 9 | uint32_t read_U32(const uint8_t **data, const uint8_t *data_end); 10 | void write_U8(DBuffer *buffer, uint8_t data); 11 | void write_U16(DBuffer *buffer, uint16_t data); 12 | void write_U32(DBuffer *buffer, uint32_t data); 13 | void write_U64(DBuffer *buffer, uint64_t data); 14 | void write_F32(DBuffer *buffer, float data); 15 | void write_F64(DBuffer *buffer, double data); 16 | uint32_t read_U24(const uint8_t **data, const uint8_t *data_end); 17 | void write_U24(DBuffer *buffer, uint32_t data); 18 | char read_char(const char **data, const char *data_end); 19 | char read_nonblank_char(const char **data, const char *data_end); 20 | char *read_string(const uint8_t **data, const uint8_t *data_end); 21 | void read_Variable(DBuffer *out, const uint8_t **data, const uint8_t *data_end); 22 | void write_Variable(DBuffer *out, DBuffer *in); 23 | void write_Variable(DBuffer *out, const uint8_t *data, int len); 24 | void read_Variable16(DBuffer *out, const uint8_t **data, const uint8_t *data_end); 25 | void write_Variable16(DBuffer *out, DBuffer *in); 26 | 27 | 28 | /* located in common/stat.cpp */ 29 | 30 | //-----------------[referenced from common/bufio.cpp]----------------// 31 | void staterr(const char *fmt, ...); 32 | 33 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /common/misc.fdh: -------------------------------------------------------------------------------- 1 | //hash:dacee9eb 2 | //automatically generated by Makegen 3 | 4 | /* located in platform.cpp */ 5 | 6 | //------------------[referenced from common/misc.cpp]----------------// 7 | FILE *fileopen(const char *fname, const char *mode); 8 | 9 | 10 | /* located in common/stat.cpp */ 11 | 12 | //------------------[referenced from common/misc.cpp]----------------// 13 | void stat(const char *fmt, ...); 14 | void staterr(const char *fmt, ...); 15 | 16 | 17 | /* located in common/misc.cpp */ 18 | 19 | //------------------[referenced from common/misc.cpp]----------------// 20 | uint16_t fgeti(FILE *fp); 21 | uint32_t fgetl(FILE *fp); 22 | void fputi(uint16_t word, FILE *fp); 23 | void fputl(uint32_t word, FILE *fp); 24 | uint16_t fgeti(FILE *fp); 25 | uint32_t fgetl(FILE *fp); 26 | void fputi(uint16_t word, FILE *fp); 27 | void fputl(uint32_t word, FILE *fp); 28 | double fgetfloat(FILE *fp); 29 | void fputfloat(double q, FILE *fp); 30 | void freadstring(FILE *fp, char *buf, int max); 31 | void fputstring(const char *buf, FILE *fp); 32 | void fputstringnonull(const char *buf, FILE *fp); 33 | bool fverifystring(FILE *fp, const char *str); 34 | void fgetcsv(FILE *fp, char *str, int maxlen); 35 | int fgeticsv(FILE *fp); 36 | double fgetfcsv(FILE *fp); 37 | void fgetline(FILE *fp, char *str, int maxlen); 38 | int filesize(FILE *fp); 39 | bool file_exists(const char *fname); 40 | char *stprintf(const char *fmt, ...); 41 | int random(int min, int max); 42 | uint32_t getrand(); 43 | void seedrand(uint32_t newseed); 44 | bool strbegin(const char *bigstr, const char *smallstr); 45 | bool strcasebegin(const char *bigstr, const char *smallstr); 46 | int count_string_list(const char *list[]); 47 | char *GetStaticStr(void); 48 | void maxcpy(char *dst, const char *src, int maxlen); 49 | void fresetboolean(void); 50 | char fbooleanread(FILE *fp); 51 | void fbooleanwrite(char bit, FILE *fp); 52 | void fbooleanflush(FILE *fp); 53 | 54 | -------------------------------------------------------------------------------- /common/misc.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gameblabla/nxengine-nspire/711c889b637ef86bfd5a84ed4d89bfe55b0a5286/common/misc.obj -------------------------------------------------------------------------------- /common/stat.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "basics.h" 8 | #include "misc.fdh" 9 | 10 | #define MAXBUFSIZE 1024 11 | char logfilename[64] = { 0 }; 12 | void writelog(const char *buf, bool append_cr); 13 | 14 | 15 | void SetLogFilename(const char *fname) 16 | { 17 | maxcpy(logfilename, fname, sizeof(logfilename)); 18 | remove(logfilename); 19 | } 20 | 21 | void writelog(const char *buf, bool append_cr) 22 | { 23 | FILE *fp; 24 | 25 | fp = fileopen(logfilename, "a+"); 26 | if (fp) 27 | { 28 | fputs(buf, fp); 29 | if (append_cr) fputc('\n', fp); 30 | 31 | fclose(fp); 32 | } 33 | } 34 | 35 | /* 36 | void c------------------------------() {} 37 | */ 38 | 39 | void stat(const char *fmt, ...) 40 | { 41 | va_list ar; 42 | char buffer[MAXBUFSIZE]; 43 | 44 | va_start(ar, fmt); 45 | vsnprintf(buffer, sizeof(buffer), fmt, ar); 46 | va_end(ar); 47 | 48 | puts(buffer); 49 | fflush(stdout); 50 | 51 | if (logfilename[0]) 52 | writelog(buffer, true); 53 | } 54 | 55 | void staterr(const char *fmt, ...) 56 | { 57 | va_list ar; 58 | char buffer[MAXBUFSIZE]; 59 | 60 | va_start(ar, fmt); 61 | vsnprintf(buffer, sizeof(buffer), fmt, ar); 62 | va_end(ar); 63 | 64 | printf(" error << %s >> \n", buffer); 65 | fflush(stdout); 66 | 67 | if (logfilename[0]) 68 | { 69 | writelog(" error << ", false); 70 | writelog(buffer, false); 71 | writelog(" >>\n", false); 72 | } 73 | } 74 | 75 | 76 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /common/stat.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gameblabla/nxengine-nspire/711c889b637ef86bfd5a84ed4d89bfe55b0a5286/common/stat.obj -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /console.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _CONSOLE_H 3 | #define _CONSOLE_H 4 | 5 | #define CONSOLE_MAXCMDLEN 48 6 | #define CONSOLE_MAXRESPONSELEN 48 7 | 8 | // how many commands to remember in the backbuffer 9 | #define CONSOLE_MAX_BACK 8 10 | 11 | struct CommandEntry 12 | { 13 | const char *name; 14 | void (*handler)(StringList *args, int num); 15 | int minArgs, maxArgs; 16 | }; 17 | 18 | class DebugConsole 19 | { 20 | public: 21 | DebugConsole(); 22 | 23 | void SetVisible(bool newstate); 24 | bool IsVisible(); 25 | 26 | bool HandleKey(int key); 27 | void HandleKeyRelease(int key); 28 | void Draw(); 29 | 30 | bool Execute(const char *line); 31 | void Print(const char *fmt, ...); 32 | 33 | private: 34 | void DrawText(const char *text); 35 | void MatchCommand(const char *cmd, BList *matches); 36 | char *SplitCommand(const char *line_in, StringList *args); 37 | void ExpandCommand(); 38 | 39 | char fLine[CONSOLE_MAXCMDLEN]; 40 | int fLineLen; 41 | int fKeyDown; 42 | int fRepeatTimer; 43 | 44 | char fLineToExpand[CONSOLE_MAXCMDLEN]; 45 | bool fBrowsingExpansion; 46 | int fExpandIndex; 47 | 48 | char fResponse[CONSOLE_MAXRESPONSELEN]; 49 | int fResponseTimer; 50 | 51 | int fCursorTimer; 52 | bool fVisible; 53 | 54 | // up-down last-command buffer 55 | int fBackIndex; 56 | StringList fBackBuffer; 57 | }; 58 | 59 | extern DebugConsole console; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /endgame/credits.fdh: -------------------------------------------------------------------------------- 1 | //hash:2dcff26e 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //----------------[referenced from endgame/credits.cpp]--------------// 7 | void game_tick_normal(void); 8 | 9 | 10 | /* located in tsc.cpp */ 11 | 12 | //----------------[referenced from endgame/credits.cpp]--------------// 13 | void Clear(); 14 | 15 | 16 | /* located in endgame/credits.cpp */ 17 | 18 | //----------------[referenced from endgame/credits.cpp]--------------// 19 | bool credit_init(int parameter); 20 | void credit_close(); 21 | void credit_tick(); 22 | void credit_set_image(int imgno); 23 | void credit_clear_image(); 24 | 25 | 26 | /* located in graphics/font.cpp */ 27 | 28 | //----------------[referenced from endgame/credits.cpp]--------------// 29 | int GetFontWidth(const char *text, int spacing, bool is_shaded); 30 | int font_draw(int x, int y, const char *text, int spacing, NXFont *font); 31 | 32 | 33 | /* located in sound/sound.cpp */ 34 | 35 | //----------------[referenced from endgame/credits.cpp]--------------// 36 | void music(int songno); 37 | 38 | 39 | /* located in sound/org.cpp */ 40 | 41 | //----------------[referenced from endgame/credits.cpp]--------------// 42 | void org_fade(void); 43 | 44 | 45 | /* located in common/stat.cpp */ 46 | 47 | //----------------[referenced from endgame/credits.cpp]--------------// 48 | void stat(const char *fmt, ...); 49 | void staterr(const char *fmt, ...); 50 | 51 | 52 | /* located in common/misc.cpp */ 53 | 54 | //----------------[referenced from endgame/credits.cpp]--------------// 55 | void maxcpy(char *dst, const char *src, int maxlen); 56 | bool file_exists(const char *fname); 57 | 58 | -------------------------------------------------------------------------------- /endgame/credits.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _CREDITS_H 3 | #define _CREDITS_H 4 | 5 | #define MAX_BIGIMAGES 20 6 | #define CRED_MAX_TEXT 80 7 | #include "CredReader.h" 8 | 9 | // a currently displayed line of text 10 | struct CredLine 11 | { 12 | char text[CRED_MAX_TEXT]; 13 | int image; 14 | int x, y; 15 | 16 | CredLine *next, *prev; 17 | }; 18 | 19 | class BigImage 20 | { 21 | public: 22 | bool Init(); 23 | ~BigImage(); 24 | 25 | void Set(int num); 26 | void Clear(); 27 | void Draw(); 28 | 29 | private: 30 | int imagex, state; 31 | int imgno; 32 | NXSurface *images[MAX_BIGIMAGES]; 33 | }; 34 | 35 | 36 | class Credits 37 | { 38 | public: 39 | bool Init(); 40 | void Tick(); 41 | ~Credits(); 42 | 43 | BigImage bigimage; // current "SIL" big left-hand image 44 | 45 | private: 46 | void RunNextCommand(); 47 | bool Jump(int label); 48 | 49 | CredLine *NewLine(); 50 | CredLine *AddLine(CredLine *line); 51 | void RemoveLine(CredLine *line); 52 | 53 | void Draw(); 54 | bool DrawLine(CredLine *line); 55 | 56 | 57 | int spawn_y; // position of next line relative to top of roll 58 | int scroll_y; // CSFd roll position 59 | 60 | int xoffset; // x position of next line 61 | 62 | // turns off scrolling and further script execution when "/" command hit at end 63 | bool roll_running; 64 | 65 | 66 | int lines_out; // debug... 67 | int lines_vis; // ...counters 68 | 69 | CredReader script; 70 | CredLine *firstline, *lastline; 71 | }; 72 | 73 | 74 | bool credit_init(int parameter); 75 | void credit_tick(); 76 | void credit_set_image(int imgno); 77 | void credit_clear_image(); 78 | void credit_close(); 79 | 80 | #endif 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /extract/extract.fdh: -------------------------------------------------------------------------------- 1 | //hash:ae36d920 2 | //automatically generated by Makegen 3 | 4 | /* located in platform.cpp */ 5 | 6 | //----------------[referenced from extract/extract.cpp]--------------// 7 | FILE *fileopen(const char *fname, const char *mode); 8 | 9 | 10 | /* located in extract/extract.cpp */ 11 | 12 | //----------------[referenced from extract/extract.cpp]--------------// 13 | static int extract_do(void); 14 | int extract_main(); 15 | int introduction(); 16 | int conclusion(); 17 | bool findfiles(FILE *exefp); 18 | uint32_t findfile(const char *fname, FILE *exefp, int headersize, int *len_out, uint32_t *crc_out); 19 | 20 | 21 | /* located in extract/extractpxt.cpp */ 22 | 23 | //----------------[referenced from extract/extract.cpp]--------------// 24 | bool extract_pxt(FILE *fp); 25 | 26 | 27 | /* located in extract/extractfiles.cpp */ 28 | 29 | //----------------[referenced from extract/extract.cpp]--------------// 30 | bool extract_files(FILE *exefp); 31 | 32 | 33 | /* located in extract/extractstages.cpp */ 34 | 35 | //----------------[referenced from extract/extract.cpp]--------------// 36 | bool extract_stages(FILE *exefp); 37 | 38 | 39 | /* located in extract/crc.cpp */ 40 | 41 | //----------------[referenced from extract/extract.cpp]--------------// 42 | void crc_init(void); 43 | uint32_t crc_calc(uint8_t *buf, uint32_t size); 44 | 45 | 46 | /* located in common/stat.cpp */ 47 | 48 | //----------------[referenced from extract/extract.cpp]--------------// 49 | void staterr(const char *fmt, ...); 50 | void stat(const char *fmt, ...); 51 | 52 | 53 | /* located in common/misc.cpp */ 54 | 55 | //----------------[referenced from extract/extract.cpp]--------------// 56 | int filesize(FILE *fp); 57 | 58 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /floattext.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /font.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gameblabla/nxengine-nspire/711c889b637ef86bfd5a84ed4d89bfe55b0a5286/font.ttf -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /graphics/font.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _FONT_H 3 | #define _FONT_H 4 | 5 | // I don't want to needlessly include in every file that 6 | // includes this one so this forward declaration makes those modules 7 | // that don't what a TTF_Font is shut up about InitChars(); however 8 | // technically TTF_Font is a typedef, so if the including file knows 9 | // the real declaration, it would bawk at this. 10 | #ifndef SDL_TTF_VERSION 11 | struct TTF_Font; 12 | #endif 13 | 14 | #define NUM_FONT_LETTERS 256 15 | #define NUM_LETTERS_RENDERED 128 16 | #define FONT_DEFAULT_SPACING 5 17 | 18 | class NXFont 19 | { 20 | public: 21 | NXFont(); 22 | ~NXFont(); 23 | 24 | bool InitChars(TTF_Font *font, uint32_t color); 25 | bool InitCharsShadowed(TTF_Font *top, uint32_t color, uint32_t shadowcolor); 26 | 27 | bool InitBitmapChars(SDL_Surface *sheet, uint32_t fgcolor, uint32_t color); 28 | bool InitBitmapCharsShadowed(SDL_Surface *sheet, uint32_t fgcolor, uint32_t color, uint32_t shadowcolor); 29 | 30 | void free(); 31 | 32 | SDL_Surface *letters[NUM_FONT_LETTERS]; 33 | 34 | private: 35 | void ReplaceColor(SDL_Surface *sfc, uint32_t oldcolor, uint32_t newcolor); 36 | }; 37 | 38 | 39 | extern NXFont whitefont; 40 | extern NXFont greenfont; 41 | extern NXFont bluefont; // used for "F3:Options" text on pause screen 42 | extern NXFont shadowfont; // white letters w/ drop shadow 43 | 44 | int font_draw(int x, int y, const char *text, int spacing=0, NXFont *font=&whitefont); 45 | int font_draw_shaded(int x, int y, const char *text, int spacing=0, NXFont *font=&whitefont); 46 | 47 | int GetFontWidth(const char *text, int spacing=0, bool is_shaded=false); 48 | int GetFontHeight(); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /graphics/graphics.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _GRAPHICS_H 3 | #define _GRAPHICS_H 4 | 5 | #include "nxsurface.h" 6 | // (unscaled) screen size/video mode 7 | #define SCREEN_WIDTH 320 8 | #define SCREEN_HEIGHT 240 9 | 10 | extern NXSurface *screen; 11 | extern const NXColor DK_BLUE; 12 | extern const NXColor DBLACK; 13 | extern const NXColor CLEAR; 14 | extern bool use_palette; 15 | 16 | namespace Graphics 17 | { 18 | bool init(int resolution); 19 | void close(); 20 | 21 | bool InitVideo(); 22 | void SetFullscreen(bool enable); 23 | bool SetResolution(int factor, bool restoreOnFailure=true); 24 | const char **GetResolutions(); 25 | bool FlushAll(); 26 | 27 | // --------------------------------------- 28 | 29 | void CopySpriteToTile(int spr, int tileno, int offset_x, int offset_y); 30 | void ShowLoadingScreen(); 31 | 32 | void BlitSurface(NXSurface *src, NXRect *srcrect, NXSurface *dst, NXRect *dstrect); 33 | 34 | // these are all just convenience wrappers around the equivalent 35 | // NXSurface member functions, most of which are set to target the screen. 36 | void DrawSurface(NXSurface *src, int x, int y); 37 | void DrawSurface(NXSurface *src, int dstx, int dsty, int srcx, int srcy, int wd, int ht); 38 | 39 | void BlitPatternAcross(NXSurface *sfc, int x_dst, int y_dst, int y_src, int height); 40 | 41 | 42 | void ClearScreen(NXColor color); 43 | void ClearScreen(uint8_t r, uint8_t g, uint8_t b); 44 | 45 | 46 | void DrawRect(int x1, int y1, int x2, int y2, NXColor color); 47 | void FillRect(int x1, int y1, int x2, int y2, NXColor color); 48 | void DrawPixel(int x, int y, NXColor color); 49 | 50 | void DrawRect(int x1, int y1, int x2, int y2, uint8_t r, uint8_t g, uint8_t b); 51 | void FillRect(int x1, int y1, int x2, int y2, uint8_t r, uint8_t g, uint8_t b); 52 | void DrawPixel(int x, int y, uint8_t r, uint8_t g, uint8_t b); 53 | 54 | void set_clip_rect(int x, int y, int w, int h); 55 | void set_clip_rect(NXRect *rect); 56 | void clear_clip_rect(); 57 | 58 | void SetDrawTarget(NXSurface *surface); 59 | }; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /graphics/palette.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "../nx.h" 3 | #include "palette.h" 4 | #include "palette.fdh" 5 | 6 | #define MAX_COLORS 256 7 | static SDL_Color screenpal[MAX_COLORS]; 8 | int ncolors = -1; 9 | 10 | // clear out all palette entries 11 | void palette_reset(void) 12 | { 13 | ncolors = 0; 14 | } 15 | 16 | // given a paletted surface add it's colors in to the screen colormap 17 | // then return a surface with the color indexes remapped ready to 18 | // be displayed on the screen. insfc is either freed, or reused to 19 | // create the returned surface. 20 | SDL_Surface *palette_add(SDL_Surface *sfc) 21 | { 22 | SDL_Palette *pal = sfc->format->palette; 23 | int remap[MAX_COLORS]; 24 | int x, y, i; 25 | 26 | if (sfc->format->BitsPerPixel > 8) 27 | { 28 | staterr("palette_add: input surface is > 8bpp"); 29 | return NULL; 30 | } 31 | 32 | stat("palette_add: adding %d colors to screen palette...", pal->ncolors); 33 | for(i=0;incolors;i++) 34 | { 35 | remap[i] = palette_alloc(pal->colors[i].r, pal->colors[i].g, pal->colors[i].b); 36 | if (remap[i] == -1) 37 | return sfc; 38 | } 39 | 40 | SDL_SetColors(screen->GetSDLSurface(), screenpal, 0, ncolors); 41 | return sfc; 42 | /* 43 | // remap indexes in surface 44 | for(y=0;yh;y++) 45 | { 46 | uint8_t *pixels = (uint8_t *)sfc->pixels + (y * sfc->pitch); 47 | 48 | for(x=0;xw;x++) 49 | { 50 | *pixels = remap[*pixels]; 51 | pixels++; 52 | } 53 | } 54 | 55 | return sfc;*/ 56 | } 57 | 58 | 59 | // add the given color to the screen palette and return it's index. 60 | int palette_alloc(uint8_t r, uint8_t g, uint8_t b) 61 | { 62 | int i; 63 | 64 | for(i=0;i= MAX_COLORS) 75 | { 76 | staterr("palette_alloc: out of color space!"); 77 | return -1; 78 | } 79 | 80 | screenpal[ncolors].r = r; 81 | screenpal[ncolors].g = g; 82 | screenpal[ncolors].b = b; 83 | return ncolors++; 84 | } 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /graphics/palette.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _PALETTE_H 3 | #define _PALETTE_H 4 | 5 | 6 | 7 | 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /graphics/tileset.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /intro/intro.fdh: -------------------------------------------------------------------------------- 1 | //hash:9527a9cb 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //------------------[referenced from intro/intro.cpp]----------------// 7 | void game_tick_normal(void); 8 | 9 | 10 | /* located in caret.cpp */ 11 | 12 | //------------------[referenced from intro/intro.cpp]----------------// 13 | Caret *effect(int x, int y, int effectno); 14 | 15 | 16 | /* located in tsc.cpp */ 17 | 18 | //------------------[referenced from intro/intro.cpp]----------------// 19 | ScriptInstance *GetCurrentScriptInstance(); 20 | void StopScripts(void); 21 | 22 | 23 | /* located in input.cpp */ 24 | 25 | //------------------[referenced from intro/intro.cpp]----------------// 26 | bool buttonjustpushed(void); 27 | 28 | 29 | /* located in intro/intro.cpp */ 30 | 31 | //------------------[referenced from intro/intro.cpp]----------------// 32 | bool intro_init(int param); 33 | void intro_tick(); 34 | void ai_intro_kings(Object *o); 35 | void ai_intro_crown(Object *o); 36 | void ai_intro_doctor(Object *o); 37 | 38 | 39 | /* located in sound/sound.cpp */ 40 | 41 | //------------------[referenced from intro/intro.cpp]----------------// 42 | void music(int songno); 43 | 44 | 45 | /* located in common/misc.cpp */ 46 | 47 | //------------------[referenced from intro/intro.cpp]----------------// 48 | int random(int min, int max); 49 | 50 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /intro/title.fdh: -------------------------------------------------------------------------------- 1 | //hash:0cc16f11 2 | //automatically generated by Makegen 3 | 4 | /* located in profile.cpp */ 5 | 6 | //------------------[referenced from intro/title.cpp]----------------// 7 | bool AnyProfileExists(); 8 | bool ProfileExists(int num); 9 | 10 | 11 | /* located in statusbar.cpp */ 12 | 13 | //------------------[referenced from intro/title.cpp]----------------// 14 | void niku_draw(int value, bool force_white); 15 | 16 | 17 | /* located in input.cpp */ 18 | 19 | //------------------[referenced from intro/title.cpp]----------------// 20 | bool justpushed(int k); 21 | bool buttonjustpushed(void); 22 | 23 | 24 | /* located in niku.cpp */ 25 | 26 | //------------------[referenced from intro/title.cpp]----------------// 27 | bool niku_load(uint32_t *value_out); 28 | 29 | 30 | /* located in intro/title.cpp */ 31 | 32 | //------------------[referenced from intro/title.cpp]----------------// 33 | bool title_init(int param); 34 | void title_tick(); 35 | static void selectoption(int index); 36 | static void handle_input(); 37 | static void draw_title(); 38 | void run_konami_code(); 39 | 40 | 41 | /* located in graphics/font.cpp */ 42 | 43 | //------------------[referenced from intro/title.cpp]----------------// 44 | int GetFontWidth(const char *text, int spacing, bool is_shaded); 45 | int font_draw(int x, int y, const char *text, int spacing, NXFont *font); 46 | 47 | 48 | /* located in sound/sound.cpp */ 49 | 50 | //------------------[referenced from intro/title.cpp]----------------// 51 | void music(int songno); 52 | void sound(int snd); 53 | 54 | 55 | /* located in common/stat.cpp */ 56 | 57 | //------------------[referenced from intro/title.cpp]----------------// 58 | void stat(const char *fmt, ...); 59 | 60 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /inventory.fdh: -------------------------------------------------------------------------------- 1 | //hash:4e75e7a3 2 | //automatically generated by Makegen 3 | 4 | /* located in game.cpp */ 5 | 6 | //-------------------[referenced from inventory.cpp]-----------------// 7 | void DrawScene(void); 8 | 9 | 10 | /* located in statusbar.cpp */ 11 | 12 | //-------------------[referenced from inventory.cpp]-----------------// 13 | void DrawWeaponLevel(int x, int y, int wpn); 14 | void DrawWeaponAmmo(int x, int y, int wpn); 15 | void weapon_slide(int dir, int newwpn); 16 | 17 | 18 | /* located in tsc.cpp */ 19 | 20 | //-------------------[referenced from inventory.cpp]-----------------// 21 | int GetCurrentScript(void); 22 | ScriptInstance *StartScript(int scriptno, int pageno); 23 | void StopScripts(void); 24 | 25 | 26 | /* located in input.cpp */ 27 | 28 | //-------------------[referenced from inventory.cpp]-----------------// 29 | bool justpushed(int k); 30 | bool buttonjustpushed(void); 31 | 32 | 33 | /* located in inventory.cpp */ 34 | 35 | //-------------------[referenced from inventory.cpp]-----------------// 36 | bool inventory_init(int param); 37 | void inventory_tick(void); 38 | int RefreshInventoryScreen(void); 39 | void UnlockInventoryInput(void); 40 | static void DrawInventory(void); 41 | static void RunSelector(stSelector *selector); 42 | static void ExitInventory(void); 43 | static void DrawSelector(stSelector *selector, int x, int y); 44 | 45 | 46 | /* located in sound/sound.cpp */ 47 | 48 | //-------------------[referenced from inventory.cpp]-----------------// 49 | void sound(int snd); 50 | 51 | -------------------------------------------------------------------------------- /inventory.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _INVENTORY_H 3 | #define _INVENTORY_H 4 | 5 | #define MAXLISTLEN 100 6 | 7 | struct stSelector 8 | { 9 | uchar flashstate, animtimer; 10 | 11 | int spacing_x, spacing_y; 12 | int cursel, lastsel; 13 | int sprite; 14 | int nitems; 15 | int sound; 16 | int rowlen; 17 | 18 | int scriptbase; 19 | int items[MAXLISTLEN]; 20 | }; 21 | 22 | struct stInventory 23 | { 24 | int x, y, w, h; 25 | 26 | stSelector armssel; 27 | stSelector itemsel; 28 | stSelector *curselector; 29 | 30 | char lockinput; 31 | }; 32 | 33 | 34 | bool inventory_init(int param); 35 | void inventory_tick(void); 36 | 37 | enum INVENTORY 38 | { 39 | ITEM_ARTHURS_KEY = 1, 40 | ITEM_MAP_SYSTEM, 41 | ITEM_STANTAS_KEY, 42 | ITEM_SILVER_LOCKET, 43 | ITEM_BEAST_FANG, 44 | ITEM_LIFE_CAPSULE, 45 | ITEM_ID_CARD, 46 | ITEM_JELLYFISH_JUICE, 47 | ITEM_RUSTY_KEY, 48 | ITEM_GUM_KEY, 49 | ITEM_GUM_BASE, 50 | ITEM_CHARCOAL, 51 | ITEM_EXPLOSIVE, 52 | ITEM_PUPPY, 53 | ITEM_LIFE_POT, 54 | ITEM_CUREALL, 55 | ITEM_CLINIC_KEY, 56 | ITEM_BOOSTER08, 57 | ITEM_ARMS_BARRIER, 58 | ITEM_TURBOCHARGE, 59 | ITEM_AIRTANK, 60 | ITEM_COUNTER, 61 | ITEM_BOOSTER20, 62 | ITEM_MIMIGA_MASK, 63 | ITEM_TELEPORTER_KEY, 64 | ITEM_SUES_LETTER, 65 | ITEM_CONTROLLER, 66 | ITEM_BROKEN_SPRINKLER, 67 | ITEM_SPRINKLER, 68 | ITEM_TOW_ROPE, 69 | ITEM_CLAY_FIGURE_MEDAL, 70 | ITEM_LITTLE_MAN, 71 | ITEM_MUSHROOM_BADGE, 72 | ITEM_MA_PIGNON, 73 | ITEM_CURLYS_UNDERWEAR, 74 | ITEM_ALIEN_MEDAL, 75 | ITEM_CHACOS_LIPSTICK, 76 | ITEM_WHIMSICAL_STAR, 77 | ITEM_IRON_BOND 78 | }; 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _NX_H 3 | #define _NX_H 4 | 5 | #include 6 | #include 7 | #include 8 | //#include 9 | //#include 10 | 11 | #include "config.h" 12 | #include "common/basics.h" 13 | #include "common/BList.h" 14 | #include "common/StringList.h" 15 | #include "common/DBuffer.h" 16 | #include "common/DString.h" 17 | #include "common/InitList.h" 18 | 19 | #include "graphics/graphics.h" 20 | #include "graphics/tileset.h" 21 | #include "graphics/sprites.h" 22 | typedef SIFPoint Point; 23 | using namespace Graphics; 24 | using Sprites::draw_sprite; 25 | using Sprites::draw_sprite_at_dp; 26 | using Sprites::draw_sprite_clipped; 27 | using Sprites::draw_sprite_clip_width; 28 | using Sprites::draw_sprite_chopped; 29 | using Sprites::draw_sprite_repeating_x; 30 | using Sprites::create_spritesheet; 31 | using Sprites::get_spritesheet; 32 | using Tileset::draw_tile; 33 | 34 | #define CSF 9 35 | class Object; 36 | 37 | // don't use this, use fileopen() instead. 38 | // some platforms are retarded and need special workarounds (read: WinCE) 39 | #pragma GCC poison fopen 40 | FILE *fileopen(const char *fname, const char *mode); 41 | 42 | #include "trig.h" 43 | #include "autogen/sprites.h" 44 | #include "dirnames.h" 45 | #include "TextBox/TextBox.h" 46 | #include "graphics/font.h" 47 | 48 | #include "input.h" 49 | #include "tsc.h" 50 | #include "stageboss.h" 51 | #include "ai/ai.h" 52 | #include "map.h" 53 | #include "statusbar.h" 54 | #include "floattext.h" 55 | #include "object.h" 56 | #include "ObjManager.h" 57 | #include "console.h" 58 | #include "debug.h" 59 | #include "game.h" 60 | #include "caret.h" 61 | #include "screeneffect.h" 62 | #include "settings.h" 63 | #include "slope.h" 64 | #include "player.h" 65 | #include "p_arms.h" 66 | #include "replay.h" 67 | #include "platform.h" 68 | 69 | #include "sound/sound.h" 70 | 71 | const char *strhex(int value); 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /nxce/remotescript: -------------------------------------------------------------------------------- 1 | send ../nxce.exe \nxce\nxce.exe 2 | exec \nxce\nxce.exe 3 | exit 4 | -------------------------------------------------------------------------------- /nxce/silayout: -------------------------------------------------------------------------------- 1 | 0 : VERSION 2 | 8 : RESERVED 3 | /home/katy/dev/nx/wince.ml 4 | 0 : active 5 | 185 : nlines 6 | 9 : scroll_y 7 | 0 : cursor_x 8 | 31 : cursor_y 9 | 0 : cursor_mode 10 | 0 : selection_present 11 | - 12 | /home/katy/dev/nx/main.cpp 13 | 1 : active 14 | 566 : nlines 15 | 37 : scroll_y 16 | 3 : cursor_x 17 | 46 : cursor_y 18 | 0 : cursor_mode 19 | 0 : selection_present 20 | - 21 | /home/katy/dev/nx/graphics/font.cpp 22 | 0 : active 23 | 574 : nlines 24 | 390 : scroll_y 25 | 30 : cursor_x 26 | 405 : cursor_y 27 | 0 : cursor_mode 28 | 0 : selection_present 29 | - 30 | /home/katy/dev/sdlshim/gapi.cpp 31 | 0 : 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 | /home/katy/dev/sdlshim/SDL/screen.cpp 40 | 0 : active 41 | 437 : nlines 42 | 42 : scroll_y 43 | 3 : cursor_x 44 | 67 : cursor_y 45 | 0 : cursor_mode 46 | 0 : selection_present 47 | - 48 | /home/katy/dev/sdlshim/asm.s 49 | 0 : active 50 | 163 : nlines 51 | 62 : scroll_y 52 | 2 : cursor_x 53 | 87 : cursor_y 54 | 0 : cursor_mode 55 | 0 : selection_present 56 | - 57 | /home/katy/dev/sdlshim/SDL/screen.h 58 | 0 : active 59 | 67 : nlines 60 | 37 : scroll_y 61 | 7 : cursor_x 62 | 60 : cursor_y 63 | 0 : cursor_mode 64 | 0 : selection_present 65 | - 66 | /home/katy/dev/nx/nxce/buildscript 67 | 0 : active 68 | 9 : nlines 69 | 0 : scroll_y 70 | 4 : cursor_x 71 | 7 : cursor_y 72 | 0 : cursor_mode 73 | 0 : selection_present 74 | - 75 | *END* 76 | -------------------------------------------------------------------------------- /object.fdh: -------------------------------------------------------------------------------- 1 | //hash:65781cc6 2 | //automatically generated by Makegen 3 | 4 | /* located in ObjManager.cpp */ 5 | 6 | //--------------------[referenced from object.cpp]-------------------// 7 | bool solidhitdetect(Object *o1, Object *o2); 8 | Object *CreateObject(int x, int y, int type); 9 | 10 | 11 | /* located in caret.cpp */ 12 | 13 | //--------------------[referenced from object.cpp]-------------------// 14 | Caret *effect(int x, int y, int effectno); 15 | 16 | 17 | /* located in slope.cpp */ 18 | 19 | //--------------------[referenced from object.cpp]-------------------// 20 | bool IsSlopeAtPointList(Object *o, SIFPointList *points); 21 | int CheckBoppedHeadOnSlope(Object *o); 22 | int CheckStandOnSlope(Object *o); 23 | bool movehandleslope(Object *o, int xinertia); 24 | 25 | 26 | /* located in player.cpp */ 27 | 28 | //--------------------[referenced from object.cpp]-------------------// 29 | void hurtplayer(int damage); 30 | 31 | 32 | /* located in tsc.cpp */ 33 | 34 | //--------------------[referenced from object.cpp]-------------------// 35 | ScriptInstance *StartScript(int scriptno, int pageno); 36 | int GetCurrentScript(void); 37 | 38 | 39 | /* located in debug.cpp */ 40 | 41 | //--------------------[referenced from object.cpp]-------------------// 42 | const char *DescribeObjectType(int type); 43 | 44 | 45 | /* located in ai/sym/smoke.cpp */ 46 | 47 | //--------------------[referenced from object.cpp]-------------------// 48 | void SmokeClouds(Object *o, int nclouds, int rangex, int rangey, Object *push_behind); 49 | 50 | 51 | /* located in sound/sound.cpp */ 52 | 53 | //--------------------[referenced from object.cpp]-------------------// 54 | void sound(int snd); 55 | 56 | 57 | /* located in common/stat.cpp */ 58 | 59 | //--------------------[referenced from object.cpp]-------------------// 60 | void staterr(const char *fmt, ...); 61 | void stat(const char *fmt, ...); 62 | 63 | 64 | /* located in common/misc.cpp */ 65 | 66 | //--------------------[referenced from object.cpp]-------------------// 67 | int random(int min, int max); 68 | 69 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /pause/dialog.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _DIALOG_H 3 | #define _DIALOG_H 4 | 5 | #include "../common/BList.h" 6 | #include "options.h" 7 | namespace Options { 8 | 9 | class ODItem; 10 | 11 | enum OD_TYPES 12 | { 13 | OD_CHOICE, 14 | OD_SEPARATOR, 15 | OD_DISMISS 16 | }; 17 | 18 | class Dialog : public FocusHolder 19 | { 20 | public: 21 | Dialog(); 22 | ~Dialog(); 23 | 24 | ODItem *AddItem(const char *text, \ 25 | void (*activate)(ODItem *, int)=NULL, \ 26 | void (*update)(ODItem *)=NULL, int id=-1, int type=OD_CHOICE); 27 | ODItem *AddSeparator(); 28 | ODItem *AddDismissalItem(const char *text = NULL); 29 | 30 | void Draw(); 31 | void RunInput(); 32 | void Dismiss(); 33 | void Clear(); 34 | void Refresh(); 35 | 36 | void SetSize(int w, int h); 37 | void offset(int xd, int yd); 38 | ODItem *ItemAt(int index) { return (ODItem *)fItems.ItemAt(index); } 39 | 40 | void SetSelection(int sel); 41 | int GetSelection() { return fCurSel; } 42 | void ShowFull() { fNumShown = 99; } 43 | 44 | void (*onclear)(); 45 | void (*ondismiss)(); 46 | 47 | private: 48 | void DrawItem(int x, int y, ODItem *item); 49 | 50 | int fCurSel; 51 | int fNumShown; // for text-draw animation on entry 52 | int fRepeatTimer; 53 | BList fItems; 54 | 55 | struct { int x, y, w, h; } fCoords; 56 | int fTextX; 57 | bool fDismissOnFocus; 58 | }; 59 | 60 | 61 | struct ODItem 62 | { 63 | char text[100]; 64 | char suffix[32]; 65 | char righttext[64]; 66 | char raligntext[32]; 67 | int type, id; 68 | 69 | void (*update)(ODItem *item); 70 | void (*activate)(ODItem *item, int dir); 71 | }; 72 | 73 | } 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /pause/message.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "../nx.h" 3 | #include "message.h" 4 | #include "message.fdh" 5 | using namespace Options; 6 | extern FocusStack optionstack; 7 | extern int last_sdl_key; // from inputs.cpp 8 | 9 | #define MESSAGE_X ((SCREEN_WIDTH / 2) - 112) 10 | #define MESSAGE_Y ((SCREEN_HEIGHT / 2) - 30) 11 | #define MESSAGE_W 244 12 | #define MESSAGE_H 48 13 | 14 | Message::Message(const char *msg, const char *msg2) 15 | { 16 | rawKeyReturn = NULL; 17 | on_dismiss = NULL; 18 | last_sdl_key = -1; 19 | 20 | fMsg = strdup(msg); 21 | fMsg2 = strdup(msg2 ? msg2 : ""); 22 | 23 | fMsgX = MESSAGE_X + ((MESSAGE_W / 2) - (GetFontWidth(fMsg, 0) / 2)); 24 | 25 | if (fMsg2[0]) 26 | { 27 | fMsgY = MESSAGE_Y + 10; 28 | fMsg2X = MESSAGE_X + ((MESSAGE_W / 2) - (GetFontWidth(fMsg2, 0) / 2)); 29 | fMsg2Y = fMsgY + GetFontHeight() + 4; 30 | fShowDelay = 0; 31 | } 32 | else 33 | { 34 | fMsgY = (MESSAGE_Y + ((MESSAGE_H / 2) - (GetFontHeight() / 2))) - 1; 35 | fShowDelay = 4; 36 | } 37 | 38 | optionstack.AddItem(this); 39 | } 40 | 41 | Message::~Message() 42 | { 43 | optionstack.RemoveItem(this); 44 | free(fMsg); 45 | free(fMsg2); 46 | } 47 | 48 | /* 49 | void c------------------------------() {} 50 | */ 51 | 52 | void Message::Draw() 53 | { 54 | TextBox::DrawFrame(MESSAGE_X, MESSAGE_Y, MESSAGE_W, MESSAGE_H); 55 | 56 | if (fShowDelay > 0) 57 | { 58 | fShowDelay--; 59 | return; 60 | } 61 | 62 | font_draw(fMsgX, fMsgY, fMsg, 0); 63 | 64 | if (fMsg2[0]) 65 | font_draw(fMsg2X, fMsg2Y, fMsg2, 0); 66 | } 67 | 68 | 69 | void Message::RunInput() 70 | { 71 | if (last_sdl_key != -1) 72 | { 73 | if (rawKeyReturn) *rawKeyReturn = last_sdl_key; 74 | if (on_dismiss) (*on_dismiss)(this); 75 | 76 | delete this; 77 | } 78 | } 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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(0, 0, 0); 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /profile.fdh: -------------------------------------------------------------------------------- 1 | //hash:efab372e 2 | //automatically generated by Makegen 3 | 4 | /* located in profile.cpp */ 5 | 6 | //--------------------[referenced from profile.cpp]------------------// 7 | bool profile_load(const char *pfname, Profile *file); 8 | bool profile_save(const char *pfname, Profile *file); 9 | const char *GetProfileName(int num); 10 | bool ProfileExists(int num); 11 | bool AnyProfileExists(); 12 | 13 | 14 | /* located in platform.cpp */ 15 | 16 | //--------------------[referenced from profile.cpp]------------------// 17 | FILE *fileopen(const char *fname, const char *mode); 18 | 19 | 20 | /* located in tsc.cpp */ 21 | 22 | //--------------------[referenced from profile.cpp]------------------// 23 | int CVTDir(int csdir); 24 | 25 | 26 | /* located in common/stat.cpp */ 27 | 28 | //--------------------[referenced from profile.cpp]------------------// 29 | void stat(const char *fmt, ...); 30 | void staterr(const char *fmt, ...); 31 | 32 | 33 | /* located in common/misc.cpp */ 34 | 35 | //--------------------[referenced from profile.cpp]------------------// 36 | bool fverifystring(FILE *fp, const char *str); 37 | uint32_t fgetl(FILE *fp); 38 | uint16_t fgeti(FILE *fp); 39 | void fresetboolean(void); 40 | char fbooleanread(FILE *fp); 41 | void fputstringnonull(const char *buf, FILE *fp); 42 | void fputl(uint32_t word, FILE *fp); 43 | void fputi(uint16_t word, FILE *fp); 44 | void fbooleanwrite(char bit, FILE *fp); 45 | void fbooleanflush(FILE *fp); 46 | char *stprintf(const char *fmt, ...); 47 | bool file_exists(const char *fname); 48 | 49 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /screeneffect.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SCREENEFFECT_H 3 | #define _SCREENEFFECT_H 4 | 5 | 6 | // screeneffects are a simple draw overlay used w/ things such as flashes and such. 7 | class ScreenEffect 8 | { 9 | public: 10 | ScreenEffect() { enabled = false; } 11 | virtual ~ScreenEffect() { } 12 | virtual void Draw() = 0; 13 | 14 | bool enabled; 15 | 16 | protected: 17 | int state; 18 | int timer; 19 | }; 20 | 21 | 22 | // FlashScreen simply flashes the screen white several times, 23 | // and is used in various places such as when Misery casts spells. 24 | struct SE_FlashScreen : public ScreenEffect 25 | { 26 | void Start(); 27 | void Draw(); 28 | 29 | int flashes_left; 30 | bool flashstate; 31 | }; 32 | 33 | 34 | // Starflash is a full-screen white explosion in the shape of a '+', 35 | // used when some bosses are defeated. 36 | struct SE_Starflash : public ScreenEffect 37 | { 38 | void Start(int x, int y); 39 | void Draw(); 40 | 41 | int centerx, centery; 42 | int size, speed; 43 | }; 44 | 45 | 46 | // Fade is the fade-in/out used on every stage transistion/TRA. 47 | struct SE_Fade : public ScreenEffect 48 | { 49 | SE_Fade(); 50 | 51 | void Start(int fadedir, int dir, int spr=SPR_FADE_DIAMOND); 52 | void Draw(void); 53 | void set_full(int dir); 54 | int getstate(void); 55 | 56 | struct 57 | { 58 | int fadedir; 59 | int sweepdir; 60 | int curframe; 61 | int sprite; 62 | } fade; 63 | }; 64 | 65 | #define FADE_IN 0 66 | #define FADE_OUT 1 67 | 68 | // these directions correspond to the FAI/FAO parameters. 69 | #define FADE_LEFT 0 70 | #define FADE_UP 1 71 | #define FADE_RIGHT 2 72 | #define FADE_DOWN 3 73 | #define FADE_CENTER 4 74 | 75 | #define FS_NO_FADE 0 // no fade is active 76 | #define FS_FADING 1 // currently fading in or out 77 | #define FS_FADED_OUT 2 // completely faded out 78 | 79 | 80 | namespace ScreenEffects 81 | { 82 | void Draw(void); 83 | void Stop(); 84 | }; 85 | 86 | 87 | extern SE_FlashScreen flashscreen; 88 | extern SE_Starflash starflash; 89 | extern SE_Fade fade; 90 | 91 | #endif 92 | 93 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /siflib/sif.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /siflib/sifupgrade.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gameblabla/nxengine-nspire/711c889b637ef86bfd5a84ed4d89bfe55b0a5286/siflib/sifupgrade.cpp -------------------------------------------------------------------------------- /silayout: -------------------------------------------------------------------------------- 1 | 0 : VERSION 2 | 9 : RESERVED 3 | makelist.ml 4 | 0 : active 5 | 166 : nlines 6 | 0 : scroll_y 7 | 49 : cursor_x 8 | 4 : cursor_y 9 | 0 : cursor_mode 10 | 0 : selection_present 11 | - 12 | main.cpp 13 | 0 : active 14 | 611 : nlines 15 | 26 : scroll_y 16 | 2 : cursor_x 17 | 51 : cursor_y 18 | 0 : cursor_mode 19 | 0 : selection_present 20 | - 21 | config.h 22 | 0 : active 23 | 20 : nlines 24 | 0 : scroll_y 25 | 0 : cursor_x 26 | 13 : cursor_y 27 | 0 : cursor_mode 28 | 0 : selection_present 29 | - 30 | settings.h 31 | 0 : active 32 | 41 : nlines 33 | 0 : scroll_y 34 | 0 : cursor_x 35 | 6 : cursor_y 36 | 0 : cursor_mode 37 | 0 : selection_present 38 | - 39 | settings.cpp 40 | 0 : active 41 | 122 : nlines 42 | 6 : scroll_y 43 | 34 : cursor_x 44 | 39 : cursor_y 45 | 0 : cursor_mode 46 | 0 : selection_present 47 | - 48 | extract/extract.cpp 49 | 1 : active 50 | 293 : nlines 51 | 88 : scroll_y 52 | 48 : cursor_x 53 | 110 : cursor_y 54 | 0 : cursor_mode 55 | 0 : selection_present 56 | - 57 | extract/extractstages.cpp 58 | 0 : active 59 | 130 : nlines 60 | 80 : scroll_y 61 | 15 : cursor_x 62 | 100 : cursor_y 63 | 0 : cursor_mode 64 | 1 : selection_present 65 | 2 : selection_x1 66 | 100 : selection_y1 67 | 14 : selection_x2 68 | 100 : selection_y2 69 | - 70 | extract/extractfiles.cpp 71 | 0 : active 72 | 249 : nlines 73 | 131 : scroll_y 74 | 31 : cursor_x 75 | 151 : cursor_y 76 | 0 : cursor_mode 77 | 0 : selection_present 78 | - 79 | graphics/safemode.cpp 80 | 0 : active 81 | 167 : nlines 82 | 99 : scroll_y 83 | 40 : cursor_x 84 | 126 : cursor_y 85 | 0 : cursor_mode 86 | 0 : selection_present 87 | - 88 | *END* 89 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /smalfont.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gameblabla/nxengine-nspire/711c889b637ef86bfd5a84ed4d89bfe55b0a5286/smalfont.bmp -------------------------------------------------------------------------------- /sound/pxt.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _PXT_H 3 | #define _PXT_H 4 | 5 | #include "../common/basics.h" 6 | 7 | #define PXT_NO_CHANNELS 4 8 | 9 | enum 10 | { 11 | MOD_SINE, 12 | MOD_TRI, 13 | MOD_SAWUP, 14 | MOD_SAWDOWN, 15 | MOD_SQUARE, 16 | MOD_NOISE, 17 | MOD_WHITE, 18 | MOD_PULSE, 19 | 20 | PXT_NO_MODELS 21 | }; 22 | 23 | typedef struct 24 | { 25 | signed char *model; // ptr to model data 26 | uchar model_no; // index of model data (0-5, which wave[] model points to) 27 | 28 | double phaseacc; 29 | double phaseinc; 30 | double repeat; // pixtone calls it "freq" 31 | uchar volume; // pixtone calls it "top" 32 | uchar offset; 33 | 34 | int white_ptr; // like "phaseacc" but for MOD_WHITE (the odd one out) 35 | } stPXWave; 36 | 37 | #define PXENV_NUM_VERTICES 3 38 | typedef struct 39 | { 40 | int initial; 41 | 42 | int time[PXENV_NUM_VERTICES]; 43 | int val[PXENV_NUM_VERTICES]; 44 | } stPXEnvelope; 45 | 46 | typedef struct 47 | { 48 | int size_blocks; 49 | char enabled; 50 | 51 | stPXWave main; 52 | stPXWave pitch; 53 | stPXWave pitch2; 54 | stPXWave volume; 55 | stPXEnvelope envelope; 56 | 57 | unsigned char envbuffer[256]; 58 | signed char *buffer; 59 | } stPXChannel; 60 | 61 | typedef struct 62 | { 63 | stPXChannel chan[PXT_NO_CHANNELS]; 64 | 65 | signed char *final_buffer; 66 | int final_size; 67 | } stPXSound; 68 | 69 | #endif 70 | 71 | -------------------------------------------------------------------------------- /sound/sound.fdh: -------------------------------------------------------------------------------- 1 | //hash:7c81ee46 2 | //automatically generated by Makegen 3 | 4 | /* located in sound/sound.cpp */ 5 | 6 | //------------------[referenced from sound/sound.cpp]----------------// 7 | bool sound_init(void); 8 | void sound_close(void); 9 | void sound(int snd); 10 | void sound_loop(int snd); 11 | void sound_stop(int snd); 12 | bool sound_is_playing(int snd); 13 | void StartStreamSound(int freq); 14 | void StartPropSound(void); 15 | void StopLoopSounds(void); 16 | void music(int songno); 17 | bool should_music_play(int songno, int musicmode); 18 | bool music_is_boss(int songno); 19 | void music_set_enabled(int newstate); 20 | static void start_track(int songno); 21 | int music_cursong(); 22 | int music_lastsong(); 23 | 24 | 25 | /* located in sound/sslib.cpp */ 26 | 27 | //------------------[referenced from sound/sound.cpp]----------------// 28 | char SSInit(void); 29 | void SSClose(void); 30 | 31 | 32 | /* located in sound/org.cpp */ 33 | 34 | //------------------[referenced from sound/sound.cpp]----------------// 35 | int org_init(const char *wavetable_fname, const char *drum_pxt_dir, int org_volume); 36 | void org_stop(void); 37 | bool org_is_playing(void); 38 | char org_load(char *fname); 39 | bool org_start(int startbeat); 40 | 41 | 42 | /* located in sound/pxt.cpp */ 43 | 44 | //------------------[referenced from sound/sound.cpp]----------------// 45 | char pxt_init(void); 46 | char pxt_LoadSoundFX(const char *path, const char *cache_name, int top); 47 | void pxt_freeSoundFX(void); 48 | void pxt_Stop(int slot); 49 | int pxt_Play(int chan, int slot, char loop); 50 | char pxt_IsPlaying(int slot); 51 | 52 | 53 | /* located in common/stat.cpp */ 54 | 55 | //------------------[referenced from sound/sound.cpp]----------------// 56 | void staterr(const char *fmt, ...); 57 | void stat(const char *fmt, ...); 58 | 59 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /sprites.sif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gameblabla/nxengine-nspire/711c889b637ef86bfd5a84ed4d89bfe55b0a5286/sprites.sif -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /stageboss.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _STAGEBOSS_H 3 | #define _STAGEBOSS_H 4 | 5 | // Stage Bosses are "big" boss enemies used in some stages. 6 | // 7 | // The stage boss class runs at a conceptual level "above" 8 | // normal AI routines, more like at the level of the game loop. 9 | // 10 | // This gives these complex bosses a good way to control more 11 | // things than just a single object (some bosses for example have 12 | // multiple parts which need to be coordinated, such as Omega). 13 | // 14 | // A pointer to the "main" object of a stage boss is stored by 15 | // the derived class at game.stageboss.object. 16 | // 17 | // The script command 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 | -------------------------------------------------------------------------------- /stagedata.fdh: -------------------------------------------------------------------------------- 1 | //hash:00000000 2 | //automatically generated by Makegen 3 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /tilekey.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gameblabla/nxengine-nspire/711c889b637ef86bfd5a84ed4d89bfe55b0a5286/tilekey.dat -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /tools/SoundList.vbw: -------------------------------------------------------------------------------- 1 | frmSoundList = 88, 100, 900, 577, Z, 66, 75, 878, 552, C 2 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /tools/TileKey.vbw: -------------------------------------------------------------------------------- 1 | frmTileKey = 44, 50, 856, 527, Z, 22, 25, 834, 502, C 2 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /tools/frmTileKey.frx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gameblabla/nxengine-nspire/711c889b637ef86bfd5a84ed4d89bfe55b0a5286/tools/frmTileKey.frx -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /trig.h: -------------------------------------------------------------------------------- 1 | 2 | extern signed int sin_table[256]; 3 | -------------------------------------------------------------------------------- /tsc_cmdtbl.cpp: -------------------------------------------------------------------------------- 1 | // #included by tsc.cpp 2 | const TSCCommandTable cmd_table[] = 3 | { 4 | "AE+", 0, 5 | "AM+", 2, 6 | "AM-", 1, 7 | "AMJ", 2, 8 | "ANP", 3, 9 | "BOA", 1, 10 | "BSL", 1, 11 | "CAT", 0, 12 | "CIL", 0, 13 | "CLO", 0, 14 | "CLR", 0, 15 | "CMP", 3, 16 | "CMU", 1, 17 | "CNP", 3, 18 | "CPS", 0, 19 | "CRE", 0, 20 | "CSS", 0, 21 | "DNA", 1, 22 | "DNP", 1, 23 | "ECJ", 2, 24 | "END", 0, 25 | "EQ+", 1, 26 | "EQ-", 1, 27 | "ESC", 0, 28 | "EVE", 1, 29 | "FAC", 1, 30 | "FAI", 1, 31 | "FAO", 1, 32 | "FL+", 1, 33 | "FL-", 1, 34 | "FLA", 0, 35 | "FLJ", 2, 36 | "FMU", 0, 37 | "FOB", 2, 38 | "FOM", 1, 39 | "FON", 2, 40 | "FRE", 0, 41 | "GIT", 1, 42 | "HMC", 0, 43 | "INI", 0, 44 | "INP", 3, 45 | "IT+", 1, 46 | "IT-", 1, 47 | "ITJ", 2, 48 | "KEY", 0, 49 | "LDP", 0, 50 | "LI+", 1, 51 | "ML+", 1, 52 | "MLP", 0, 53 | "MM0", 0, 54 | "MNA", 0, 55 | "MNP", 4, 56 | "MOV", 2, 57 | "MP+", 1, 58 | "MPJ", 1, 59 | "MS2", 0, 60 | "MS3", 0, 61 | "MSG", 0, 62 | "MYB", 1, 63 | "MYD", 1, 64 | "NCJ", 2, 65 | "NOD", 0, 66 | "NUM", 1, 67 | "PRI", 0, 68 | "PS+", 2, 69 | "QUA", 1, 70 | "RMU", 0, 71 | "SAT", 0, 72 | "SIL", 1, 73 | "SK+", 1, 74 | "SK-", 1, 75 | "SKJ", 2, 76 | "SLP", 0, 77 | "SMC", 0, 78 | "SMP", 2, 79 | "SNP", 4, 80 | "SOU", 1, 81 | "SPS", 0, 82 | "SSS", 1, 83 | "STC", 0, 84 | "SVP", 0, 85 | "TAM", 3, 86 | "TRA", 4, 87 | "TUR", 0, 88 | "UNI", 1, 89 | "UNJ", 1, 90 | "WAI", 1, 91 | "WAS", 0, 92 | "XX1", 1, 93 | "YNJ", 1, 94 | "ZAM", 0, 95 | }; 96 | -------------------------------------------------------------------------------- /vararray.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _VARARRAY_H 3 | #define _VARARRAY_H 4 | 5 | #include 6 | 7 | template 8 | class VarArray 9 | { 10 | public: 11 | VarArray() 12 | { 13 | nitems = 0; 14 | items = NULL; 15 | } 16 | 17 | ~VarArray() 18 | { 19 | if (items) 20 | free(items); 21 | } 22 | 23 | // retrieves the item at index. if index is outside 24 | // the bounds of the array, returns 0/null. 25 | T get(int index) 26 | { 27 | if (index < 0 || index >= nitems) 28 | return (T)0; 29 | 30 | return items[index]; 31 | } 32 | 33 | // put an item into the array at index. 34 | // if index is past the end of the array, the array is expanded. 35 | void put(int index, T value) 36 | { 37 | if (index >= 0) 38 | { 39 | EnsureAlloc(index + 1); 40 | items[index] = value; 41 | } 42 | } 43 | 44 | // make sure the array is big enough to contain up to allocnum items. 45 | // any unused items are initilized to 0/null. 46 | void EnsureAlloc(int allocnum) 47 | { 48 | if (allocnum > nitems) 49 | { 50 | if (items == NULL) 51 | items = (T *)malloc(sizeof(T) * allocnum); 52 | else 53 | items = (T *)realloc(items, (sizeof(T) * allocnum)); 54 | 55 | memset(&items[nitems], 0, ((allocnum - nitems) * sizeof(T))); 56 | nitems = allocnum; 57 | } 58 | } 59 | 60 | // convenience function to access it like an array. 61 | // however unlike put(), you cannot use it to expand the array-- 62 | // if you try to use it to write outside the bounds of the array, 63 | // the value will simply be lost. 64 | T& operator[] (const int index) 65 | { 66 | if (index < 0 || index >= nitems) 67 | { 68 | static T ZERO_T; 69 | memset(&ZERO_T, 0, sizeof(T)); 70 | return ZERO_T; 71 | } 72 | 73 | return items[index]; 74 | } 75 | 76 | // set the size of the array to 0 items. 77 | void MakeEmpty() 78 | { 79 | if (items) 80 | { 81 | free(items); 82 | items = NULL; 83 | } 84 | 85 | nitems = 0; 86 | } 87 | 88 | int nitems; 89 | 90 | private: 91 | T *items; 92 | }; 93 | 94 | 95 | 96 | 97 | #endif 98 | 99 | --------------------------------------------------------------------------------