X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_tail.c;h=c8e1ee81632d245ec51501e8d9058dbce9241de3;hb=5af1604f7af6c1d1ab94299bfe6a4195b203a323;hp=daa9fadc3192344578189bcdd8a8b762e11bb7e5;hpb=424d6f05d9aaa0000302df70be10c2598886a030;p=16.git diff --git a/src/lib/16_tail.c b/src/lib/16_tail.c index daa9fadc..c8e1ee81 100755 --- a/src/lib/16_tail.c +++ b/src/lib/16_tail.c @@ -20,11 +20,12 @@ * */ /* - * 16 library + * 16 tail library */ #include "src/lib/16_tail.h" #include "src/lib/16text.h" + /* ========================== = @@ -35,28 +36,19 @@ ========================== */ -void Startup16(global_game_variables_t *gvar) +void Startup16 (global_game_variables_t *gvar) { -#ifdef __WATCOMC__ - start_timer(gvar); -#endif gvar->video.VL_Started=0; TL_VidInit(gvar); gvar->mm.mmstarted=0; gvar->pm.PMStarted=0; - MM_Startup(gvar); + StartupCAMMPM(gvar); #ifdef __WATCOMC__ #ifdef __DEBUG_InputMgr__ if(!dbg_nointest) #endif IN_Startup(gvar); #endif -#ifdef __16_PM__ - PM_Startup(gvar); - PM_CheckMainMem(gvar); - PM_UnlockMainMem(gvar); -#endif - CA_Startup(gvar); } //=========================================================================== @@ -71,69 +63,83 @@ void Startup16(global_game_variables_t *gvar) ========================== */ -void Shutdown16(global_game_variables_t *gvar) +void Shutdown16 (global_game_variables_t *gvar) { -#ifdef __16_PM__ - PM_Shutdown(gvar); -#endif #ifdef __WATCOMC__ #ifdef __DEBUG_InputMgr__ if(!dbg_nointest) #endif IN_Shutdown(gvar); #endif - CA_Shutdown(gvar); - MM_Shutdown(gvar); + ShutdownCAMMPM(gvar); #ifdef __WATCOMC__ if(gvar->video.VL_Started) - VGAmodeX(0, 1, gvar); + VL_Shutdown (gvar);//VGAmodeX(0, 1, gvar); #endif } -void TL_VidInit(global_game_variables_t *gvar) +//=========================================================================== + +/* +========================== += += StartupCAMMPM += +========================== +*/ + +void StartupCAMMPM (global_game_variables_t *gvar) { -#ifdef __WATCOMC__ - // DOSLIB: check our environment - probe_dos(); - - // DOSLIB: what CPU are we using? - // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS. - // So this code by itself shouldn't care too much what CPU it's running on. Except that other - // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for - // the CPU to carry out tasks. --J.C. - cpu_probe(); - - // DOSLIB: check for VGA - if (!probe_vga()) { - printf("VGA probe failed\n"); - return; - } - // hardware must be VGA or higher! - if (!(vga_state.vga_flags & VGA_IS_VGA)) { - printf("This program requires VGA or higher graphics hardware\n"); - return; - } +/* + MM_Startup (); // so the signon screen can be freed + + SignonScreen (); - if (_DEBUG_INIT() == 0) { -#ifdef DEBUGSERIAL - //printf("WARNING: Failed to initialize DEBUG output\n"); + VW_Startup (); + IN_Startup (); + PM_Startup (); + PM_UnlockMainMem (); + SD_Startup (); + CA_Startup (); + US_Startup (); +*/ + MM_Startup(gvar); +#ifdef __16_PM__ + PM_Startup(gvar); +//???? PM_CheckMainMem(gvar); + PM_UnlockMainMem(gvar); #endif - } - _DEBUG("Serial debug output started\n"); // NTS: All serial output must end messages with newline, or DOSBox-X will not emit text to log - _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U); + CA_Startup(gvar); +} - textInit(); +//=========================================================================== + +/* +========================== += += ShutdownCAMMPM += +========================== +*/ - // get old video mode - //in.h.ah = 0xf; - //int86(0x10, &in, &out); - gvar->video.old_mode = vgaGetMode();//out.h.al; -#else - gvar->video.old_mode = 3; +void ShutdownCAMMPM (global_game_variables_t *gvar) +{ +/* + US_Shutdown (); + SD_Shutdown (); + PM_Shutdown (); + IN_Shutdown (); + VW_Shutdown (); + CA_Shutdown (); + MM_Shutdown () +*/ +#ifdef __16_PM__ + PM_Shutdown(gvar); #endif + CA_Shutdown(gvar); + MM_Shutdown(gvar); } - //=========================================================================== /* @@ -143,29 +149,28 @@ void TL_VidInit(global_game_variables_t *gvar) = ==================== */ - -/*void ReadConfig(void) +#if 0 +void ReadConfig(void) { int file; - SDMode sd; - SMMode sm; - SDSMode sds; +// SDMode sd; +// SMMode sm; +// SDSMode sds; - if ( (file = open(configname,O_BINARY | O_RDONLY)) != -1) + if ( (file = open(CONFIGNAME,O_BINARY | O_RDONLY)) != -1) { // // valid config file // - read(file,Scores,sizeof(HighScore) * MaxScores); +// read(file,Scores,sizeof(HighScore) * MaxScores); - read(file,&sd,sizeof(sd)); - read(file,&sm,sizeof(sm)); - read(file,&sds,sizeof(sds)); +// read(file,&sd,sizeof(sd)); +// read(file,&sm,sizeof(sm)); +// read(file,&sds,sizeof(sds)); read(file,&mouseenabled,sizeof(mouseenabled)); read(file,&joystickenabled,sizeof(joystickenabled)); - read(file,&joypadenabled,sizeof(joypadenabled)); read(file,&joystickprogressive,sizeof(joystickprogressive)); read(file,&joystickport,sizeof(joystickport)); @@ -179,7 +184,7 @@ void TL_VidInit(global_game_variables_t *gvar) close(file); - if (sd == sdm_AdLib && !AdLibPresent && !SoundBlasterPresent) + /*if (sd == sdm_AdLib && !AdLibPresent && !SoundBlasterPresent) { sd = sdm_PC; sd = smm_Off; @@ -187,7 +192,7 @@ void TL_VidInit(global_game_variables_t *gvar) if ((sds == sds_SoundBlaster && !SoundBlasterPresent) || (sds == sds_SoundSource && !SoundSourcePresent)) - sds = sds_Off; + sds = sds_Off;*/ if (!MousePresent) mouseenabled = false; @@ -202,7 +207,7 @@ void TL_VidInit(global_game_variables_t *gvar) // // no config file, so select by hardware // - if (SoundBlasterPresent || AdLibPresent) +/* if (SoundBlasterPresent || AdLibPresent) { sd = sdm_AdLib; sm = smm_AdLib; @@ -218,13 +223,12 @@ void TL_VidInit(global_game_variables_t *gvar) else if (SoundSourcePresent) sds = sds_SoundSource; else - sds = sds_Off; + sds = sds_Off;*/ if (MousePresent) mouseenabled = true; joystickenabled = false; - joypadenabled = false; joystickport = 0; joystickprogressive = false; @@ -235,7 +239,7 @@ void TL_VidInit(global_game_variables_t *gvar) SD_SetMusicMode (sm); SD_SetSoundMode (sd); SD_SetDigiDevice (sds); -}*/ +} /* @@ -246,24 +250,23 @@ void TL_VidInit(global_game_variables_t *gvar) ==================== */ -/*void WriteConfig(void) +void WriteConfig(void) { int file; - file = open(configname,O_CREAT | O_BINARY | O_WRONLY, + file = open(CONFIGNAME,O_CREAT | O_BINARY | O_WRONLY, S_IREAD | S_IWRITE | S_IFREG); if (file != -1) { - write(file,Scores,sizeof(HighScore) * MaxScores); +// write(file,Scores,sizeof(HighScore) * MaxScores); - write(file,&SoundMode,sizeof(SoundMode)); - write(file,&MusicMode,sizeof(MusicMode)); - write(file,&DigiMode,sizeof(DigiMode)); +// write(file,&SoundMode,sizeof(SoundMode)); +// write(file,&MusicMode,sizeof(MusicMode)); +// write(file,&DigiMode,sizeof(DigiMode)); write(file,&mouseenabled,sizeof(mouseenabled)); write(file,&joystickenabled,sizeof(joystickenabled)); - write(file,&joypadenabled,sizeof(joypadenabled)); write(file,&joystickprogressive,sizeof(joystickprogressive)); write(file,&joystickport,sizeof(joystickport)); @@ -272,12 +275,134 @@ void TL_VidInit(global_game_variables_t *gvar) write(file,&buttonmouse,sizeof(buttonmouse)); write(file,&buttonjoy,sizeof(buttonjoy)); - write(file,&viewsize,sizeof(viewsize)); +// write(file,&viewsize,sizeof(viewsize)); write(file,&mouseadjustment,sizeof(mouseadjustment)); close(file); } -}*/ +} +#endif +//=========================================================================== + +/* +=================== += += FizzleFade += +=================== +*/ + +boolean FizzleFade (unsigned source, unsigned dest, unsigned width, unsigned height, unsigned frames, boolean abortable, global_game_variables_t *gvar) +{ + word p,pixperframe; + unsigned drawofs,pagedelta; + byte mask,maskb[8] = {1,2,4,8}; + unsigned x,y,frame; + long rndval; + word screenseg; +#ifdef __WATCOMC__ + unsigned esorig;//,q; +#endif + + pagedelta = dest-source; + rndval = 1; +#ifdef __WATCOMC__ + esorig = 0;// q = 16; +#endif + x = y = 0; + pixperframe = (dword)(gvar->video.page[0].width*gvar->video.page[0].height)/frames; + screenseg = SCREENSEG; + + IN_StartAck (gvar); + +// modexClearRegion(&(gvar->video.page[0]), 0, 0, gvar->video.page[0].width, gvar->video.page[0].height, 0); +// modexClearRegion(&(gvar->video.page[1]), 0, 0, gvar->video.page[0].width, gvar->video.page[0].height, 15); + +#ifdef __WATCOMC__ + __asm { + mov [esorig],es + } +#endif +// TimeCount= + frame=0; + do // while (1) + { + if (abortable && IN_CheckAck (gvar) ) + return true; + + __asm { + mov es,[screenseg] + } + + for (p=0;pwidth || y>height) +// if ((x>width || y>height) && (xvideo.ofs.ylookup[y]) + (x>>2); + drawofs = source+(y*gvar->video.page[0].stridew) + (x>>2); + + // + // copy one pixel + // + mask = x&3; + VGAREADMAP(mask); + mask = maskb[mask]; + VGAMAPMASK(mask); + + __asm { + mov di,[drawofs] + mov al,[es:di] + add di,[pagedelta] + mov [es:di],al + } + + if (rndval == 1) // entire sequence has been completed + return false; + } + frame++; +//-- while (TimeCount=STARTTILE8) + sprite = STARTTILE8-1; + else if (spritewidth);US_Print ("\n");PrintX=hx; + US_PrintUnsigned (spr->height);US_Print ("\n");PrintX=hx; + US_PrintSigned (spr->orgx);US_Print ("\n");PrintX=hx; + US_PrintSigned (spr->orgy);US_Print ("\n");PrintX=hx; + US_PrintSigned (spr->xl);US_Print ("\n");PrintX=hx; + US_PrintSigned (spr->yl);US_Print ("\n");PrintX=hx; + US_PrintSigned (spr->xh);US_Print ("\n");PrintX=hx; + US_PrintSigned (spr->yh);US_Print ("\n");PrintX=hx; + US_PrintSigned (spr->shifts);US_Print ("\n");PrintX=hx; + if (!block) + { + US_Print ("-----"); + } + else + { + mem = block->sourceoffset[3]+5*block->planesize[3]; + mem = (mem+15)&(~15); // round to paragraphs + US_PrintUnsigned (mem); + } + + oldsprite = sprite; + do + { + // + // draw the current shift, then wait for key + // + VWB_Bar(topx,hy,DISPWIDTH,bottomy-hy,WHITE); + if (block) + { + PrintX = topx; + PrintY = hy; + US_Print ("Shift:"); + US_PrintUnsigned (shift); + US_Print ("\n"); + VWB_DrawSprite (topx+16+shift*2,PrintY,sprite); + } + + VW_UpdateScreen(); + + scan = IN_WaitForKey (); + + switch (scan) + { + case sc_UpArrow: + sprite++; + break; + case sc_DownArrow: + sprite--; + break; + case sc_LeftArrow: + if (--shift == -1) + shift = 3; + break; + case sc_RightArrow: + if (++shift == 4) + shift = 0; + break; + case sc_Escape: + return; + } + + } while (sprite == oldsprite); + + } while (1); + + } +#endif + /* ========================== = @@ -335,7 +582,7 @@ void ClearMemory (global_game_variables_t *gvar) #ifdef __16_PM__ PM_UnlockMainMem(gvar); #endif - //snd + //sd MM_SortMem (gvar); } @@ -396,10 +643,7 @@ void Quit (global_game_variables_t *gvar, char *error) //=========================================================================== -#ifndef __WATCOMC__ -char global_temp_status_text[512]; -char global_temp_status_text2[512]; -#else +#ifdef __WATCOMC__ // // for mary4 (XT) // this is from my XT's BIOS @@ -503,13 +747,3 @@ void booleantest() printf(" sizeof(boolean)=%s\n", boolean_to_binary(sizeof(boolean))); printf("end of boolean test\n"); } - -#ifdef __BORLANDC__ -word modexPalOverscan(word col) -{ - //modexWaitBorder(); - outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */ - outp(PAL_DATA_REG, col); - return col; -} -#endif