#include "src/lib/16_timer.h"
#include "src/lib/wcpu/wcpu.h"
#include "src/lib/16_sprite.h"
-#include "src/lib/16_head.h"
+#include "src/lib/16_ca.h"
+#include "src/lib/16_mm.h"
+//#include "src/lib/16_head.h"//included already
//#define FADE
#define MODEX //this is for mode x initiating
static map_t map;
player_t player[MaxPlayers];
map_view_t mv[4];
-static unsigned char palette[768];
-int fd;
+byte *ppal;
//word pn=0; //i forgot ww
-//static planar_buf_t huge *pp;
float t;
sword bakapee;
pan_t pan;
word pg;
//#ifdef FADE
static word paloffset=0;
- byte *dpal, *default_pal;
+ byte *dpal;
//#endif
byte *gpal;
byte *ptr;
void main(int argc, char *argv[])
{
- mminfo_t mm; mminfotype mmi;
struct sprite sp;
-
+ __segment sega;
+ void __based(sega)* bigbuffer;
+
byte *mesg=malloc(sizeof(dword));
int i;
if(argv[1]) bakapee = atoi(argv[1]);
else bakapee = 1;
-/* mm.mmstarted = 0;
+ gvar.mm.mmstarted=0;
+ gvar.bigbuffer=bigbuffer;
- MM_Startup(&mm, &mmi);
- CA_Startup(&gvar);*/
+ MM_Startup(&gvar.mm, &gvar.mmi);
+ CA_Startup(&gvar);
// DOSLIB: check our environment
probe_dos();
}*/
player[0].spri = &sp;
- fd = open("data/spri/chikyuu.pal",O_RDONLY|O_BINARY);
- if (fd >= 0) {
- unsigned int i;
-
- read(fd,palette,768);
- close(fd);
-
- vga_palette_lseek(0);
- for (i=0;i < 256;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2);
- }
-
#endif
/* input! */
IN_Startup();
#ifdef MODEX
#ifdef FADE
dpal = modexNewPal();
- default_pal = modexNewPal();
- *default_pal = *dpal;
modexPalSave(dpal);
modexFadeOff(4, dpal);
#endif
modexPalBlack(); //reset the palette~
#endif
#endif
- modexPalUpdate1(palette);
+ modexLoadPalFile("data/spri/chikyuu.pal", &ppal);
+ modexPalUpdate1(ppal);
#ifdef MODEX
#ifdef FADE
gpal = modexNewPal();
#ifdef FADE
if(IN_KeyDown(24)){ modexPalUpdate0(gpal); paloffset=0; modexpdump(mv[0].page); modexpdump(mv[1].page); IN_UserInput(1,1); }
if(IN_KeyDown(22)){
- paloffset=0; modexPalBlack(); modexPalUpdate(player[0].data, &paloffset, 0, 0);
- printf("1paloffset = %d\n", paloffset/3);
- modexPalUpdate(map.tiles->data, &paloffset, 0, 0);
- printf("2paloffset = %d\n", paloffset/3);
- modexpdump(mv[0].page); modexpdump(mv[1].page);
+// paloffset=0; modexPalBlack(); modexPalUpdate(player[0].data, &paloffset, 0, 0);
+// printf("1paloffset = %d\n", paloffset/3);
+// modexPalUpdate(map.tiles->data, &paloffset, 0, 0);
+// printf("2paloffset = %d\n", paloffset/3);
+// modexpdump(mv[0].page); modexpdump(mv[1].page);
IN_UserInput(1,1);
}
#endif
}*/
//9
- if(IN_KeyDown(10)){ modexPalOverscan(rand()%56); modexPalUpdate1(default_pal); IN_UserInput(1,1); }
+ if(IN_KeyDown(10)){ modexPalOverscan(rand()%56); modexPalUpdate1(dpal); IN_UserInput(1,1); }
//if(IN_KeyDown(11)){ modexPalOverscan(15); }
if((player[0].q==1) && !(player[0].x%TILEWH==0 && player[0].y%TILEWH==0)) break; //incase things go out of sync!
}
VGAmodeX(0, 1, &gvar);
#endif
IN_Shutdown();
+ MM_FreePtr(&bigbuffer, &gvar.mm);
+ CA_Shutdown(&gvar);
+ MM_Shutdown(&gvar.mm);
printf("\nProject 16 scroll.exe. This is just a test file!\n");
printf("version %s\n", VERSION);
printf("tx: %d ", mv[0].tx);
void\r
main(int argc, char *argv[])\r
{\r
- mminfo_t mm; mminfotype mmi;\r
#ifdef __WATCOMC__\r
__segment sega;\r
void __based(sega)* bigbuffer;\r
#ifdef FILERL\r
bakapee = malloc(64);\r
#endif\r
- mm.mmstarted=0;\r
+ gvar.mm.mmstarted=0;\r
\r
#ifdef FILERL\r
// printf("filename!: ");\r
//screen.height += (16*2);\r
\r
// printf("main()=%Fp start MM\n", *argv[0]);\r
- MM_Startup(&mm, &mmi);\r
+ MM_Startup(&gvar.mm, &gvar.mmi);\r
//PM_Startup();\r
//PM_UnlockMainMem();\r
CA_Startup(&gvar);\r
#ifdef FILERL\r
// bakapeehandle = open(bakapee,O_RDONLY | O_BINARY, S_IREAD);\r
// printf("size of big buffer~=%u\n", _bmsize(segu, bigbuffer));\r
-// if(CA_FarRead(bakapeehandle,(void far *)&bigbuffer,sizeof(bigbuffer),&mm))\r
+// if(CA_FarRead(bakapeehandle,(void far *)&bigbuffer,sizeof(bigbuffer),&gvar.mm))\r
#ifdef FILEREAD\r
printf(" read\n");\r
- if(CA_ReadFile(bakapee, &bigbuffer, &mm))\r
+ if(CA_ReadFile(bakapee, &bigbuffer, &gvar.mm))\r
#else\r
printf(" load\n");\r
- if(CA_LoadFile(bakapee, &bigbuffer, &mm, &mmi))\r
+ if(CA_LoadFile(bakapee, &bigbuffer, &gvar.mm, &gvar.mmi))\r
#endif\r
baka=1;\r
else\r
getch();\r
//++++modexEnter();\r
//++++modexShowPage(&screen);\r
- MM_ShowMemory(&gvar, &mm);\r
+ MM_ShowMemory(&gvar, &gvar.mm);\r
//getch();\r
- MM_DumpData(&mm);\r
+ MM_DumpData(&gvar.mm);\r
//++++modexLeave();\r
- //++++MM_Report(&mm, &mmi);\r
+ //++++MM_Report(&gvar.mm, &gvar.mmi);\r
// printf(" stop!\n");\r
#ifdef FILERL\r
- MM_FreePtr(&bigbuffer, &mm);\r
+ MM_FreePtr(&bigbuffer, &gvar.mm);\r
#endif\r
//PM_Shutdown();\r
CA_Shutdown(&gvar);\r
- MM_Shutdown(&mm);\r
+ MM_Shutdown(&gvar.mm);\r
// printf(" done!\n");\r
#ifdef FILERL\r
free(bakapee);\r
else printf("\npoo!\n");\r
#endif\r
printf("========================================\n");\r
- printf("near= %Fp ", mm.nearheap);\r
- printf("far= %Fp", mm.farheap);\r
+ printf("near= %Fp ", gvar.mm.nearheap);\r
+ printf("far= %Fp", gvar.mm.farheap);\r
printf("\n");\r
- printf("&near= %Fp ", &(mm.nearheap));\r
- printf("&far= %Fp", &(mm.farheap));\r
+ printf("&near= %Fp ", &(gvar.mm.nearheap));\r
+ printf("&far= %Fp", &(gvar.mm.farheap));\r
printf("\n");\r
printf("bigb= %Fp ", bigbuffer);\r
//printf("bigbr= %04x", bigbuffer);\r
+++ /dev/null
-/* Catacomb Apocalypse Source Code\r
- * Copyright (C) 1993-2014 Flat Rock Software\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
-//\r
-// ID Engine\r
-// ID_IN.h - Header file for Input Manager\r
-// v1.0d1w\r
-// By Jason Blochowiak\r
-// Open Watcom port by sparky4\r
-//\r
-\r
-#ifndef __16_IN__\r
-#define __16_IN__\r
-\r
-#include <string.h>\r
-#include "src/lib/16_head.h"\r
-#include "src/lib/16_timer.h"\r
-#include "src/lib/16_sprite.h"\r
-#ifdef __WATCOMC__\r
-#include "src/lib/16_dbg.h"\r
-#endif\r
-#ifdef __DEBUG__\r
-//#define __DEBUG_InputMgr__\r
-#endif\r
-\r
-#ifdef __DEBUG_InputMgr__\r
-//#define TESTKEYIN\r
-//#define TESTCONTROLNOISY\r
-#endif\r
-\r
-extern boolean testkeyin,testcontrolnoisy;\r
-\r
-//if else for gfxtesting and direction\r
-//player[pn].d == 2 ||\r
-//player[pn].d != 2 ||\r
-#define DIRECTIONIFELSE (player[pn].info.dir == 2)\r
-//#define NDIRECTIONIFELSE (player[pn].info.dir != 2)\r
-\r
-#define KeyInt 9 // The keyboard ISR number\r
-\r
-// Stuff for the joystick\r
-#define JoyScaleMax 32768\r
-#define JoyScaleShift 8\r
-#define MaxJoyValue 5000\r
-\r
-#define MaxPlayers 4\r
-#define MaxKbds 2\r
-#define MaxJoys 2\r
-#define MaxPads 2\r
-#define NumCodes 128\r
-\r
-typedef byte ScanCode;\r
-#define sc_None 0\r
-#define sc_Bad 0xff\r
-#define sc_Return 0x1c\r
-#define sc_Enter sc_Return\r
-#define sc_Escape 0x01\r
-#define sc_Space 0x39\r
-#define sc_BackSpace 0x0e\r
-#define sc_Tab 0x0f\r
-#define sc_Alt 0x38\r
-#define sc_Control 0x1d\r
-#define sc_CapsLock 0x3a\r
-#define sc_LShift 0x2a\r
-#define sc_RShift 0x36\r
-#define sc_UpArrow 0x48\r
-#define sc_DownArrow 0x50\r
-#define sc_LeftArrow 0x4b\r
-#define sc_RightArrow 0x4d\r
-#define sc_Insert 0x52\r
-#define sc_Delete 0x53\r
-#define sc_Home 0x47\r
-#define sc_End 0x4f\r
-#define sc_PgUp 0x49\r
-#define sc_PgDn 0x51\r
-#define sc_F1 0x3b\r
-#define sc_F2 0x3c\r
-#define sc_F3 0x3d\r
-#define sc_F4 0x3e\r
-#define sc_F5 0x3f\r
-#define sc_F6 0x40\r
-#define sc_F7 0x41\r
-#define sc_F8 0x42\r
-#define sc_F9 0x43\r
-#define sc_F10 0x44\r
-#define sc_F11 0x57\r
-#define sc_F12 0x59\r
-\r
-#define sc_1 0x02\r
-#define sc_2 0x03\r
-#define sc_3 0x04\r
-#define sc_4 0x05\r
-#define sc_5 0x06\r
-#define sc_6 0x07\r
-#define sc_7 0x08\r
-#define sc_8 0x09\r
-#define sc_9 0x0a\r
-#define sc_0 0x0b\r
-\r
-#define sc_A 0x1e\r
-#define sc_B 0x30\r
-#define sc_C 0x2e\r
-#define sc_D 0x20\r
-#define sc_E 0x12\r
-#define sc_F 0x21\r
-#define sc_G 0x22\r
-#define sc_H 0x23\r
-#define sc_I 0x17\r
-#define sc_J 0x24\r
-#define sc_K 0x25\r
-#define sc_L 0x26\r
-#define sc_M 0x32\r
-#define sc_N 0x31\r
-#define sc_O 0x18\r
-#define sc_P 0x19\r
-#define sc_Q 0x10\r
-#define sc_R 0x13\r
-#define sc_S 0x1f\r
-#define sc_T 0x14\r
-#define sc_U 0x16\r
-#define sc_V 0x2f\r
-#define sc_W 0x11\r
-#define sc_X 0x2d\r
-#define sc_Y 0x15\r
-#define sc_Z 0x2c\r
-\r
-#define key_None 0\r
-#define key_Return 0x0d\r
-#define key_Enter key_Return\r
-#define key_Escape 0x1b\r
-#define key_Space 0x20\r
-#define key_BackSpace 0x08\r
-#define key_Tab 0x09\r
-#define key_Delete 0x7f\r
-\r
-#define key_LSuper 0x5b\r
-#define key_RSuper 0x5c\r
-#define key_Menu 0x5d\r
-\r
-// Stuff for the mouse\r
-#define MReset 0\r
-#define MButtons 3\r
-#define MDelta 11\r
-\r
-#define MouseInt 0x33\r
-#ifdef DEMO0\r
-typedef enum {\r
- demo_Off,demo_Record,demo_Playback,demo_PlayDone\r
- } Demo;\r
-#endif\r
-typedef enum {\r
- //ctrl_None, // MDM (GAMERS EDGE) - added\r
- ctrl_Keyboard,\r
- ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,\r
- ctrl_Joystick,\r
- ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,\r
- ctrl_Mouse,\r
- } ControlType;\r
-typedef enum {\r
- motion_Left = -1,motion_Up = -1,\r
- motion_None = 0,\r
- motion_Right = 1,motion_Down = 1\r
- } Motion;\r
-typedef enum {\r
- dir_North,//dir_NorthEast,\r
- dir_West,//dir_Nortinest,\r
- dir_None,\r
- dir_East,//,dir_SouthEast,\r
- dir_South,//dir_Soutinest,\r
- } Direction;\r
-typedef struct {\r
- boolean near button0,button1,button2,button3;\r
- int near x,y;\r
- Motion near xaxis,yaxis;\r
- Direction near dir;\r
- } CursorInfo;\r
-\r
-typedef struct {\r
- ScanCode near button0,button1,\r
- //upleft,\r
- up,\r
- down,\r
- left,\r
- right\r
- //upright,\r
- //downleft,\r
- //,downright\r
- ;\r
- } KeyboardDef;\r
-typedef struct {\r
- word near joyMinX,joyMinY,\r
- threshMinX,threshMinY,\r
- threshMaxX,threshMaxY,\r
- joyMaxX,joyMaxY,\r
- joyMultXL,joyMultYL,\r
- joyMultXH,joyMultYH;\r
- } JoystickDef;\r
-\r
-typedef struct\r
-{\r
- int x; //player exact position on the viewable map\r
- int y; //player exact position on the viewable map\r
- int tx; //player tile position on the viewable map\r
- int ty; //player tile position on the viewable map\r
- int triggerx; //player's trigger box tile position on the viewable map\r
- int triggery; //player's trigger box tile position on the viewable map\r
- int sheetsetx; //NOT USED YET! player sprite sheet set on the image x\r
- int sheetsety; //NOT USED YET! player sprite sheet set on the image y\r
- byte d; //direction to render sprite!! wwww\r
- byte q; //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www\r
- byte near pdir; //previous direction~\r
- //byte near kd[2]; //array of arrow key pressed\r
- word speed; //player speed!\r
- word spt; //speed per tile\r
-//0000 planar_buf_t huge *data; //supposively the sprite sheet data\r
-// planar_buf_t data; //supposively the sprite sheet data\r
-////0000----\r
- struct sprite *spri; //supposively the sprite sheet data\r
- sword hp; //hitpoints of the player\r
- int persist_aniframe; /* gonna be increased to 1 before being used, so 0 is ok for default */\r
- CursorInfo info;\r
- ControlType Controls;\r
-} player_t;\r
-\r
-/*\r
-=============================================================================\r
-\r
- GLOBAL VARIABLES\r
-\r
-=============================================================================\r
-*/\r
-/*extern struct inconfig\r
-{\r
- boolean MousePresent;\r
- boolean JoysPresent[MaxJoys];\r
- boolean Keyboard[NumCodes];\r
- boolean Paused;\r
- char LastASCII;\r
- ScanCode LastScan;\r
-\r
- KeyboardDef KbdDefs[MaxKbds];\r
- JoystickDef JoyDefs[MaxJoys];\r
-} inpu;*/\r
-\r
-#ifdef DEMO0\r
- static Demo DemoMode = demo_Off;\r
- static byte /*_seg*/ *DemoBuffer;\r
- static word DemoOffset,DemoSize;\r
-#endif\r
-\r
-// Internal routines\r
-extern void interrupt INL_KeyService();\r
-extern void Mouse(int x);\r
-//static void INL_GetMouseDelta(int *x,int *y);\r
-//static word INL_GetMouseButtons(void);\r
-extern void IN_GetJoyAbs(word joy,word *xp,word *yp);\r
-//static void INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive);\r
-//static word INL_GetJoyButtons(word joy);\r
-extern word IN_GetJoyButtonsDB(word joy);\r
-//static void INL_StartKbd(void);\r
-//static void INL_ShutKbd(void);\r
-//static boolean INL_StartMouse(void);\r
-//static void INL_ShutMouse(void);\r
-//static void INL_SetJoyScale(word joy);\r
-extern void IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy);\r
-//static boolean INL_StartJoy(word joy);\r
-//static void INL_ShutJoy(word joy);\r
-extern void IN_Startup();\r
-extern void IN_Default(boolean gotit,player_t *player,ControlType nt);\r
-extern void IN_Shutdown();\r
-extern void IN_SetKeyHook(void (*hook)());\r
-extern void IN_ClearKeysDown();\r
-//static void INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy);\r
-extern void IN_ReadCursor(CursorInfo *info);\r
-extern void near IN_ReadControl(int pn,player_t *player);\r
-extern void IN_SetControlType(word pn,player_t *player,ControlType type);\r
-#if DEMO0\r
-extern boolean IN_StartDemoRecord(word bufsize);\r
-extern void IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize);\r
-extern void IN_StopDemo(void);\r
-extern void IN_FreeDemoBuffer(void);\r
-#endif\r
-extern byte *IN_GetScanName(ScanCode scan);\r
-extern ScanCode IN_WaitForKey();\r
-extern char IN_WaitForASCII();\r
-extern void IN_AckBack();\r
-extern void IN_Ack();\r
-extern boolean IN_IsUserInput();\r
-extern boolean IN_UserInput(dword delay,boolean clear);\r
-extern boolean IN_KeyDown(byte code);\r
-extern void IN_ClearKey(byte code);\r
-extern boolean IN_qb(byte kee);\r
-void IN_initplayer(player_t *player, word pn);\r
-\r
-#endif\r