--- /dev/null
+/* Keen Dreams Source Code\r
+ * Copyright (C) 2014 Javier M. Chavez\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License along\r
+ * with this program; if not, write to the Free Software Foundation, Inc.,\r
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+ */\r
+\r
+// KD_DEF.H\r
+\r
+#include "ID_HEADS.H"\r
+#include <BIOS.H>\r
+#include "SOFT.H"\r
+#include "SL_FILE.H"\r
+\r
+#define FRILLS 0 // Cut out frills for 360K - MIKE MAYNARD\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+ GLOBAL CONSTANTS\r
+\r
+=============================================================================\r
+*/\r
+\r
+#define CREDITS 0\r
+\r
+#define MAXACTORS MAXSPRITES\r
+\r
+#define ACCGRAVITY 3\r
+#define SPDMAXY 80\r
+\r
+#define BLOCKSIZE (8*PIXGLOBAL) // for positioning starting actors\r
+\r
+//\r
+// movement scrolling edges\r
+//\r
+#define SCROLLEAST (TILEGLOBAL*11)\r
+#define SCROLLWEST (TILEGLOBAL*9)\r
+#define SCROLLSOUTH (TILEGLOBAL*8)\r
+#define SCROLLNORTH (TILEGLOBAL*4)\r
+\r
+#define CLIPMOVE 24 // speed to push out of a solid wall\r
+\r
+#define GAMELEVELS 17\r
+\r
+/*\r
+=============================================================================\r
+\r
+ TYPES\r
+\r
+=============================================================================\r
+*/\r
+\r
+typedef enum {notdone,resetgame,levelcomplete,warptolevel,died,victorious}\r
+ exittype;\r
+\r
+typedef enum {nothing,keenobj,powerobj,doorobj,\r
+ bonusobj,broccoobj,tomatobj,carrotobj,celeryobj,asparobj,grapeobj,\r
+ taterobj,cartobj,frenchyobj,melonobj,turnipobj,cauliobj,brusselobj,\r
+ mushroomobj,squashobj,apelobj,peapodobj,peabrainobj,boobusobj,\r
+ shotobj,inertobj} classtype;\r
+\r
+typedef struct\r
+{\r
+ int leftshapenum,rightshapenum;\r
+ enum {step,slide,think,stepthink,slidethink} progress;\r
+ boolean skippable;\r
+\r
+ boolean pushtofloor;\r
+ int tictime;\r
+ int xmove;\r
+ int ymove;\r
+ void (*think) ();\r
+ void (*contact) ();\r
+ void (*react) ();\r
+ void *nextstate;\r
+} statetype;\r
+\r
+\r
+typedef struct\r
+{\r
+ unsigned worldx,worldy;\r
+ boolean leveldone[GAMELEVELS];\r
+ long score,nextextra;\r
+ int flowerpowers;\r
+ int boobusbombs,bombsthislevel;\r
+ int keys;\r
+ int mapon;\r
+ int lives;\r
+ int difficulty;\r
+} gametype;\r
+\r
+\r
+typedef struct objstruct\r
+{\r
+ classtype obclass;\r
+ enum {no,yes,allways,removable} active;\r
+ boolean needtoreact,needtoclip;\r
+ unsigned nothink;\r
+ unsigned x,y;\r
+\r
+ int xdir,ydir;\r
+ int xmove,ymove;\r
+ int xspeed,yspeed;\r
+\r
+ int ticcount,ticadjust;\r
+ statetype *state;\r
+\r
+ unsigned shapenum;\r
+\r
+ unsigned left,top,right,bottom; // hit rectangle\r
+ unsigned midx;\r
+ unsigned tileleft,tiletop,tileright,tilebottom; // hit rect in tiles\r
+ unsigned tilemidx;\r
+\r
+ int hitnorth,hiteast,hitsouth,hitwest; // wall numbers contacted\r
+\r
+ int temp1,temp2,temp3,temp4;\r
+\r
+ void *sprite;\r
+\r
+ struct objstruct *next,*prev;\r
+} objtype;\r
+\r
+\r
+struct BitMapHeader {\r
+ unsigned int w,h,x,y;\r
+ unsigned char d,trans,comp,pad;\r
+};\r
+\r
+struct BitMap {\r
+ unsigned int Width;\r
+ unsigned int Height;\r
+ unsigned int Depth;\r
+ unsigned int BytesPerRow;\r
+ char far *Planes[8];\r
+};\r
+\r
+struct Shape {\r
+ memptr Data;\r
+ long size;\r
+ unsigned int BPR;\r
+ struct BitMapHeader bmHdr;\r
+};\r
+\r
+typedef struct {\r
+ int handle; // handle of file\r
+ memptr buffer; // pointer to buffer\r
+ word offset; // offset into buffer\r
+ word status; // read/write status\r
+} BufferedIO;\r
+\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+ KD_MAIN.C DEFINITIONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+extern char str[80],str2[20];\r
+extern boolean singlestep,jumpcheat,godmode,tedlevel;\r
+extern unsigned tedlevelnum;\r
+\r
+void DebugMemory (void);\r
+void TestSprites(void);\r
+int DebugKeys (void);\r
+void StartupId (void);\r
+void ShutdownId (void);\r
+void Quit (char *error);\r
+void InitGame (void);\r
+void main (void);\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+ KD_DEMO.C DEFINITIONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+void Finale (void);\r
+void GameOver (void);\r
+void DemoLoop (void);\r
+void StatusWindow (void);\r
+void NewGame (void);\r
+void TEDDeath (void);\r
+\r
+boolean LoadGame (int file);\r
+boolean SaveGame (int file);\r
+void ResetGame (void);\r
+\r
+/*\r
+=============================================================================\r
+\r
+ KD_PLAY.C DEFINITIONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+extern gametype gamestate;\r
+extern exittype playstate;\r
+extern boolean button0held,button1held;\r
+extern unsigned originxtilemax,originytilemax;\r
+extern objtype *new,*check,*player,*scoreobj;\r
+\r
+extern ControlInfo c;\r
+\r
+extern objtype dummyobj;\r
+\r
+extern char *levelnames[21];\r
+\r
+void CheckKeys (void);\r
+void CalcInactivate (void);\r
+void InitObjArray (void);\r
+void GetNewObj (boolean usedummy);\r
+void RemoveObj (objtype *gone);\r
+void ScanInfoPlane (void);\r
+void PatchWorldMap (void);\r
+void MarkTileGraphics (void);\r
+void FadeAndUnhook (void);\r
+void SetupGameLevel (boolean loadnow);\r
+void ScrollScreen (void);\r
+void MoveObjVert (objtype *ob, int ymove);\r
+void MoveObjHoriz (objtype *ob, int xmove);\r
+void GivePoints (unsigned points);\r
+void ClipToEnds (objtype *ob);\r
+void ClipToEastWalls (objtype *ob);\r
+void ClipToWestWalls (objtype *ob);\r
+void ClipToWalls (objtype *ob);\r
+void ClipToSprite (objtype *push, objtype *solid, boolean squish);\r
+void ClipToSpriteSide (objtype *push, objtype *solid);\r
+int DoActor (objtype *ob,int tics);\r
+void StateMachine (objtype *ob);\r
+void NewState (objtype *ob,statetype *state);\r
+void PlayLoop (void);\r
+void GameLoop (void);\r
+\r
+/*\r
+=============================================================================\r
+\r
+ KD_KEEN.C DEFINITIONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+void CalcSingleGravity (void);\r
+\r
+void ProjectileThink (objtype *ob);\r
+void VelocityThink (objtype *ob);\r
+void DrawReact (objtype *ob);\r
+\r
+void SpawnScore (void);\r
+void FixScoreBox (void);\r
+void SpawnWorldKeen (int tilex, int tiley);\r
+void SpawnKeen (int tilex, int tiley, int dir);\r
+\r
+void KillKeen (void);\r
+\r
+extern int singlegravity;\r
+extern unsigned bounceangle[8][8];\r
+\r
+extern statetype s_keendie1;\r
+\r
+/*\r
+=============================================================================\r
+\r
+ KD_ACT1.C DEFINITIONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+void WalkReact (objtype *ob);\r
+\r
+void DoGravity (objtype *ob);\r
+void AccelerateX (objtype *ob,int dir,int max);\r
+void FrictionX (objtype *ob);\r
+\r
+void ProjectileThink (objtype *ob);\r
+void VelocityThink (objtype *ob);\r
+void DrawReact (objtype *ob);\r
+void DrawReact2 (objtype *ob);\r
+void DrawReact3 (objtype *ob);\r
+void ChangeState (objtype *ob, statetype *state);\r
+\r
+void ChangeToFlower (objtype *ob);\r
+\r
+void SpawnBonus (int tilex, int tiley, int type);\r
+void SpawnDoor (int tilex, int tiley);\r
+void SpawnBrocco (int tilex, int tiley);\r
+void SpawnTomat (int tilex, int tiley);\r
+void SpawnCarrot (int tilex, int tiley);\r
+void SpawnAspar (int tilex, int tiley);\r
+void SpawnGrape (int tilex, int tiley);\r
+\r
+extern statetype s_doorraise;\r
+\r
+extern statetype s_bonus;\r
+extern statetype s_bonusrise;\r
+\r
+extern statetype s_broccosmash3;\r
+extern statetype s_broccosmash4;\r
+\r
+extern statetype s_grapefall;\r
+\r
+/*\r
+=============================================================================\r
+\r
+ KD_ACT2.C DEFINITIONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+void SpawnTater (int tilex, int tiley);\r
+void SpawnCart (int tilex, int tiley);\r
+void SpawnFrenchy (int tilex, int tiley);\r
+void SpawnMelon (int tilex, int tiley,int dir);\r
+void SpawnSquasher (int tilex, int tiley);\r
+void SpawnApel (int tilex, int tiley);\r
+void SpawnPeaPod (int tilex, int tiley);\r
+void SpawnPeaBrain (int tilex, int tiley);\r
+void SpawnBoobus (int tilex, int tiley);\r
+\r
+extern statetype s_taterattack2;\r
+extern statetype s_squasherjump2;\r
+extern statetype s_boobusdie;\r
+\r
+extern statetype s_deathwait1;\r
+extern statetype s_deathwait2;\r
+extern statetype s_deathwait3;\r
+extern statetype s_deathboom1;\r
+extern statetype s_deathboom2;\r
+\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// GELIB.C DEFINITIONS\r
+//\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+void FreeShape(struct Shape *shape);\r
+int UnpackEGAShapeToScreen(struct Shape *SHP,int startx,int starty);\r
+\r
+long Verify(char *filename);\r
+memptr InitBufferedIO(int handle, BufferedIO *bio);\r
+void FreeBufferedIO(BufferedIO *bio);\r
+byte bio_readch(BufferedIO *bio);\r
+void bio_fillbuffer(BufferedIO *bio);\r
+void SwapLong(long far *Var);\r
+void SwapWord(unsigned int far *Var);\r
+void MoveGfxDst(short x, short y);
\ No newline at end of file