From: sparky4 Date: Sun, 21 Aug 2016 21:28:51 +0000 (-0500) Subject: branch is in the master swap branch code added to swap the files out ^^ X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=commitdiff_plain;h=90b16acddca3e382ba996a92c9358dc899ef5599 branch is in the master swap branch code added to swap the files out ^^ --- diff --git a/src/_scroll.c b/src/_scroll.c index 7ad68101..5a16247d 100755 --- a/src/_scroll.c +++ b/src/_scroll.c @@ -24,7 +24,9 @@ #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 @@ -35,10 +37,8 @@ global_game_variables_t gvar; 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; @@ -53,7 +53,7 @@ boolean panswitch=0; word pg; //#ifdef FADE static word paloffset=0; - byte *dpal, *default_pal; + byte *dpal; //#endif byte *gpal; byte *ptr; @@ -61,19 +61,21 @@ boolean panswitch=0; 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(); @@ -148,17 +150,6 @@ void main(int argc, char *argv[]) }*/ 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(); @@ -168,8 +159,6 @@ void main(int argc, char *argv[]) #ifdef MODEX #ifdef FADE dpal = modexNewPal(); - default_pal = modexNewPal(); - *default_pal = *dpal; modexPalSave(dpal); modexFadeOff(4, dpal); #endif @@ -180,7 +169,8 @@ void main(int argc, char *argv[]) modexPalBlack(); //reset the palette~ #endif #endif - modexPalUpdate1(palette); + modexLoadPalFile("data/spri/chikyuu.pal", &ppal); + modexPalUpdate1(ppal); #ifdef MODEX #ifdef FADE gpal = modexNewPal(); @@ -285,11 +275,11 @@ void main(int argc, char *argv[]) #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 @@ -335,7 +325,7 @@ void main(int argc, char *argv[]) }*/ //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! } @@ -351,6 +341,9 @@ void main(int argc, char *argv[]) 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); diff --git a/src/exmmtest.c b/src/exmmtest.c index fb8a1ee1..35701796 100755 --- a/src/exmmtest.c +++ b/src/exmmtest.c @@ -44,7 +44,6 @@ global_game_variables_t gvar; void main(int argc, char *argv[]) { - mminfo_t mm; mminfotype mmi; #ifdef __WATCOMC__ __segment sega; void __based(sega)* bigbuffer; @@ -71,7 +70,7 @@ main(int argc, char *argv[]) #ifdef FILERL bakapee = malloc(64); #endif - mm.mmstarted=0; + gvar.mm.mmstarted=0; #ifdef FILERL // printf("filename!: "); @@ -89,7 +88,7 @@ main(int argc, char *argv[]) //screen.height += (16*2); // printf("main()=%Fp start MM\n", *argv[0]); - MM_Startup(&mm, &mmi); + MM_Startup(&gvar.mm, &gvar.mmi); //PM_Startup(); //PM_UnlockMainMem(); CA_Startup(&gvar); @@ -103,13 +102,13 @@ main(int argc, char *argv[]) #ifdef FILERL // bakapeehandle = open(bakapee,O_RDONLY | O_BINARY, S_IREAD); // printf("size of big buffer~=%u\n", _bmsize(segu, bigbuffer)); -// if(CA_FarRead(bakapeehandle,(void far *)&bigbuffer,sizeof(bigbuffer),&mm)) +// if(CA_FarRead(bakapeehandle,(void far *)&bigbuffer,sizeof(bigbuffer),&gvar.mm)) #ifdef FILEREAD printf(" read\n"); - if(CA_ReadFile(bakapee, &bigbuffer, &mm)) + if(CA_ReadFile(bakapee, &bigbuffer, &gvar.mm)) #else printf(" load\n"); - if(CA_LoadFile(bakapee, &bigbuffer, &mm, &mmi)) + if(CA_LoadFile(bakapee, &bigbuffer, &gvar.mm, &gvar.mmi)) #endif baka=1; else @@ -130,18 +129,18 @@ main(int argc, char *argv[]) getch(); //++++modexEnter(); //++++modexShowPage(&screen); - MM_ShowMemory(&gvar, &mm); + MM_ShowMemory(&gvar, &gvar.mm); //getch(); - MM_DumpData(&mm); + MM_DumpData(&gvar.mm); //++++modexLeave(); - //++++MM_Report(&mm, &mmi); + //++++MM_Report(&gvar.mm, &gvar.mmi); // printf(" stop!\n"); #ifdef FILERL - MM_FreePtr(&bigbuffer, &mm); + MM_FreePtr(&bigbuffer, &gvar.mm); #endif //PM_Shutdown(); CA_Shutdown(&gvar); - MM_Shutdown(&mm); + MM_Shutdown(&gvar.mm); // printf(" done!\n"); #ifdef FILERL free(bakapee); @@ -149,11 +148,11 @@ main(int argc, char *argv[]) else printf("\npoo!\n"); #endif printf("========================================\n"); - printf("near= %Fp ", mm.nearheap); - printf("far= %Fp", mm.farheap); + printf("near= %Fp ", gvar.mm.nearheap); + printf("far= %Fp", gvar.mm.farheap); printf("\n"); - printf("&near= %Fp ", &(mm.nearheap)); - printf("&far= %Fp", &(mm.farheap)); + printf("&near= %Fp ", &(gvar.mm.nearheap)); + printf("&far= %Fp", &(gvar.mm.farheap)); printf("\n"); printf("bigb= %Fp ", bigbuffer); //printf("bigbr= %04x", bigbuffer); diff --git a/src/lib/16_in.h b/src/lib/16_in.h index db63e498..0fef7132 100755 --- a/src/lib/16_in.h +++ b/src/lib/16_in.h @@ -30,7 +30,8 @@ #include #include "src/lib/16_head.h" #include "src/lib/16_timer.h" -#include "src/lib/bitmap.h" +#include "src/lib/16_sprite.h" +#include "src/lib/bitmap.h" //old format #ifdef __WATCOMC__ #include "src/lib/16_dbg.h" #endif @@ -230,7 +231,8 @@ typedef struct //0000 planar_buf_t huge *data; //supposively the sprite sheet data // planar_buf_t data; //supposively the sprite sheet data ////0000---- - bitmap_t *data; //supposively the sprite sheet data + struct sprite *spri; //supposively the sprite sheet data + bitmap_t *data; //supposively the sprite sheet data//old format sword hp; //hitpoints of the player int persist_aniframe; /* gonna be increased to 1 before being used, so 0 is ok for default */ CursorInfo info; diff --git a/src/lib/_16_in.h b/src/lib/_16_in.h deleted file mode 100755 index 8ffd3dc8..00000000 --- a/src/lib/_16_in.h +++ /dev/null @@ -1,310 +0,0 @@ -/* Catacomb Apocalypse Source Code - * Copyright (C) 1993-2014 Flat Rock Software - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -// -// ID Engine -// ID_IN.h - Header file for Input Manager -// v1.0d1w -// By Jason Blochowiak -// Open Watcom port by sparky4 -// - -#ifndef __16_IN__ -#define __16_IN__ - -#include -#include "src/lib/16_head.h" -#include "src/lib/16_timer.h" -#include "src/lib/16_sprite.h" -#ifdef __WATCOMC__ -#include "src/lib/16_dbg.h" -#endif -#ifdef __DEBUG__ -//#define __DEBUG_InputMgr__ -#endif - -#ifdef __DEBUG_InputMgr__ -//#define TESTKEYIN -//#define TESTCONTROLNOISY -#endif - -extern boolean testkeyin,testcontrolnoisy; - -//if else for gfxtesting and direction -//player[pn].d == 2 || -//player[pn].d != 2 || -#define DIRECTIONIFELSE (player[pn].info.dir == 2) -//#define NDIRECTIONIFELSE (player[pn].info.dir != 2) - -#define KeyInt 9 // The keyboard ISR number - -// Stuff for the joystick -#define JoyScaleMax 32768 -#define JoyScaleShift 8 -#define MaxJoyValue 5000 - -#define MaxPlayers 4 -#define MaxKbds 2 -#define MaxJoys 2 -#define MaxPads 2 -#define NumCodes 128 - -typedef byte ScanCode; -#define sc_None 0 -#define sc_Bad 0xff -#define sc_Return 0x1c -#define sc_Enter sc_Return -#define sc_Escape 0x01 -#define sc_Space 0x39 -#define sc_BackSpace 0x0e -#define sc_Tab 0x0f -#define sc_Alt 0x38 -#define sc_Control 0x1d -#define sc_CapsLock 0x3a -#define sc_LShift 0x2a -#define sc_RShift 0x36 -#define sc_UpArrow 0x48 -#define sc_DownArrow 0x50 -#define sc_LeftArrow 0x4b -#define sc_RightArrow 0x4d -#define sc_Insert 0x52 -#define sc_Delete 0x53 -#define sc_Home 0x47 -#define sc_End 0x4f -#define sc_PgUp 0x49 -#define sc_PgDn 0x51 -#define sc_F1 0x3b -#define sc_F2 0x3c -#define sc_F3 0x3d -#define sc_F4 0x3e -#define sc_F5 0x3f -#define sc_F6 0x40 -#define sc_F7 0x41 -#define sc_F8 0x42 -#define sc_F9 0x43 -#define sc_F10 0x44 -#define sc_F11 0x57 -#define sc_F12 0x59 - -#define sc_1 0x02 -#define sc_2 0x03 -#define sc_3 0x04 -#define sc_4 0x05 -#define sc_5 0x06 -#define sc_6 0x07 -#define sc_7 0x08 -#define sc_8 0x09 -#define sc_9 0x0a -#define sc_0 0x0b - -#define sc_A 0x1e -#define sc_B 0x30 -#define sc_C 0x2e -#define sc_D 0x20 -#define sc_E 0x12 -#define sc_F 0x21 -#define sc_G 0x22 -#define sc_H 0x23 -#define sc_I 0x17 -#define sc_J 0x24 -#define sc_K 0x25 -#define sc_L 0x26 -#define sc_M 0x32 -#define sc_N 0x31 -#define sc_O 0x18 -#define sc_P 0x19 -#define sc_Q 0x10 -#define sc_R 0x13 -#define sc_S 0x1f -#define sc_T 0x14 -#define sc_U 0x16 -#define sc_V 0x2f -#define sc_W 0x11 -#define sc_X 0x2d -#define sc_Y 0x15 -#define sc_Z 0x2c - -#define key_None 0 -#define key_Return 0x0d -#define key_Enter key_Return -#define key_Escape 0x1b -#define key_Space 0x20 -#define key_BackSpace 0x08 -#define key_Tab 0x09 -#define key_Delete 0x7f - -#define key_LSuper 0x5b -#define key_RSuper 0x5c -#define key_Menu 0x5d - -// Stuff for the mouse -#define MReset 0 -#define MButtons 3 -#define MDelta 11 - -#define MouseInt 0x33 -#ifdef DEMO0 -typedef enum { - demo_Off,demo_Record,demo_Playback,demo_PlayDone - } Demo; -#endif -typedef enum { - //ctrl_None, // MDM (GAMERS EDGE) - added - ctrl_Keyboard, - ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2, - ctrl_Joystick, - ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2, - ctrl_Mouse, - } ControlType; -typedef enum { - motion_Left = -1,motion_Up = -1, - motion_None = 0, - motion_Right = 1,motion_Down = 1 - } Motion; -typedef enum { - dir_North,//dir_NorthEast, - dir_West,//dir_Nortinest, - dir_None, - dir_East,//,dir_SouthEast, - dir_South,//dir_Soutinest, - } Direction; -typedef struct { - boolean near button0,button1,button2,button3; - int near x,y; - Motion near xaxis,yaxis; - Direction near dir; - } CursorInfo; - -typedef struct { - ScanCode near button0,button1, - //upleft, - up, - down, - left, - right - //upright, - //downleft, - //,downright - ; - } KeyboardDef; -typedef struct { - word near joyMinX,joyMinY, - threshMinX,threshMinY, - threshMaxX,threshMaxY, - joyMaxX,joyMaxY, - joyMultXL,joyMultYL, - joyMultXH,joyMultYH; - } JoystickDef; - -typedef struct -{ - int x; //player exact position on the viewable map - int y; //player exact position on the viewable map - int tx; //player tile position on the viewable map - int ty; //player tile position on the viewable map - int triggerx; //player's trigger box tile position on the viewable map - int triggery; //player's trigger box tile position on the viewable map - int sheetsetx; //NOT USED YET! player sprite sheet set on the image x - int sheetsety; //NOT USED YET! player sprite sheet set on the image y - byte d; //direction to render sprite!! wwww - byte q; //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www - byte near pdir; //previous direction~ - //byte near kd[2]; //array of arrow key pressed - word speed; //player speed! - word spt; //speed per tile -//0000 planar_buf_t huge *data; //supposively the sprite sheet data -// planar_buf_t data; //supposively the sprite sheet data -////0000---- - struct sprite *spri; //supposively the sprite sheet data - sword hp; //hitpoints of the player - int persist_aniframe; /* gonna be increased to 1 before being used, so 0 is ok for default */ - CursorInfo info; - ControlType Controls; -} player_t; - -/* -============================================================================= - - GLOBAL VARIABLES - -============================================================================= -*/ -/*extern struct inconfig -{ - boolean MousePresent; - boolean JoysPresent[MaxJoys]; - boolean Keyboard[NumCodes]; - boolean Paused; - char LastASCII; - ScanCode LastScan; - - KeyboardDef KbdDefs[MaxKbds]; - JoystickDef JoyDefs[MaxJoys]; -} inpu;*/ - -#ifdef DEMO0 - static Demo DemoMode = demo_Off; - static byte /*_seg*/ *DemoBuffer; - static word DemoOffset,DemoSize; -#endif - -// Internal routines -extern void interrupt INL_KeyService(); -extern void Mouse(int x); -//static void INL_GetMouseDelta(int *x,int *y); -//static word INL_GetMouseButtons(void); -extern void IN_GetJoyAbs(word joy,word *xp,word *yp); -//static void INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive); -//static word INL_GetJoyButtons(word joy); -extern word IN_GetJoyButtonsDB(word joy); -//static void INL_StartKbd(void); -//static void INL_ShutKbd(void); -//static boolean INL_StartMouse(void); -//static void INL_ShutMouse(void); -//static void INL_SetJoyScale(word joy); -extern void IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy); -//static boolean INL_StartJoy(word joy); -//static void INL_ShutJoy(word joy); -extern void IN_Startup(); -extern void IN_Default(boolean gotit,player_t *player,ControlType nt); -extern void IN_Shutdown(); -extern void IN_SetKeyHook(void (*hook)()); -extern void IN_ClearKeysDown(); -//static void INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy); -extern void IN_ReadCursor(CursorInfo *info); -extern void near IN_ReadControl(int pn,player_t *player); -extern void IN_SetControlType(word pn,player_t *player,ControlType type); -#if DEMO0 -extern boolean IN_StartDemoRecord(word bufsize); -extern void IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize); -extern void IN_StopDemo(void); -extern void IN_FreeDemoBuffer(void); -#endif -extern byte *IN_GetScanName(ScanCode scan); -extern ScanCode IN_WaitForKey(); -extern char IN_WaitForASCII(); -extern void IN_AckBack(); -extern void IN_Ack(); -extern boolean IN_IsUserInput(); -extern boolean IN_UserInput(dword delay,boolean clear); -extern boolean IN_KeyDown(byte code); -extern void IN_ClearKey(byte code); -extern boolean IN_qb(byte kee); -void IN_initplayer(player_t *player, word pn); - -#endif diff --git a/src/lib/typdefst.h b/src/lib/typdefst.h index 76082c56..fb3943d1 100755 --- a/src/lib/typdefst.h +++ b/src/lib/typdefst.h @@ -184,8 +184,8 @@ typedef struct byte *pee; // message for fps handle_t handle; //handles for file logging kurokku_t kurokku; //clock struct - mminfo_t mm; - mminfotype mmi; + mminfo_t mm; mminfotype mmi; + void *bigbuffer; } global_game_variables_t; #endif /* _TYPEDEFSTRUCT_H_ */ diff --git a/src/scroll.c b/src/scroll.c index a0027f10..2746ca4f 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -34,7 +34,6 @@ static map_t map; player_t player[MaxPlayers]; map_view_t mv[4]; //word pn=0; //i forgot ww -//static planar_buf_t huge *pp; float t; sword bakapee; pan_t pan; @@ -49,7 +48,7 @@ boolean panswitch=0; word pg; //#ifdef FADE static word paloffset=0; - byte *dpal, *default_pal; + byte *dpal; //#endif byte *gpal; byte *ptr; @@ -92,13 +91,8 @@ void main(int argc, char *argv[]) _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U); pan.pn=1; - //player[0].data = &pp; - //printf("starting timer "); start_timer(&gvar); - //printf("ok\n"); - -// atexit(qclean()); /* create the map */ fprintf(stderr, "testing map load~ "); @@ -132,8 +126,6 @@ void main(int argc, char *argv[]) #ifdef MODEX #ifdef FADE dpal = modexNewPal(); - default_pal = modexNewPal(); - *default_pal = *dpal; modexPalSave(dpal); modexFadeOff(4, dpal); #endif @@ -310,7 +302,7 @@ void main(int argc, char *argv[]) }*/ //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! } diff --git a/swapbranchcode.sh b/swapbranchcode.sh index 6e635763..859cb02c 100755 --- a/swapbranchcode.sh +++ b/swapbranchcode.sh @@ -3,10 +3,6 @@ mv src/scroll.c src/scroll_.c mv src/_scroll.c src/scroll.c mv src/scroll_.c src/_scroll.c -mv src/lib/16_in.h src/lib/16_in_.h -mv src/lib/_16_in.h src/lib/16_in.h -mv src/lib/16_in_.h src/lib/_16_in.h - mv src/lib/scroll16.c src/lib/scroll1_.c mv src/lib/_croll16.c src/lib/scroll16.c mv src/lib/scroll1_.c src/lib/_croll16.c