Cleaned up code

This commit is contained in:
pagefault
2001-05-14 06:58:46 +00:00
parent bf1e0bd149
commit 19620b04a0

View File

@@ -302,10 +302,6 @@ LRESULT CALLBACK Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
&& (CurKeyReadPos==0)))){ && (CurKeyReadPos==0)))){
accept=false; accept=false;
// char bla[256];
// sprintf(bla,"%d",wParam);
// MessageBox(NULL,bla,"Key",MB_SYSTEMMODAL|MB_OK);
if (wParam==16) if (wParam==16)
shiftpr=true; shiftpr=true;
if (((wParam>='A') && (wParam<='Z')) || if (((wParam>='A') && (wParam<='Z')) ||
@@ -392,28 +388,6 @@ LRESULT CALLBACK Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
if(MouseInput) MouseInput->Acquire(); if(MouseInput) MouseInput->Acquire();
break; break;
/* case 0x020A:
zDelta = (short) HIWORD(wParam);
zDelta=120;
while (zDelta>0){
zDelta-=120;
if (!((CurKeyPos+1==CurKeyReadPos) || ((CurKeyPos+1==16)
&& (CurKeyReadPos==0)))){
KeyBuffer[CurKeyPos]=72+256;
CurKeyPos++;
if (CurKeyPos==16) CurKeyPos=0;
}
}
while (zDelta<0){
zDelta+=120;
if (!((CurKeyPos+1==CurKeyReadPos) || ((CurKeyPos+1==16)
&& (CurKeyReadPos==0)))){
KeyBuffer[CurKeyPos]=72+256;
CurKeyPos++;
if (CurKeyPos==16) CurKeyPos=0;
}
}
break;*/
case WM_MOVE: case WM_MOVE:
initwinvideo(); initwinvideo();
break; break;
@@ -708,7 +682,6 @@ BOOL FAR PASCAL InitJoystickInput(LPCDIDEVICEINSTANCE pdinst, LPVOID pvRef)
return DIENUM_CONTINUE; return DIENUM_CONTINUE;
} }
DIPROPRANGE diprg; DIPROPRANGE diprg;
diprg.diph.dwSize = sizeof(diprg); diprg.diph.dwSize = sizeof(diprg);
@@ -738,8 +711,6 @@ BOOL FAR PASCAL InitJoystickInput(LPCDIDEVICEINSTANCE pdinst, LPVOID pvRef)
Y2Disable[CurrentJoy]=1; Y2Disable[CurrentJoy]=1;
} }
diprg.diph.dwObj = DIJOFS_Z; diprg.diph.dwObj = DIJOFS_Z;
if(FAILED(JoystickInput[CurrentJoy]->SetProperty(DIPROP_RANGE, &diprg.diph))) if(FAILED(JoystickInput[CurrentJoy]->SetProperty(DIPROP_RANGE, &diprg.diph)))
{ {
@@ -879,7 +850,7 @@ void endgame()
void DInputError(){ void DInputError(){
char message1[256]; char message1[256];
sprintf(message1,"Error initializing DirectInput\nYou may need to install DirectX 7.0a or higher located at www.microsoft.com/directx \0"); sprintf(message1,"Error initializing DirectInput\nYou may need to install DirectX 8.0a or higher located at www.microsoft.com/directx \0");
MessageBox (NULL, message1, "DirectInput Error" , MB_ICONERROR ); MessageBox (NULL, message1, "DirectInput Error" , MB_ICONERROR );
} }
@@ -890,7 +861,7 @@ bool InitInput()
if(FAILED(hr=DirectInput8Create(hInst,DIRECTINPUT_VERSION,IID_IDirectInput8A,(void **) &DInput,NULL))) if(FAILED(hr=DirectInput8Create(hInst,DIRECTINPUT_VERSION,IID_IDirectInput8A,(void **) &DInput,NULL)))
{ {
sprintf(message1,"Error initializing DirectInput\nYou may need to install DirectX 7.0a or higher located at www.microsoft.com/directx \0"); sprintf(message1,"Error initializing DirectInput\nYou may need to install DirectX 8.0a or higher located at www.microsoft.com/directx \0");
MessageBox (NULL, message1, "DirectInput Error" , MB_ICONERROR ); MessageBox (NULL, message1, "DirectInput Error" , MB_ICONERROR );
switch(hr) switch(hr)
@@ -924,8 +895,6 @@ bool InitInput()
hr=KeyboardInput->SetDataFormat(&c_dfDIKeyboard); hr=KeyboardInput->SetDataFormat(&c_dfDIKeyboard);
if(FAILED(hr)) {DInputError();return FALSE;} if(FAILED(hr)) {DInputError();return FALSE;}
hr=KeyboardInput->SetCooperativeLevel(hMainWindow,DISCL_NONEXCLUSIVE | DISCL_FOREGROUND ); hr=KeyboardInput->SetCooperativeLevel(hMainWindow,DISCL_NONEXCLUSIVE | DISCL_FOREGROUND );
@@ -940,11 +909,10 @@ bool InitInput()
JoystickInput[0]=NULL;JoystickInput[1]=NULL;JoystickInput[2]=NULL;JoystickInput[3]=NULL; JoystickInput[0]=NULL;JoystickInput[1]=NULL;JoystickInput[2]=NULL;JoystickInput[3]=NULL;
hr=DInput->EnumDevices(DI8DEVCLASS_GAMECTRL, InitJoystickInput, hr=DInput->EnumDevices(DI8DEVCLASS_GAMECTRL, InitJoystickInput,
DInput, DIEDFL_ATTACHEDONLY); DInput, DIEDFL_ATTACHEDONLY);
if(FAILED(hr)) {DInputError();return FALSE;}
if(FAILED(hr)) {DInputError(); return FALSE;}
InputAcquire(); InputAcquire();
@@ -969,7 +937,6 @@ void TestJoy()
if(FAILED(IDirectInputDevice8_GetDeviceState(JoystickInput[i],sizeof(DIJOYSTATE), &js[i]))) return; if(FAILED(IDirectInputDevice8_GetDeviceState(JoystickInput[i],sizeof(DIJOYSTATE), &js[i]))) return;
} }
if(!X1Disable[i]) if(!X1Disable[i])
{ {
if(js[i].lX>0) X1Disable[i]=1; if(js[i].lX>0) X1Disable[i]=1;
@@ -1194,7 +1161,6 @@ unsigned char Noise[]={ 27,232,234,138,187,246,176,81,25,241,1,127,154,190,195,1
93,75,83,238,104,238,131,70,22,252,180,82,110,123,106,133,183,209,48,230, 93,75,83,238,104,238,131,70,22,252,180,82,110,123,106,133,183,209,48,230,
157,205,27,21,107,63,85,164}; 157,205,27,21,107,63,85,164};
int X, Y; int X, Y;
DWORD Temp1; DWORD Temp1;
MSG msg; MSG msg;
@@ -1208,8 +1174,6 @@ unsigned char Noise[]={ 27,232,234,138,187,246,176,81,25,241,1,127,154,190,195,1
DWORD SoundBufD; DWORD SoundBufD;
DWORD SoundBufD2; DWORD SoundBufD2;
DWORD T60HZEnabled=0; DWORD T60HZEnabled=0;
DWORD T36HZEnabled=0; DWORD T36HZEnabled=0;
@@ -1399,8 +1363,6 @@ void initwinvideo(void)
AdjustWindowRectEx( &rc1,GetWindowLong( hMainWindow, GWL_STYLE ), AdjustWindowRectEx( &rc1,GetWindowLong( hMainWindow, GWL_STYLE ),
GetMenu( hMainWindow ) != NULL, GetWindowLong( hMainWindow, GWL_EXSTYLE ) ); GetMenu( hMainWindow ) != NULL, GetWindowLong( hMainWindow, GWL_EXSTYLE ) );
// X=(GetSystemMetrics( SM_CXSCREEN ) - WindowWidth) / 2;
// Y=(GetSystemMetrics( SM_CYSCREEN ) - WindowHeight) / 2;
GetClientRect( hMainWindow, &rc1 ); GetClientRect( hMainWindow, &rc1 );
ClientToScreen( hMainWindow, ( LPPOINT )&rc1 ); ClientToScreen( hMainWindow, ( LPPOINT )&rc1 );
@@ -1480,7 +1442,6 @@ extern int PacketCounter;
extern int CounterA; extern int CounterA;
extern int CounterB; extern int CounterB;
void CheckTimers(void) void CheckTimers(void)
{ {
QueryPerformanceCounter((LARGE_INTEGER*)&end2); QueryPerformanceCounter((LARGE_INTEGER*)&end2);
@@ -1730,7 +1691,6 @@ void drawscreenwin(void)
add esi,576 add esi,576
cmp eax,223 cmp eax,223
jne Copying3 jne Copying3
xor eax,eax xor eax,eax
mov ecx,128 mov ecx,128
rep stosd rep stosd
@@ -1755,7 +1715,6 @@ void drawscreenwin(void)
add esi,576 add esi,576
cmp eax,223 cmp eax,223
jne Copying jne Copying
xor eax,eax xor eax,eax
mov ecx,128 mov ecx,128
rep stosd rep stosd
@@ -1793,21 +1752,6 @@ void drawscreenwin(void)
jne Copying32b jne Copying32b
pop es pop es
} }
/* for(j=0;j<223;j++)
{
for(i=0;i<256;i++)
{
color32=(((*(WORD *)(ScreenPtr))&0xF800)<<8)+
(((*(WORD *)(ScreenPtr))&0x07E0)<<5)+
(((*(WORD *)(ScreenPtr))&0x001F)<<3)+0x7F000000;
SURFDW[i]=color32;
ScreenPtr+=2;
}
ScreenPtr=ScreenPtr+576-512;
SURFDW=(DWORD *) &SurfBuf[j*Temp1];
} */
SURFDW=(DWORD *) &SurfBuf[222*Temp1]; SURFDW=(DWORD *) &SurfBuf[222*Temp1];
color32=0x7F000000; color32=0x7F000000;
@@ -1901,7 +1845,6 @@ void drawscreenwin(void)
add esi,576 add esi,576
cmp ebx,223 cmp ebx,223
jne Copying2MMX jne Copying2MMX
xor eax,eax xor eax,eax
mov ecx,128 mov ecx,128
rep stosd rep stosd
@@ -1943,7 +1886,6 @@ void drawscreenwin(void)
add esi,576 add esi,576
cmp ebx,223 cmp ebx,223
jne Copying2 jne Copying2
xor eax,eax xor eax,eax
mov ecx,128 mov ecx,128
rep stosd rep stosd
@@ -2235,7 +2177,6 @@ void WinUpdateDevices()
} }
int GetMouseX(void) int GetMouseX(void)
{ {
char message1[256]; char message1[256];
@@ -2358,9 +2299,4 @@ void ZsnesPage()
ShellExecute(NULL, NULL, "http://www.zsnes.com/", NULL, NULL, 0); ShellExecute(NULL, NULL, "http://www.zsnes.com/", NULL, NULL, 0);
} }
} }