Commit 9520fb90 authored by Steven Fuller's avatar Steven Fuller

A bit more progress

parent 2419d4f9
......@@ -2,3 +2,5 @@
id_ca.c has code for setting the extension to load files
so does wl_menu.c
* would it not make sense to remove bufferseg from id_ca.c?
* menu code is a mess, always does things differently than the rest of the
code, it really needs to be cleaned up
; ID_VL.ASM
IDEAL
MODEL MEDIUM,C
INCLUDE 'ID_VL.EQU'
SCREENSEG = 0a000h
UPDATEWIDE = 20
UPDATEHIGH = 13
DATASEG
EXTRN bufferofs :WORD
EXTRN displayofs :WORD
EXTRN ylookup :WORD
EXTRN linewidth :WORD
EXTRN blockstarts :WORD ;offsets from drawofs for each update block
EXTRN update :BYTE
CODESEG
;=================
;
; VH_UpdateScreen
;
;=================
PROC VH_UpdateScreen
PUBLIC VH_UpdateScreen
USES si,di
mov dx,SC_INDEX
mov ax,SC_MAPMASK+15*256
out dx,ax
mov dx,GC_INDEX
mov al,GC_MODE
out dx,al
inc dx
in al,dx
and al,252
or al,1
out dx,al
mov bx,UPDATEWIDE*UPDATEHIGH-1 ; bx is the tile number
mov dx,[linewidth]
;
; see if the tile needs to be copied
;
@@checktile:
test [update+bx],1
jnz @@copytile
@@next:
dec bx
jns @@checktile
;
; done
;
mov dx,GC_INDEX+1
in al,dx
and al,NOT 3
or al,0
out dx,al
ret
;
; copy a tile
;
@@copytile:
mov [update+bx],0
shl bx,1
mov si,[blockstarts+bx]
shr bx,1
mov di,si
add si,[bufferofs]
add di,[displayofs]
mov ax,SCREENSEG
mov ds,ax
REPT 16
mov al,[si]
mov [di],al
mov al,[si+1]
mov [di+1],al
mov al,[si+2]
mov [di+2],al
mov al,[si+3]
mov [di+3],al
add si,dx
add di,dx
ENDM
mov ax,ss
mov ds,ax
jmp @@next
ENDP
END
......@@ -18,15 +18,21 @@ long filelength(int handle)
return buf.st_size;
}
char *ltoa(long value, char *string, int radix)
char *itoa(short int value, char *string, int radix)
{
/* wolf3d only uses radix 10 */
sprintf(string, "%d", value);
return string;
}
char *ltoa(long value, char *string, int radix)
{
sprintf(string, "%ld", value);
return string;
}
char *ultoa(unsigned long value, char *string, int radix)
{
sprintf(string, "%u", value);
sprintf(string, "%lu", value);
return string;
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ extern char **_argv;
long filelength(int handle);
char *itoa(short int value, char *string, int radix);
char *ltoa(long value, char *string, int radix);
char *ultoa(unsigned long value, char *string, int radix);
......
IDEAL
MODEL MEDIUM,C
P286
SCREENSEG = 0a000h
FINEANGLES = 3600
DEG90 = 900
DEG180 = 1800
DEG270 = 2700
DEG360 = 3600
OP_JLE = 07eh
OP_JGE = 07dh
EXTRN finetangent:DWORD ; far array, starts at offset 0
EXTRN HitHorizWall:FAR
EXTRN HitVertWall:FAR
EXTRN HitHorizDoor:FAR
EXTRN HitVertDoor:FAR
EXTRN HitHorizPWall:FAR
EXTRN HitVertPWall:FAR
DATASEG
EXTRN viewwidth:WORD
EXTRN tilemap:BYTE
EXTRN spotvis:BYTE
EXTRN pixelangle:WORD
EXTRN midangle:WORD
EXTRN angle:WORD
EXTRN focaltx:WORD
EXTRN focalty:WORD
EXTRN viewtx:WORD
EXTRN viewty:WORD
EXTRN viewx:DWORD
EXTRN viewy:DWORD
EXTRN xpartialup:WORD
EXTRN ypartialup:WORD
EXTRN xpartialdown:WORD
EXTRN ypartialdown:WORD
EXTRN tilehit:WORD
EXTRN pixx:WORD
EXTRN wallheight:WORD ; array of VIEWWIDTH entries
EXTRN xtile:WORD
EXTRN ytile:WORD
EXTRN xtilestep:WORD
EXTRN ytilestep:WORD
EXTRN xintercept:DWORD
EXTRN yintercept:DWORD
EXTRN xstep:DWORD
EXTRN ystep:DWORD
EXTRN doorposition:WORD ; table of door position values
EXTRN pwallpos:WORD ; amound a pushable wall has been moved
CODESEG
;-------------------
;
; xpartialbyystep
;
; multiplies long [ystep] (possibly negative), by word [xpartial] (in BX)
;
; returns dx:ax
; trashes bx,cx,di
;
;-------------------
PROC xpartialbyystep NEAR
;
; setup
;
mov ax,[WORD ystep]
mov cx,[WORD ystep+2]
or cx,cx ; is ystep negatice?
jns @@multpos
;
; multiply negative cx:ax by bx
;
neg cx
neg ax
sbb cx,0
mul bx ; fraction*fraction
mov di,dx ; di is low word of result
mov ax,cx ;
mul bx ; units*fraction
add ax,di
adc dx,0
neg dx
neg ax
sbb dx,0
ret
;
; multiply positive cx:ax by bx
;
EVEN
@@multpos:
mul bx ; fraction*fraction
mov di,dx ; di is low word of result
mov ax,cx ;
mul bx ; units*fraction
add ax,di
adc dx,0
ret
ENDP
;-------------------
;
; ypartialbyxstep
;
; multiplies long [xstep] (possibly negative), by word [ypartial] (in BP)
;
; returns dx:ax
; trashes cx,di,bp
;
;-------------------
PROC ypartialbyxstep NEAR
;
; setup
;
mov ax,[WORD xstep]
mov cx,[WORD xstep+2]
or cx,cx ; is ystep negatice?
jns @@multpos
;
; multiply negative cx:ax by bx
;
neg cx
neg ax
sbb cx,0
mul bp ; fraction*fraction
mov di,dx ; di is low word of result
mov ax,cx ;
mul bp ; units*fraction
add ax,di
adc dx,0
neg dx
neg ax
sbb dx,0
ret
;
; multiply positive cx:ax by bx
;
EVEN
@@multpos:
mul bp ; fraction*fraction
mov di,dx ; di is low word of result
mov ax,cx ;
mul bp ; units*fraction
add ax,di
adc dx,0
ret
ENDP
;============================
;
; AsmRefresh
;
;
;============================
PROC AsmRefresh
PUBLIC AsmRefresh
push si
push di
push bp
mov [pixx],0
;---------------------------------------------------------------------------
;
; Setup to trace a ray through pixx view pixel
;
; CX : angle of the ray through pixx
; ES : points to segment of finetangent array for this block of code
;
; Upon entrance to initialize block
;
; BX : xpartial
; BP : ypartial
;
;---------------------------------------------------------------------------
EVEN
pixxloop:
mov ax,SEG finetangent
mov es,ax
mov cx,[midangle] ; center of view area
mov bx,[pixx]
shl bx,1
add cx,[pixelangle+bx] ; delta for this pixel
cmp cx,0
jge not0
;----------
;
; -90 - -1 degree arc
;
;----------
add cx,FINEANGLES ; -90 is the same as 270
jmp entry360
not0:
cmp cx,DEG90
jge not90
;----------
;
; 0-89 degree arc
;
;----------
entry90:
mov [xtilestep],1 ; xtilestep = 1
mov [ytilestep],-1 ; ytilestep = -1
mov [BYTE cs:horizop],OP_JGE ; patch a jge in
mov [BYTE cs:vertop],OP_JLE ; patch a jle in
mov bx,DEG90-1
sub bx,cx
shl bx,2
mov ax,[es:bx]
mov dx,[es:bx+2]
mov [WORD xstep],ax
mov [WORD xstep+2],dx ; xstep = finetangent[DEG90-1-angle]
mov bx,cx
shl bx,2
mov ax,[es:bx]
mov dx,[es:bx+2]
neg dx
neg ax
sbb dx,0
mov [WORD ystep],ax
mov [WORD ystep+2],dx ; ystep = -finetangent[angle]
mov bx,[xpartialup] ; xpartial = xpartialup
mov bp,[ypartialdown] ; ypartial = ypartialdown
jmp initvars
not90:
cmp cx,DEG180
jge not180
;----------
;
; 90-179 degree arc
;
;----------
mov ax,-1
mov [xtilestep],ax ; xtilestep = -1
mov [ytilestep],ax ; ytilestep = -1
mov [BYTE cs:horizop],OP_JLE ; patch a jle in
mov [BYTE cs:vertop],OP_JLE ; patch a jle in
mov bx,cx
shl bx,2
mov ax,[es:bx-DEG90*4]
mov dx,[es:bx+2-DEG90*4]
neg dx
neg ax
sbb dx,0
mov [WORD xstep],ax
mov [WORD xstep+2],dx ; xstep = -finetangent[angle-DEG90]
mov bx,DEG180-1
sub bx,cx
shl bx,2
mov ax,[es:bx]
mov dx,[es:bx+2]
neg dx
neg ax
sbb dx,0
mov [WORD ystep],ax
mov [WORD ystep+2],dx ; ystep = -finetangent[DEG180-1-angle]
mov bx,[xpartialdown] ; xpartial = xpartialdown
mov bp,[ypartialdown] ; ypartial = ypartialdown
jmp initvars
not180:
cmp cx,DEG270
jge not270
;----------
;
; 180-269 degree arc
;
;----------
mov [xtilestep],-1 ; xtilestep = -1
mov [ytilestep],1 ; ytilestep = 1
mov [BYTE cs:horizop],OP_JLE ; patch a jle in
mov [BYTE cs:vertop],OP_JGE ; patch a jge in
mov bx,DEG270-1
sub bx,cx
shl bx,2
mov ax,[es:bx]
mov dx,[es:bx+2]
neg dx
neg ax
sbb dx,0
mov [WORD xstep],ax
mov [WORD xstep+2],dx ; xstep = -finetangent[DEG270-1-angle]
mov bx,cx
shl bx,2
mov ax,[es:bx-DEG180*4]
mov dx,[es:bx+2-DEG180*4]
mov [WORD ystep],ax
mov [WORD ystep+2],dx ; ystep = finetangent[angle-DEG180]
mov bx,[xpartialdown] ; xpartial = xpartialdown
mov bp,[ypartialup] ; ypartial = ypartialup
jmp initvars
not270:
cmp cx,DEG360
jge not360
;----------
;
; 270-359 degree arc
;
;----------
entry360:
mov ax,1
mov [xtilestep],ax ; xtilestep = 1
mov [ytilestep],ax ; ytilestep = 1
mov [BYTE cs:horizop],OP_JGE ; patch a jge in
mov [BYTE cs:vertop],OP_JGE ; patch a jge in
mov bx,cx
shl bx,2
mov ax,[es:bx-DEG270*4]
mov dx,[es:bx+2-DEG270*4]
mov [WORD xstep],ax
mov [WORD xstep+2],dx ; xstep = finetangent[angle-DEG270]
mov bx,DEG360-1
sub bx,cx
shl bx,2
mov ax,[es:bx]
mov dx,[es:bx+2]
mov [WORD ystep],ax
mov [WORD ystep+2],dx ; ystep = finetangent[DEG360-1-angle]
mov bx,[xpartialup] ; xpartial = xpartialup
mov bp,[ypartialup] ; ypartial = ypartialup
jmp initvars
not360:
;----------
;
; 360-449 degree arc
;
;----------
sub cx,FINEANGLES ; -449 is the same as 89
jmp entry90
;---------------------------------------------------------------------------
;
; initialise variables for intersection testing
;
;---------------------------------------------------------------------------
initvars:
call NEAR xpartialbyystep ; xpartial is in BX
add ax,[WORD viewy]
adc dx,[WORD viewy+2]
mov [WORD yintercept],ax
mov [WORD yintercept+2],dx
mov si,[focaltx]
add si,[xtilestep]
mov [xtile],si ; xtile = focaltx+xtilestep
shl si,6
add si,dx ; xspot = (xtile<<6) + yinttile
call NEAR ypartialbyxstep ; ypartial is in BP
add ax,[WORD viewx]
adc dx,[WORD viewx+2]
mov [WORD xintercept],ax
mov cx,dx
mov bx,[focalty]
add bx,[ytilestep]
mov bp,bx ; ytile = focalty+ytilestep
mov di,dx
shl di,6
add di,bx ; yspot = (xinttile<<6) + ytile
mov bx,[xtile]
mov dx,[WORD yintercept+2]
mov ax,SCREENSEG
mov es,ax ; faster than mov es,[screenseg]
;---------------------------------------------------------------------------
;
; trace along this angle until we hit a wall
;
; CORE LOOP!
;
; All variables are killed when a wall is hit
;
; AX : scratch
; BX : xtile
; CX : high word of xintercept
; DX : high word of yintercept
; SI : xspot (yinttile<<6)+xtile (index into tilemap and spotvis)
; DI : yspot (xinttile<<6)+ytile (index into tilemap and spotvis)
; BP : ytile
; ES : screenseg
;
;---------------------------------------------------------------------------
;-----------
;
; check intersections with vertical walls
;
;-----------
EVEN
vertcheck:
cmp dx,bp
vertop: ; 0x7e = jle (ytilestep==-1)
jle horizentry ; 0x7d = jge (ytilestep==1)
vertentry:
test [BYTE tilemap+si],0ffh ; tilehit = *((byte *)tilemap+xspot);
jnz hitvert
passvert:
mov [BYTE spotvis+si],1 ; *((byte *)spotvis+xspot) = true;
add bx,[xtilestep] ; xtile+=xtilestep
mov ax,[WORD ystep]
add [WORD yintercept],ax ; yintercept += ystep
adc dx,[WORD ystep+2]
mov si,bx
shl si,6
add si,dx ; xspot = (xtile<<6)+yinttile
jmp vertcheck
EVEN
hitvert:
mov al,[BYTE tilemap+si] ; tilehit = *((byte *)tilemap+xspot);
mov [BYTE tilehit],al
or al,al ; set flags
jns notvertdoor
jmp vertdoor
notvertdoor:
mov [WORD xintercept],0
mov [WORD xintercept+2],bx
mov [xtile],bx
mov [WORD yintercept+2],dx
mov [ytile],dx
call FAR HitVertWall
jmp nextpix
;-----------
;
; check intersections with horizontal walls
;
;-----------
EVEN
horizcheck:
cmp cx,bx
horizop: ; 0x7e = jle (xtilestep==-1)
jle vertentry ; 0x7d = jge (xtilestep==1)
horizentry:
test [BYTE tilemap+di],0ffh ; tilehit = *((byte *)tilemap+yspot);
jnz hithoriz
passhoriz:
mov [BYTE spotvis+di],1 ; *((byte *)spotvis+yspot) = true;
add bp,[ytilestep] ; ytile+=ytilestep
mov ax,[WORD xstep]
add [WORD xintercept],ax ; xintercept += xstep
adc cx,[WORD xstep+2]
mov di,cx
shl di,6
add di,bp ; yspot = (xinttile<<6)+ytile
jmp horizcheck
EVEN
hithoriz:
mov al,[BYTE tilemap+di] ; tilehit = *((byte *)tilemap+yspot);
mov [BYTE tilehit],al
or al,al ; set flags
js horizdoor
mov [WORD xintercept+2],cx
mov [xtile],cx
mov [WORD yintercept],0
mov [WORD yintercept+2],bp
mov [ytile],bp
call FAR HitHorizWall
jmp nextpix
;---------------------------------------------------------------------------
;
; next pixel over
;
;---------------------------------------------------------------------------
nextpix:
mov ax,[pixx]
inc ax
mov [pixx],ax
cmp ax,[viewwidth]
jge done
jmp pixxloop
done:
pop bp
pop di
pop si
retf
;===========================================================================
;=============
;
; hit a special horizontal wall, so find which coordinate a door would be
; intersected at, and check to see if the door is open past that point
;
;=============
horizdoor:
mov [xtile],bx ; save off live register variables
mov [WORD yintercept+2],dx
test al,040h ; both high bits set == pushable wall
jnz horizpushwall
mov bx,ax
and bx,7fh ; strip high bit
shl bx,1 ; index into word width door table
mov ax,[WORD xstep]
mov dx,[WORD xstep+2]
sar dx,1
rcr ax,1 ; half a step gets to door position
add ax,[WORD xintercept] ; add half step to current intercept pos
adc dx,cx ; CX hold high word of xintercept
cmp cx,dx ; is it still in the same tile?
je hithmid
;
; midpoint is outside tile, so it hit the side of the wall before a door
;
continuehoriz:
mov bx,[xtile] ; reload register variables
mov dx,[WORD yintercept+2]
jmp passhoriz ; continue tracing
;
; the trace hit the door plane at pixel position AX, see if the door is
; closed that much
;
hithmid:
cmp ax,[doorposition+bx] ; position of leading edge of door
jb continuehoriz
;
; draw the door
;
mov [WORD xintercept],ax ; save pixel intercept position
mov [WORD xintercept+2],cx
mov [WORD yintercept],8000h ; intercept in middle of tile
mov [WORD yintercept+2],bp
call FAR HitHorizDoor
jmp nextpix
;============
;
; hit a sliding horizontal wall
;
;============
horizpushwall:
mov ax,[WORD xstep+2] ; multiply xstep by pwallmove (0-63)
mul [pwallpos]
mov bx,ax
mov ax,[WORD xstep]
mul [pwallpos]
add dx,bx
sar dx,1 ; then divide by 64 to accomplish a
rcr ax,1 ; fixed point multiplication
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
add ax,[WORD xintercept] ; add partial step to current intercept
adc dx,cx ; CX hold high word of xintercept
cmp cx,dx ; is it still in the same tile?
jne continuehoriz ; no, it hit the side
;
; draw the pushable wall at the new height
;
mov [WORD xintercept],ax ; save pixel intercept position
mov [WORD xintercept+2],dx
mov [WORD yintercept+2],bp
mov [WORD yintercept],0
call FAR HitHorizPWall
jmp nextpix
;===========================================================================
;=============
;
; hit a special vertical wall, so find which coordinate a door would be
; intersected at, and check to see if the door is open past that point
;
;=============
vertdoor:
mov [xtile],bx ; save off live register variables
mov [WORD yintercept+2],dx
test al,040h ; both high bits set == pushable wall
jnz vertpushwall
mov bx,ax
and bx,7fh ; strip high bit
shl bx,1 ; index into word width doorposition
mov ax,[WORD ystep]
mov dx,[WORD ystep+2]
sar dx,1
rcr ax,1 ; half a step gets to door position
add ax,[WORD yintercept] ; add half step to current intercept pos
adc dx,[WORD yintercept+2]
cmp [WORD yintercept+2],dx ; is it still in the same tile?
je hitvmid
;
; midpoint is outside tile, so it hit the side of the wall before a door
;
continuevert:
mov bx,[xtile] ; reload register variables
mov dx,[WORD yintercept+2]
jmp passvert ; continue tracing
;
; the trace hit the door plane at pixel position AX, see if the door is
; closed that much
;
hitvmid:
cmp ax,[doorposition+bx] ; position of leading edge of door
jb continuevert
;
; draw the door
;
mov [WORD yintercept],ax ; save pixel intercept position
mov [WORD xintercept],8000h ; intercept in middle of tile
mov ax,[xtile]
mov [WORD xintercept+2],ax
call FAR HitVertDoor
jmp nextpix
;============
;
; hit a sliding vertical wall
;
;============
vertpushwall:
mov ax,[WORD ystep+2] ; multiply ystep by pwallmove (0-63)
mul [pwallpos]
mov bx,ax
mov ax,[WORD ystep]
mul [pwallpos]
add dx,bx
sar dx,1 ; then divide by 64 to accomplish a
rcr ax,1 ; fixed point multiplication
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
add ax,[WORD yintercept] ; add partial step to current intercept
adc dx,[WORD yintercept+2]
cmp [WORD yintercept+2],dx ; is it still in the same tile?
jne continuevert ; no, it hit the side
;
; draw the pushable wall at the new height
;
mov [WORD yintercept],ax ; save pixel intercept position
mov [WORD yintercept+2],dx
mov bx,[xtile]
mov [WORD xintercept+2],bx
mov [WORD xintercept],0
call FAR HitVertPWall
jmp nextpix
ENDP
END
// WL_INTER.C
#include "WL_DEF.H"
#pragma hdrstop
/* wl_inter.c */
#include "wl_def.h"
//==========================================================================
......
......@@ -23,7 +23,7 @@ void CP_ReadThis(void);
#endif
#endif
char far endStrings[9][80]=
char endStrings[9][80]=
{
#ifndef SPEAR
{"Dost thou wish to\nleave with such hasty\nabandon?"},
......@@ -57,8 +57,7 @@ CP_iteminfo
NewEitems={NE_X,NE_Y,11,0,88},
NewItems={NM_X,NM_Y,4,2,24};
#pragma warn -sus
CP_itemtype far
CP_itemtype
MainMenu[]=
{
#ifdef JAPAN
......@@ -99,7 +98,7 @@ MainMenu[]=
#endif
},
far SndMenu[]=
SndMenu[]=
{
#ifdef JAPAN
{1,"",0},
......@@ -130,7 +129,7 @@ far SndMenu[]=
#endif
},
far CtlMenu[]=
CtlMenu[]=
{
#ifdef JAPAN
{0,"",0},
......@@ -149,10 +148,8 @@ far CtlMenu[]=
#endif
},
#pragma warn +sus
#ifndef SPEAR
far NewEmenu[]=
NewEmenu[]=
{
#ifdef JAPAN
#ifdef JAPDEMO
......@@ -225,7 +222,7 @@ far NewEmenu[]=
#endif
far NewMenu[]=
NewMenu[]=
{
#ifdef JAPAN
{1,"",0},
......@@ -240,7 +237,7 @@ far NewMenu[]=
#endif
},
far LSMenu[]=
LSMenu[]=
{
{1,"",0},
{1,"",0},
......@@ -254,7 +251,7 @@ far LSMenu[]=
{1,"",0}
},
far CusMenu[]=
CusMenu[]=
{
{1,"",0},
{0,"",0},
......@@ -307,7 +304,7 @@ static byte
"?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",
"?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?"
}, // DEBUG - consolidate these
far ExtScanCodes[] = // Scan codes with >1 char names
ExtScanCodes[] = // Scan codes with >1 char names
{
1,0xe,0xf,0x1d,0x2a,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,
0x3f,0x40,0x41,0x42,0x43,0x44,0x57,0x59,0x46,0x1c,0x36,
......@@ -707,10 +704,7 @@ int CP_CheckQuick(unsigned scancode)
playstate = ex_abort;
lasttimecount = TimeCount;
if (MousePresent)
Mouse(MDelta); // Clear accumulated mouse movement
PM_CheckMainMem ();
#ifndef SPEAR
UNCACHEGRCHUNK(C_CURSOR1PIC);
......@@ -781,8 +775,6 @@ int CP_CheckQuick(unsigned scancode)
lasttimecount = TimeCount;
if (MousePresent)
Mouse(MDelta); // Clear accumulated mouse movement
PM_CheckMainMem ();
#ifndef SPEAR
......@@ -1546,7 +1538,7 @@ int CP_SaveGame(int quick)
strcpy(input,&SaveGameNames[which][0]);
_dos_write(handle,(void far *)input,32,&nwritten);
nwritten = write(handle,(void *)input,32);
lseek(handle,32,SEEK_SET);
SaveTheGame(handle,0,0);
close(handle);
......@@ -1605,7 +1597,7 @@ int CP_SaveGame(int quick)
unlink(name);
handle=creat(name,S_IREAD|S_IWRITE);
_dos_write(handle,(void far *)input,32,&nwritten);
nwritten = write(handle,(void *)input,32);
lseek(handle,32,SEEK_SET);
DrawLSAction(1);
......@@ -1768,8 +1760,6 @@ void CP_Control(void)
{
case MOUSEENABLE:
mouseenabled^=1;
_CX=_DX=CENTER;
Mouse(4);
DrawCtlScreen();
CusItems.curpos=-1;
ShootSnd();
......@@ -1777,14 +1767,10 @@ void CP_Control(void)
case JOYENABLE:
joystickenabled^=1;
if (joystickenabled)
if (!CalibrateJoystick())
joystickenabled = 0;
DrawCtlScreen();
CusItems.curpos=-1;
ShootSnd();
break;
case USEPORT2:
joystickport^=1;
DrawCtlScreen();
......@@ -2212,8 +2198,7 @@ void EnterCtrlData(int index,CustomCtrls *cust,void (*DrawRtn)(int),void (*Print
switch(type)
{
case MOUSE:
Mouse(3);
button=_BX;
button = 0; /* TODO */
switch(button)
{
case 1: result=1; break;
......@@ -2868,75 +2853,6 @@ void CP_Quit(void)
////////////////////////////////////////////////////////////////////
void IntroScreen(void)
{
#ifdef SPEAR
#define MAINCOLOR 0x4f
#define EMSCOLOR 0x4f
#define XMSCOLOR 0x4f
#else
#define MAINCOLOR 0x6c
#define EMSCOLOR 0x6c
#define XMSCOLOR 0x6c
#endif
#define FILLCOLOR 14
long memory,emshere,xmshere;
int i,num,ems[10]={100,200,300,400,500,600,700,800,900,1000},
xms[10]={100,200,300,400,500,600,700,800,900,1000},
main[10]={32,64,96,128,160,192,224,256,288,320};
//
// DRAW MAIN MEMORY
//
memory=(1023l+mminfo.nearheap+mminfo.farheap)/1024l;
for (i=0;i<10;i++)
if (memory>=main[i])
VWB_Bar(49,163-8*i,6,5,MAINCOLOR-i);
//
// DRAW EMS MEMORY
//
if (EMSPresent)
{
emshere=4l*EMSPagesAvail;
for (i=0;i<10;i++)
if (emshere>=ems[i])
VWB_Bar(89,163-8*i,6,5,EMSCOLOR-i);
}
//
// DRAW XMS MEMORY
//
if (XMSPresent)
{
xmshere=4l*XMSPagesAvail;
for (i=0;i<10;i++)
if (xmshere>=xms[i])
VWB_Bar(129,163-8*i,6,5,XMSCOLOR-i);
}
//
// FILL BOXES
//
if (MousePresent)
VWB_Bar(164,82,12,2,FILLCOLOR);
if (JoysPresent[0] || JoysPresent[1])
VWB_Bar(164,105,12,2,FILLCOLOR);
if (AdLibPresent && !SoundBlasterPresent)
VWB_Bar(164,128,12,2,FILLCOLOR);
if (SoundBlasterPresent)
VWB_Bar(164,151,12,2,FILLCOLOR);
if (SoundSourcePresent)
VWB_Bar(164,174,12,2,FILLCOLOR);
}
......@@ -3059,12 +2975,6 @@ void SetupControlPanel(void)
strcpy(&SaveGameNames[which][0],temp);
}
} while(!findnext(&f));
//
// CENTER MOUSE
//
_CX=_DX=CENTER;
Mouse(4);
}
......@@ -3090,7 +3000,7 @@ void CleanupControlPanel(void)
// Handle moving gun around a menu
//
////////////////////////////////////////////////////////////////////
int HandleMenu(CP_iteminfo *item_i,CP_itemtype far *items,void (*routine)(int w))
int HandleMenu(CP_iteminfo *item_i,CP_itemtype *items,void (*routine)(int w))
{
char key;
static int redrawitem=1,lastitem=-1;
......@@ -3336,7 +3246,7 @@ int HandleMenu(CP_iteminfo *item_i,CP_itemtype far *items,void (*routine)(int w)
//
// ERASE GUN & DE-HIGHLIGHT STRING
//
void EraseGun(CP_iteminfo *item_i,CP_itemtype far *items,int x,int y,int which)
void EraseGun(CP_iteminfo *item_i,CP_itemtype *items,int x,int y,int which)
{
VWB_Bar(x-1,y,25,16,BKGDCOLOR);
SetTextColor(items+which,0);
......@@ -3364,7 +3274,7 @@ void DrawHalfStep(int x,int y)
//
// DRAW GUN AT NEW POSITION
//
void DrawGun(CP_iteminfo *item_i,CP_itemtype far *items,int x,int *y,int which,int basey,void (*routine)(int w))
void DrawGun(CP_iteminfo *item_i,CP_itemtype *items,int x,int *y,int which,int basey,void (*routine)(int w))
{
VWB_Bar(x-1,*y,25,16,BKGDCOLOR);
*y=basey+which*13;
......@@ -3407,7 +3317,7 @@ void TicDelay(int count)
// Draw a menu
//
////////////////////////////////////////////////////////////////////
void DrawMenu(CP_iteminfo *item_i,CP_itemtype far *items)
void DrawMenu(CP_iteminfo *item_i,CP_itemtype *items)
{
int i,which=item_i->curpos;
......@@ -3441,7 +3351,7 @@ void DrawMenu(CP_iteminfo *item_i,CP_itemtype far *items)
// SET TEXT COLOR (HIGHLIGHT OR NO)
//
////////////////////////////////////////////////////////////////////
void SetTextColor(CP_itemtype far *items,int hlight)
void SetTextColor(CP_itemtype *items,int hlight)
{
if (hlight)
{SETFONTCOLOR(color_hlite[items->active],BKGDCOLOR);}
......@@ -3477,96 +3387,14 @@ void ReadAnyControl(ControlInfo *ci)
{
int mouseactive=0;
IN_ReadControl(0,ci);
if (mouseenabled)
{
int mousey,mousex;
// READ MOUSE MOTION COUNTERS
// RETURN DIRECTION
// HOME MOUSE
// CHECK MOUSE BUTTONS
Mouse(3);
mousex=_CX;
mousey=_DX;
if (mousey<CENTER-SENSITIVE)
{
ci->dir=dir_North;
_CX=_DX=CENTER;
Mouse(4);
mouseactive=1;
}
else
if (mousey>CENTER+SENSITIVE)
{
ci->dir=dir_South;
_CX=_DX=CENTER;
Mouse(4);
mouseactive=1;
}
if (mousex<CENTER-SENSITIVE)
{
ci->dir=dir_West;
_CX=_DX=CENTER;
Mouse(4);
mouseactive=1;
}
else
if (mousex>CENTER+SENSITIVE)
{
ci->dir=dir_East;
_CX=_DX=CENTER;
Mouse(4);
mouseactive=1;
}
if (IN_MouseButtons())
{
ci->button0=IN_MouseButtons()&1;
ci->button1=IN_MouseButtons()&2;
ci->button2=IN_MouseButtons()&4;
ci->button3=false;
mouseactive=1;
}
}
if (joystickenabled && !mouseactive)
{
int jx,jy,jb;
INL_GetJoyDelta(joystickport,&jx,&jy);
if (jy<-SENSITIVE)
ci->dir=dir_North;
else
if (jy>SENSITIVE)
ci->dir=dir_South;
if (jx<-SENSITIVE)
ci->dir=dir_West;
else
if (jx>SENSITIVE)
ci->dir=dir_East;
jb=IN_JoyButtons();
if (jb)
{
ci->button0=jb&1;
ci->button1=jb&2;
if (joypadenabled)
{
ci->button2=jb&4;
ci->button3=jb&8;
}
else
ci->button2=ci->button3=false;
}
}
}
......@@ -3576,7 +3404,7 @@ void ReadAnyControl(ControlInfo *ci)
// DRAW DIALOG AND CONFIRM YES OR NO TO QUESTION
//
////////////////////////////////////////////////////////////////////
int Confirm(char far *string)
int Confirm(char *string)
{
int xit=0,i,x,y,tick=0,time,whichsnd[2]={ESCPRESSEDSND,SHOOTSND};
......@@ -3708,7 +3536,7 @@ int GetYorN(int x,int y,int pic)
// PRINT A MESSAGE IN A WINDOW
//
////////////////////////////////////////////////////////////////////
void Message(char far *string)
void Message(char *string)
{
int h=0,w=0,mw=0,i,x,y,time;
fontstruct *font;
......@@ -3764,13 +3592,8 @@ void StartCPMusic(int song)
MM_BombOnError (false);
CA_CacheAudioChunk(STARTMUSIC + chunk);
MM_BombOnError (true);
if (mmerror)
mmerror = false;
else
{
MM_SetLock(&((memptr)audiosegs[STARTMUSIC + chunk]),true);
SD_StartMusic((MusicGroup far *)audiosegs[STARTMUSIC + chunk]);
}
MM_SetLock((memptr *)&(audiosegs[STARTMUSIC + chunk]),true);
SD_StartMusic((MusicGroup *)audiosegs[STARTMUSIC + chunk]);
}
void FreeMusic (void)
......@@ -3786,11 +3609,10 @@ void FreeMusic (void)
// specified scan code
//
///////////////////////////////////////////////////////////////////////////
byte *
IN_GetScanName(ScanCode scan)
byte *IN_GetScanName(ScanCode scan)
{
byte **p;
ScanCode far *s;
ScanCode *s;
for (s = ExtScanCodes,p = ExtScanNames;*s;p++,s++)
if (*s == scan)
......@@ -3878,11 +3700,11 @@ void CheckForEpisodes(void)
if (!findfirst("*.WJ1",&f,FA_ARCH))
{
strcpy(extension,"WJ1");
#else
#else /* JAPDEMO */
if (!findfirst("*.WJ6",&f,FA_ARCH))
{
strcpy(extension,"WJ6");
#endif
#endif /* JAPDEMO */
strcat(configname,extension);
strcat(SaveName,extension);
strcat(PageFileName,extension);
......@@ -3894,7 +3716,7 @@ void CheckForEpisodes(void)
}
else
Quit("NO JAPANESE WOLFENSTEIN 3-D DATA FILES to be found!");
#else
#else /* JAPAN */
//
// ENGLISH
......@@ -3925,8 +3747,8 @@ void CheckForEpisodes(void)
EpisodeSelect[2] = 1;
}
else
#endif
#endif
#endif /* SPEAR */
#endif /* UPLOAD */
......@@ -3938,25 +3760,27 @@ void CheckForEpisodes(void)
}
else
Quit("NO SPEAR OF DESTINY DATA FILES TO BE FOUND!");
#else
#else /* SPEARDEMO */
if (!findfirst("*.SDM",&f,FA_ARCH))
{
strcpy(extension,"SDM");
}
else
Quit("NO SPEAR OF DESTINY DEMO DATA FILES TO BE FOUND!");
#endif
#endif /* SPEARDEMO */
#else
#else /* SPEAR */
if (!findfirst("*.WL1",&f,FA_ARCH))
{
strcpy(extension,"WL1");
}
else
Quit("NO WOLFENSTEIN 3-D DATA FILES to be found!");
#endif
#endif /* SPEAR */
#endif /* JAPAN */
strcat(configname,extension);
strcat(SaveName,extension);
strcat(PageFileName,extension);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment