diff --git a/mall/MALL.C b/mall/MALL.C index 81ce109..b5d0f9c 100644 --- a/mall/MALL.C +++ b/mall/MALL.C @@ -16,6 +16,7 @@ #include #include "ack3d.h" #include "ackeng.h" +#include "ackext.h" #include "kit.h" #include "modplay.h" @@ -65,31 +66,9 @@ typedef struct { extern long mFactor; extern long dFactor; -extern long zdTable[VIEW_WIDTH][200]; - extern UCHAR colordat[]; -extern UINT *ObjGrid; -extern UINT *Grid; -extern UINT FloorMap[]; -extern short ViewHeight; -extern short CeilingHeight; -extern short Resolution; -extern long kduFactor; -extern long kdvFactor; -extern long kxFactor; -extern long kyFactor; -extern short tuFactor; -extern short tvFactor; -extern short rsHandle; -extern ULONG *rbaTable; -extern UCHAR *BackArray[]; -extern long *xNextTable; -extern long *yNextTable; -extern UINT *Grid; -extern long *CosTable; -extern long *SinTable; - ACKENG *ae; +ACKENG *ae; // These are the ranges used for distance shading. Will need to be modified // for the new color palette used. @@ -120,10 +99,6 @@ ColorRange ranges[64] = { - UCHAR scanCode; - UCHAR KeyPressed; - UCHAR MiniKey; - UCHAR Keys[128]; int HaveMouse; short FlashIndex; short FlashCount; @@ -156,13 +131,7 @@ ColorRange ranges[64] = { short Handw2; short Handh2; - long TimerCounter; long ObjCounter[64]; - void (__interrupt __far *oldvec)(); - void __interrupt __far myInt(); - - void (__interrupt __far *oldTimer)(); - void __interrupt __far myTimer(); short LastObjectIndex; @@ -171,7 +140,6 @@ ColorRange ranges[64] = { //----------------------------------------------------------------------------- volatile short framespersec = 0; volatile short cframes=0, count=0, ticks=0; -volatile short AckTmCount=0, AckTmDelay=0; char *ErrorMsgs[] = { "ERR_BADFILE ", @@ -198,65 +166,6 @@ volatile short AckTmCount=0, AckTmDelay=0; }; -void AckRegisterStructure(ACKENG *ae); -void AckSpeedUp(short); -void AckSlowDown(void); - -//============================================================================= -// Keyboard interrupt 9 -//============================================================================= -void __interrupt __far myInt(void) -{ - register char x; - -//oldvec(); // Use when screen captures are wanted - calls orig vector - -scanCode = inp(0x60); // read keyboard data port -x = inp(0x61); -outp(0x61, (x | 0x80)); -outp(0x61, x); -outp(0x20, 0x20); - -Keys[scanCode & 127] = 1; -KeyPressed = 1; -if (scanCode & 128) - { - Keys[scanCode & 127] = 0; - KeyPressed = 0; - } -else - MiniKey = 1; - -} - -//============================================================================= -// Timer interrupt - simply increments a counter for use in program -// Calls the old timer after X iterations have cycled so clock stays correct -//============================================================================= -void __interrupt __far myTimer(void) -{ -if (ShutDownFlag) - { - _enable(); - outp(0x20,0x20); - return; - } - -TimerCounter++; - -AckTmCount++; -if (AckTmCount > AckTmDelay) - { - oldTimer(); - AckTmCount -= AckTmDelay; - } -else - { - _enable(); - outp(0x20,0x20); - } - -} short ModSound; // 0 = Off, 1 = On short ModPort; // Port of SB card @@ -328,7 +237,7 @@ void ReadConfigFile(void) ModSound = 0; ModPort = 0x220; -ModIRQ = 7; +ModIRQ = 5; ModDMA = 1; strcpy(ModName,"MALL.MOD"); @@ -1507,7 +1416,7 @@ if (j > 0 && j != POV_PLAYER) if (ae->ObjList[j]->CurrentType == NO_WALK) { AckSetObjectType(ae,j,NO_INTERACT); - ObjCounter[j] = TimerCounter + 18 + (rand() % 120); + ObjCounter[j] = AckTimerCounter + 18 + (rand() % 120); } } @@ -1794,10 +1703,8 @@ MagAmount = MAX_MAG_AMOUNT; StrAmount = MAX_STR_AMOUNT; // Setup keyboard and timer interrupts -oldvec=_dos_getvect(KEYBD); -_dos_setvect(KEYBD,myInt); -oldTimer=_dos_getvect(8); -_dos_setvect(8,myTimer); +AckSetupKeyboard(); +AckSetupTimer(); AckTmDelay = 3; AckSpeedUp(AckTmDelay); // Set the timer interrupt at 3 times normal @@ -1822,18 +1729,18 @@ SetMouseCursor(120,160); fpos = 64; DemoFlag = 0; //if (DemoPtr != NULL) DemoFlag = 1; -TimerEnd = TimerCounter + 180; +TimerEnd = AckTimerCounter + 180; // MUST register each ACKENG structure once before use and after AckInitialize AckRegisterStructure(ae); -StartTime = TimerCounter; +StartTime = AckTimerCounter; AckBuildView(); AckDisplayScreen(); FontColorTable[0] = GetPoint(100,10); CenterString(3,"An ACK-3D Demonstration"); -EndTime = TimerCounter - StartTime; +EndTime = AckTimerCounter - StartTime; if (!EndTime) EndTime = 1; @@ -1939,14 +1846,14 @@ while (!done) { AckSetObjectType(ae,j,NO_WALK); ae->ObjList[j]->Flags &= ~OF_ANIMDONE; - ObjCounter[j] = TimerCounter + 18 + (rand() % 120); + ObjCounter[j] = AckTimerCounter + 18 + (rand() % 120); } - if (TimerCounter > ObjCounter[j]) + if (AckTimerCounter > ObjCounter[j]) { - ObjCounter[j] = TimerCounter + 180 + (rand() % 180); + ObjCounter[j] = AckTimerCounter + 180 + (rand() % 180); if (ae->ObjList[j]->CurrentType == NO_WALK) AckSetObjectType(ae,j,NO_ATTACK); else @@ -1963,7 +1870,7 @@ while (!done) CheckMonsters(); - CkStart = TimerCounter; + CkStart = AckTimerCounter; AckBuildView(); // Build floor, ceiling, and walls into ScrnBuffer #if 0 @@ -1972,19 +1879,19 @@ while (!done) switch (DemoFlag) { case 1: - if (TimerCounter > TimerEnd) + if (AckTimerCounter > TimerEnd) { DemoFlag++; - TimerEnd = TimerCounter + 540; + TimerEnd = AckTimerCounter + 540; } break; case 2: ShowBitmap(130,20,ae->ScreenBuffer,Demoht,Demowt,&DemoPtr[4]); - if (TimerCounter > TimerEnd) + if (AckTimerCounter > TimerEnd) { DemoFlag = 1; - TimerEnd = TimerCounter + 2160; + TimerEnd = AckTimerCounter + 2160; } break; @@ -2069,7 +1976,7 @@ while (!done) #endif AckDisplayScreen(); // Copy ScrnBuffer to actual video - CkEnd = TimerCounter - CkStart; + CkEnd = AckTimerCounter - CkStart; if (!CkEnd) CkEnd = 1; TurnFactor = INT_ANGLE_1 * CkEnd; @@ -2161,22 +2068,22 @@ while (!done) MoveAngle = j; } - if (Keys[ESCAPE_KEY]) + if (AckKeys[ESCAPE_KEY]) break; - if(Keys[RIGHT_ARROW_KEY]) + if(AckKeys[RIGHT_ARROW_KEY]) { Spin += 1; SpinAngle += TurnFactor; // INT_ANGLE_1 * Spin; } - if(Keys[LEFT_ARROW_KEY]) + if(AckKeys[LEFT_ARROW_KEY]) { Spin += 1; SpinAngle -= TurnFactor; // -INT_ANGLE_1 * Spin; } - if(Keys[UP_ARROW_KEY]) + if(AckKeys[UP_ARROW_KEY]) { MoveAmount += (MoveFactor + MoveHalfFactor); // 12; if (MoveAmount > MAX_AMOUNT) @@ -2184,7 +2091,7 @@ while (!done) MoveAngle = ae->PlayerAngle; } - if(Keys[DOWN_ARROW_KEY]) + if(AckKeys[DOWN_ARROW_KEY]) { j = ae->PlayerAngle + INT_ANGLE_180; if (j >= INT_ANGLE_360) @@ -2197,102 +2104,96 @@ while (!done) } -#if 0 - if (Keys[C_KEY]) + if (AckKeys[C_KEY]) { ae->SysFlags ^= SYS_SOLID_CEIL; ae->SysFlags &= ~SYS_SOLID_BACK; - Keys[C_KEY] = 0; + AckKeys[C_KEY] = 0; if ((ae->SysFlags & SYS_SOLID_CEIL) && (ResScrollBack != 0)) ae->SysFlags |= SYS_SOLID_BACK; AckRegisterStructure(ae); } - if (Keys[R_KEY]) + if (AckKeys[R_KEY]) { - Keys[R_KEY] = 0; + AckKeys[R_KEY] = 0; Resolution++; if (Resolution > 2) Resolution = 0; } - if (Keys[F_KEY]) + if (AckKeys[F_KEY]) { ae->SysFlags ^= SYS_SOLID_FLOOR; - Keys[F_KEY] = 0; + AckKeys[F_KEY] = 0; AckRegisterStructure(ae); } - if (Keys[PGUP_KEY] && ViewHeight < 60) + if (AckKeys[PGUP_KEY] && ViewHeight < 60) { ViewHeight++; CeilingHeight++; } - if (Keys[PGDN_KEY] && ViewHeight > 4) + if (AckKeys[PGDN_KEY] && ViewHeight > 4) { ViewHeight--; CeilingHeight--; } - if (Keys[NUM_1_KEY]) + if (AckKeys[NUM_1_KEY]) { - Keys[NUM_1_KEY]=0; + AckKeys[NUM_1_KEY]=0; dFactor--; } - if (Keys[NUM_2_KEY]) + if (AckKeys[NUM_2_KEY]) { - Keys[NUM_2_KEY]=0; + AckKeys[NUM_2_KEY]=0; dFactor++; } - if (Keys[MINUS_KEY]) + if (AckKeys[MINUS_KEY]) { - Keys[MINUS_KEY]=0; + AckKeys[MINUS_KEY]=0; mFactor--; } - if (Keys[PLUS_KEY]) + if (AckKeys[PLUS_KEY]) { - Keys[PLUS_KEY]=0; + AckKeys[PLUS_KEY]=0; mFactor++; } - if (Keys[I_KEY]) + if (AckKeys[I_KEY]) { - Keys[I_KEY] = 0; + AckKeys[I_KEY] = 0; InfoFlag ^= 1; } - if (Keys[B_KEY]) + if (AckKeys[B_KEY]) { - Keys[B_KEY]=0; + AckKeys[B_KEY]=0; mFactor -= 64; } - if (Keys[S_KEY]) + if (AckKeys[S_KEY]) { - Keys[S_KEY] = 0; + AckKeys[S_KEY] = 0; mFactor += 64; } -#endif } EndBGmusic(); ShutDownFlag = 1; -_disable(); AckSlowDown(); // Set the timer back to normal speed AckWrapUp(ae); AckSetTextmode(); -_dos_setvect(KEYBD,oldvec); -_dos_setvect(8,oldTimer); -_enable(); if (kbhit()) getch(); diff --git a/mall/MODPLAY.ASM b/mall/MODPLAY.ASM index 6b3fc89..e5d968f 100644 --- a/mall/MODPLAY.ASM +++ b/mall/MODPLAY.ASM @@ -21,8 +21,7 @@ global MODPlayVoice:near global MODStopVoice:near global MODSetPeriod:near global MODSetVolume:near -;;global _GETDS:near -global OurDataSeg:dword +global _GETDS:near ;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ ; EQUATES @@ -1135,11 +1134,9 @@ IRQSetVect: IRQHandler: pushad ; pushes all the registers push ds -;;; mov ax,DGROUP ; load the DS selector -;;; mov ds,ax -;;; call _GETDS - mov ax,cs:[dword ptr OurDataSeg] + mov ax,DGROUP ; load the DS selector mov ds,ax + call _GETDS mov dx,[IOAddr] ; send ack to the SB DSP chip add dx,0Eh in al,dx diff --git a/mall/makefile b/mall/makefile new file mode 100644 index 0000000..7c2e2fe --- /dev/null +++ b/mall/makefile @@ -0,0 +1,56 @@ +target_config = debug + +target_name = mall + +acklib_incdir = ..\ack_lib +acklib_lib = ..\ack_lib\acklib.lib + +object_files = & + mall.obj & + modplay.obj & + mouse.obj + + +cc_flags_debug = /d2 /zp1 /4r /fp3 /j +cc_flags_release = /d1+ /zp1 /4r /fp3 /ontx /oe=40 /j +cc_flags = /mf /i=$(acklib_incdir) $(cc_flags_$(target_config)) + +link_flags_debug = debug all +link_flags_release = debug all +link_flags = $(link_flags_$(target_config)) + +.c.obj: .AUTODEPEND + wcc386 $[. /zq $(cc_flags) + +.asm.obj: .AUTODEPEND + tasm $[. /t $(asm_flags) + +$(target_name).lnk: $(object_files) + %create $^@ + %append $^@ NAME $(target_name).exe + %append $^@ SYSTEM DOS4G + %append $^@ OPTION QUIET + %append $^@ OPTION STACK=16k + %append $^@ LIBRARY $(acklib_lib) + @for %i in ($(object_files)) do %append $^@ FILE %i + +$(target_name).exe: $(object_files) $(target_name).lnk + wlink $(link_flags) @$(target_name).lnk + +clean : .SYMBOLIC + del *.obj + del *.err + del $(target_name).exe + del $(target_name).lnk + +.NOCHECK +build : $(target_name).exe + +.NOCHECK +run : $(target_name).exe + $(target_name).exe + +.NOCHECK +debug : $(target_name).exe + wd /swap /trap=rsi $(target_name).exe +