X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_tail.c;h=c0d6d89fdee243505a3ce0ed990b0d2d39117771;hb=3d7af30456302e0bf6accc07431e8210b3af052e;hp=bfa8446b801c8adb813f5e5e8636efd588e4a3a6;hpb=d799ef823a8b57ba6c783ed323430254083158be;p=16.git diff --git a/src/lib/16_tail.c b/src/lib/16_tail.c index bfa8446b..c0d6d89f 100755 --- a/src/lib/16_tail.c +++ b/src/lib/16_tail.c @@ -20,12 +20,14 @@ * */ /* - * 16 library + * 16 tail library */ #include "src/lib/16_tail.h" #include "src/lib/16text.h" +static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ + /* ========================== = @@ -40,38 +42,9 @@ void Startup16(global_game_variables_t *gvar) { #ifdef __WATCOMC__ start_timer(gvar); - - // 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; - } - - if (_DEBUG_INIT() == 0) { -#ifdef DEBUGSERIAL - //printf("WARNING: Failed to initialize DEBUG output\n"); -#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); - - textInit(); #endif + gvar->video.VL_Started=0; + TL_VidInit(gvar); gvar->mm.mmstarted=0; gvar->pm.PMStarted=0; MM_Startup(gvar); @@ -81,8 +54,11 @@ void Startup16(global_game_variables_t *gvar) #endif IN_Startup(gvar); #endif +#ifdef __16_PM__ PM_Startup(gvar); + PM_CheckMainMem(gvar); PM_UnlockMainMem(gvar); +#endif CA_Startup(gvar); } @@ -100,7 +76,9 @@ void Startup16(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) @@ -109,7 +87,53 @@ void Shutdown16(global_game_variables_t *gvar) #endif CA_Shutdown(gvar); MM_Shutdown(gvar); - VGAmodeX(0, 1, gvar); +#ifdef __WATCOMC__ + if(gvar->video.VL_Started) + VGAmodeX(0, 1, gvar); +#endif +} + +void TL_VidInit(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; + } + + if (_DEBUG_INIT() == 0) { +#ifdef DEBUGSERIAL + //printf("WARNING: Failed to initialize DEBUG output\n"); +#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); + + textInit(); + + // get old video mode + //in.h.ah = 0xf; + //int86(0x10, &in, &out); + if(!gvar->video.old_mode) gvar->video.old_mode = vgaGetMode();//out.h.al; +#else + gvar->video.old_mode = 3; +#endif } @@ -260,6 +284,176 @@ void Shutdown16(global_game_variables_t *gvar) //=========================================================================== +/* +=================== += += FizzleFade += +=================== +*/ + +#define PIXPERFRAME 1600 + +void FizzleFade (unsigned source, unsigned dest, + unsigned width,unsigned height, boolean abortable, global_game_variables_t *gv) +{ + unsigned drawofs,pagedelta; + unsigned char maskb[8] = {1,2,4,8,16,32,64,128}; + unsigned x,y,p,frame; + long rndval; + word TimeCount = *clockw; + word screenseg = SCREENSEG; + + pagedelta = dest-source; +//++++ VL_SetScreen (dest,0); + rndval = 1; + x = y = 0; + + __asm { + mov es,[screenseg] + mov dx,SC_INDEX + mov al,SC_MAPMASK + out dx,al + } + + TimeCount=frame=0; + do // while (1) + { + if (abortable) + { + IN_ReadControl(0,gv); + if (gv->player[0].info.button0 || gv->player[0].info.button1 || gv->in.inst->Keyboard[sc_Space] + || gv->in.inst->Keyboard[sc_Enter]) + { +//++++ VW_ScreenToScreen (source,dest,width/8,height); + return; + } + } + + for (p=0;pwidth || y>height) + continue; + drawofs = source+gv->video.ofs.ylookup[y]; + + __asm { + mov cx,[x] + mov si,cx + and si,7 + mov dx,GC_INDEX + mov al,GC_BITMASK + mov ah,BYTE PTR [maskb+si] + out dx,ax + + mov si,[drawofs] + shr cx,1 + shr cx,1 + shr cx,1 + add si,cx + mov di,si + add di,[pagedelta] + + mov dx,GC_INDEX + mov al,GC_READMAP // leave GC_INDEX set to READMAP + out dx,al + + mov dx,SC_INDEX+1 + mov al,1 + out dx,al + mov dx,GC_INDEX+1 + mov al,0 + out dx,al + + mov bl,[es:si] + xchg [es:di],bl + + mov dx,SC_INDEX+1 + mov al,2 + out dx,al + mov dx,GC_INDEX+1 + mov al,1 + out dx,al + + mov bl,[es:si] + xchg [es:di],bl + + mov dx,SC_INDEX+1 + mov al,4 + out dx,al + mov dx,GC_INDEX+1 + mov al,2 + out dx,al + + mov bl,[es:si] + xchg [es:di],bl + + mov dx,SC_INDEX+1 + mov al,8 + out dx,al + mov dx,GC_INDEX+1 + mov al,3 + out dx,al + + mov bl,[es:si] + xchg [es:di],bl + } + + if (rndval == 1) // entire sequence has been completed + { +//++++ VGABITMASK(255); +//++++ VGAMAPMASK(15); + return; + } + } + frame++; +//++++ while (TimeCount