git-svn-id: https://svn.eduke32.com/eduke32@1631 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2010-05-05 07:31:38 +00:00
parent cda6330cc2
commit e1649b9d0b
6 changed files with 79 additions and 193 deletions

View file

@ -24,7 +24,7 @@ $(OBJ)/osd.$o: $(SRC)/osd.c $(INC)/build.h $(INC)/osd.h $(INC)/compat.h $(INC)/b
$(OBJ)/pragmas.$o: $(SRC)/pragmas.c $(INC)/compat.h
$(OBJ)/scriptfile.$o: $(SRC)/scriptfile.c $(INC)/scriptfile.h $(INC)/cache1d.h $(INC)/compat.h
$(OBJ)/sdlayer.$o: $(SRC)/sdlayer.c $(INC)/compat.h $(INC)/sdlayer.h $(INC)/baselayer.h $(INC)/cache1d.h $(INC)/pragmas.h $(INC)/a.h $(INC)/build.h $(INC)/osd.h $(INC)/glbuild.h
$(OBJ)/winlayer.$o: $(SRC)/winlayer.c $(INC)/compat.h $(INC)/winlayer.h $(INC)/baselayer.h $(INC)/pragmas.h $(INC)/build.h $(INC)/a.h $(INC)/osd.h $(INC)/dxdidf.h $(INC)/glbuild.h
$(OBJ)/winlayer.$o: $(SRC)/winlayer.c $(INC)/compat.h $(INC)/winlayer.h $(INC)/baselayer.h $(INC)/pragmas.h $(INC)/build.h $(INC)/a.h $(INC)/osd.h $(INC)/dxdidf.h $(INC)/glbuild.h $(INC)/rawinput.h
$(OBJ)/gtkbits.$o: $(SRC)/gtkbits.c $(INC)/baselayer.h $(INC)/build.h $(INC)/dynamicgtk.h
$(OBJ)/dynamicgtk.$o: $(SRC)/dynamicgtk.c $(INC)/dynamicgtk.h
$(OBJ)/polymer.$o: $(SRC)/polymer.c $(INC)/polymer.h $(INC)/compat.h $(INC)/build.h $(INC)/glbuild.h $(INC)/osd.h $(INC)/pragmas.h $(INC)/mdsprite.h $(INC)/polymost.h

View file

@ -4,11 +4,6 @@
#include "compat.h"
void RI_PollDevices();
uint8_t RI_MouseState( uint8_t Button );
int8_t RI_WheelState();
int32_t RI_CaptureInput(int32_t grab, HWND target);
#ifndef VK_LBUTTON
@ -24,11 +19,5 @@ int32_t RI_CaptureInput(int32_t grab, HWND target);
#define VK_MBUTTON 0x04 /* NOT contiguous with L & RBUTTON */
#endif
// mouse states for RI_MouseState
#define BUTTON_PRESSED 0x01
#define BUTTON_RELEASED 0x02
#define BUTTON_HELD 0x03
#endif // rawinput_h__

View file

@ -7,9 +7,7 @@
#include "build.h"
static BOOL init_done = 0;
static uint8_t KeyboardState[256] = {0};
static uint8_t MouseState0[5] = {0};
static uint8_t MouseState1[5] = {0};
static uint8_t KeyboardState[256] = {0}; // VKeys
static int8_t MWheel = 0;
extern volatile uint8_t moustat, mousegrab;
@ -18,14 +16,12 @@ extern void SetKey(int32_t key, int32_t state);
#define MASK_DOWN (1<<(i<<1))
#define MASK_UP (MASK_DOWN<<1)
#define MouseWheelFakePressTime 50
#ifndef GET_RAWINPUT_CODE_WPARAM
#define GET_RAWINPUT_CODE_WPARAM(wParam) ((wParam) & 0xff)
#define GET_RAWINPUT_CODE_WPARAM(wParam) ((wParam) & 0xff)
#endif
void RI_ProcessMouse(const RAWMOUSE* rmouse)
static inline void RI_ProcessMouse(const RAWMOUSE* rmouse)
{
int32_t i, mask;
@ -48,20 +44,16 @@ void RI_ProcessMouse(const RAWMOUSE* rmouse)
for (i = 0, mask = 1; i < 4; i++)
{
MouseState1[i] = MouseState0[i];
if (rmouse->usButtonFlags & mask) // button down
{
MouseState1[i] = 1;
if (mousepresscallback)
mousepresscallback(i, MouseState1[i]);
mousepresscallback(i, 1);
mouseb |= 1<<i;
}
else if (rmouse->usButtonFlags & (mask<<1)) // button up
{
MouseState1[i] = 0;
if (mousepresscallback)
mousepresscallback(i, MouseState1[i]);
mousepresscallback(i, 0);
mouseb &= ~(1<<i);
}
mask <<= 2;
@ -85,10 +77,9 @@ void RI_ProcessMouse(const RAWMOUSE* rmouse)
}
}
void RI_ProcessKeyboard(const RAWKEYBOARD* rkbd)
static inline void RI_ProcessKeyboard(const RAWKEYBOARD* rkbd)
{
uint8_t key = rkbd->MakeCode;
uint8_t VKey = rkbd->VKey;
uint8_t key = rkbd->MakeCode, VKey = rkbd->VKey;
// for some reason rkbd->MakeCode is wrong for these
// even though rkbd->VKey is right...
@ -104,23 +95,19 @@ void RI_ProcessKeyboard(const RAWKEYBOARD* rkbd)
case VK_UP:
case VK_NUMPAD8:
if (rkbd->Flags & RI_KEY_E0) VKey = VK_UP, key = sc_UpArrow;
else VKey = VK_NUMPAD8, key = sc_kpad_8;
break;
else VKey = VK_NUMPAD8, key = sc_kpad_8; break;
case VK_DOWN:
case VK_NUMPAD2:
if (rkbd->Flags & RI_KEY_E0) VKey = VK_DOWN, key = sc_DownArrow;
else VKey = VK_NUMPAD2, key = sc_kpad_2;
break;
else VKey = VK_NUMPAD2, key = sc_kpad_2; break;
case VK_LEFT:
case VK_NUMPAD4:
if (rkbd->Flags & RI_KEY_E0) VKey = VK_LEFT, key = sc_LeftArrow;
else VKey = VK_NUMPAD4, key = sc_kpad_4;
break;
else VKey = VK_NUMPAD4, key = sc_kpad_4; break;
case VK_RIGHT:
case VK_NUMPAD6:
if (rkbd->Flags & RI_KEY_E0) VKey = VK_RIGHT, key = sc_RightArrow;
else VKey = VK_NUMPAD6, key = sc_kpad_6;
break;
else VKey = VK_NUMPAD6, key = sc_kpad_6; break;
case VK_INSERT:
key = sc_Insert; break;
case VK_HOME:
@ -169,11 +156,6 @@ int32_t RI_CaptureInput(int32_t grab, HWND target)
return (RegisterRawInputDevices(raw, 2, sizeof(raw[0])) == FALSE);
}
uint8_t RI_MouseState(uint8_t Button)
{
return ((MouseState0[Button-1] << 1) | MouseState1[Button-1]) & 0x03;
}
void RI_PollDevices()
{
int32_t i;
@ -190,8 +172,6 @@ void RI_PollDevices()
for (i = 0; i < 256; i++)
KeyboardState[i] = (KeyboardState[i] << 1) | (1 & KeyboardState[i]);
Bmemcpy(MouseState0, MouseState1, sizeof(MouseState0));
MWheel = 0;
while (PeekMessage(&msg, 0, WM_INPUT, WM_INPUT, PM_REMOVE | PM_QS_INPUT))
@ -257,14 +237,12 @@ void grabmouse(char a)
if (!mousegrab || !d)
{
GetCursorPos(&pos);
d = 1;
d++;
}
ShowCursor(a == 0);
RI_CaptureInput(a, (HWND)win_gethwnd());
SetCursorPos(pos.x, pos.y);
mousex = mousey = mouseb = 0;
}
void readmousexy(int32_t *x, int32_t *y)

View file

@ -71,16 +71,16 @@ static int32_t usecwd = 0;
this should be lower than the MTU size by at least the size of the UDP and ENet headers
or else fragmentation will occur
*/
#define SYNCPACKETSIZE 1408
#define SYNCPACKETSIZE 1366
ENetHost * g_netServer = NULL;
ENetHost * g_netClient = NULL;
ENetPeer * g_netClientPeer = NULL;
int32_t g_netPort = 23513;
int32_t g_netDisconnect = 0;
// sprites of these statnums are synced to clients by the server
int8_t g_netStatnums[] = { STAT_PROJECTILE, STAT_STANDABLE, STAT_ACTIVATOR, STAT_TRANSPORT,
STAT_EFFECTOR, STAT_ACTOR, STAT_ZOMBIEACTOR, STAT_MISC
};
STAT_EFFECTOR, STAT_ACTOR, STAT_ZOMBIEACTOR, STAT_MISC };
char g_netPassword[32];
int32_t g_quitDeadline = 0;
@ -8345,7 +8345,7 @@ char CheatStrings[][MAXCHEATLEN] =
"sfm", // 26
};
enum cheats
enum cheatindex_t
{
CHEAT_CORNHOLIO,
CHEAT_STUFF,
@ -11836,9 +11836,15 @@ MAIN_LOOP_RESTART:
do //main loop
{
static uint32_t nextrender = 0;
static uint32_t nextrender = 0, next = 0;
uint32_t j;
// only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo
bindsenabled = g_player[myconnectindex].ps->gm & (MODE_GAME|MODE_DEMO);
// menus now call handleevents() from probe_()
while (!(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO)) && ready2send && totalclock >= ototalclock+TICSPERFRAME)
{
if (handleevents() && quitevent)
{
// JBF
@ -11846,37 +11852,26 @@ MAIN_LOOP_RESTART:
quitevent = 0;
}
if (ud.statusbarmode == 1 && (ud.statusbarscale == 100 || !getrendermode()))
{
ud.statusbarmode = 0;
G_UpdateScreenArea();
}
MUSIC_Update();
// only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo
bindsenabled = g_player[myconnectindex].ps->gm & (MODE_GAME|MODE_DEMO);
OSD_DispatchQueued();
G_HandleLocalKeys();
faketimerhandler();
}
if (((ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) &&
(g_player[myconnectindex].ps->gm&MODE_GAME) && G_MoveLoop())
continue;
G_DoCheats();
if (g_player[myconnectindex].ps->gm & (MODE_EOL|MODE_RESTART))
{
switch (G_EndOfLevel())
{
case 1:
continue;
case 2:
goto MAIN_LOOP_RESTART;
case 1: continue;
case 2: goto MAIN_LOOP_RESTART;
}
}
G_DoCheats();
G_HandleLocalKeys();
if (g_netClient && g_multiMapState)
{
for (i=g_gameVarCount-1; i>=0; i--)
@ -11890,6 +11885,18 @@ MAIN_LOOP_RESTART:
g_multiMapState = NULL;
}
if (next)
{
if (ud.statusbarmode == 1 && (ud.statusbarscale == 100 || !getrendermode()))
{
ud.statusbarmode = 0;
G_UpdateScreenArea();
}
next--;
nextpage();
}
j = getticks();
if (r_maxfps == 0 || j >= nextrender)
@ -11905,22 +11912,16 @@ MAIN_LOOP_RESTART:
i = 65536;
G_DrawRooms(screenpeek,i);
G_DisplayRest(i);
if (getrendermode() >= 3)
G_DrawBackground();
G_DisplayRest(i);
S_Update();
nextpage();
next++;
}
if (g_player[myconnectindex].ps->gm&MODE_DEMO)
goto MAIN_LOOP_RESTART;
while (!(g_player[myconnectindex].ps->gm&MODE_MENU) && ready2send && totalclock >= ototalclock+TICSPERFRAME)
faketimerhandler();
}
while (1);
@ -12567,81 +12568,17 @@ nextdemo:
GAME_STATIC GAME_INLINE int32_t G_MoveLoop()
{
/*
if (numplayers > 1)
Net_DoPrediction();
*/
Net_GetPackets();
while (g_player[myconnectindex].movefifoend-movefifoplc > 0)
{
/*
TRAVERSE_CONNECT(i)
if (movefifoplc == g_player[i].movefifoend) break;
if (i != ud.multimode) break;
*/
if (G_DoMoveThings()) return 1;
}
return 0;
}
GAME_STATIC int32_t G_DoMoveThings(void)
{
int32_t i, j;
// char ch;
/*
TRAVERSE_CONNECT(i)
if (TEST_SYNC_KEY(g_player[i].sync->bits, SK_MULTIFLAG))
{
multiflag = 2;
multiwhat = (g_player[i].sync->bits>>(SK_MULTIFLAG+1))&1;
multipos = (unsigned)(g_player[i].sync->bits>>(SK_MULTIFLAG+2))&15;
multiwho = i;
if (multiwhat)
{
G_SavePlayer(multipos);
multiflag = 0;
if (multiwho != myconnectindex)
{
Bsprintf(ScriptQuotes[122],"%s^00 SAVED A MULTIPLAYER GAME",&g_player[multiwho].user_name[0]);
P_DoQuote(122,g_player[myconnectindex].ps);
}
else
{
Bstrcpy(ScriptQuotes[122],"MULTIPLAYER GAME SAVED");
P_DoQuote(122,g_player[myconnectindex].ps);
}
break;
}
else
{
// waitforeverybody();
j = G_LoadPlayer(multipos);
multiflag = 0;
if (j == 0)
{
if (multiwho != myconnectindex)
{
Bsprintf(ScriptQuotes[122],"%s^00 LOADED A MULTIPLAYER GAME",&g_player[multiwho].user_name[0]);
P_DoQuote(122,g_player[myconnectindex].ps);
}
else
{
Bstrcpy(ScriptQuotes[122],"MULTIPLAYER GAME LOADED");
P_DoQuote(122,g_player[myconnectindex].ps);
}
return 1;
}
}
}
*/
ud.camerasprite = -1;
lockclock += TICSPERFRAME;
@ -12807,25 +12744,6 @@ GAME_STATIC int32_t G_DoMoveThings(void)
i = g_player[myconnectindex].ps->i;
/*
{
int32_t j;
packbuf[(jj = j++)] = 0;
if (T5 >= (intptr_t)&script[0] && T5 < (intptr_t)(&script[g_scriptSize]))
{
packbuf[jj] |= 2;
T5 -= (intptr_t)&script[0];
}
Bmemcpy(&packbuf[j], &T5, sizeof(T5));
j += sizeof(T5);
if (packbuf[jj] & 2) T5 += (intptr_t)&script[0];
}
*/
{
char buf[1024];

View file

@ -55,10 +55,13 @@ GAMEEXEC_STATIC int32_t VM_Execute(int32_t once);
void VM_ScriptInfo(void)
{
if (script)
{
intptr_t *p;
if (!script)
return;
if (insptr)
{
for (p=insptr-20; p<insptr+20; p++)
{
if (*p>>12&&(*p&0xFFF)<CON_END)
@ -66,10 +69,14 @@ void VM_ScriptInfo(void)
else
initprintf(" %d",*p);
}
initprintf("\n");
}
if (vm.g_i)
initprintf("current actor: %d (%d)\n",vm.g_i,vm.g_sp->picnum);
initprintf("g_errorLineNum: %d, g_tw: %d\n",g_errorLineNum,g_tw);
}
}
void VM_OnEvent(register int32_t iEventID, register int32_t iActor, register int32_t iPlayer, register int32_t lDist)
@ -101,11 +108,8 @@ void VM_OnEvent(register int32_t iEventID, register int32_t iActor, register int
deletesprite(vm.g_i);
}
// restore old values...
Bmemcpy(&vm, &vm_backup, sizeof(vmstate_t));
insptr=oinsptr;
//AddLog("End of Execution");
}
}
@ -114,10 +118,7 @@ static int32_t VM_CheckSquished(void)
sectortype *sc = &sector[vm.g_sp->sectnum];
int32_t squishme = 0;
if (vm.g_sp->picnum == APLAYER && ud.clipping)
return 0;
if (sc->lotag == 23)
if ((vm.g_sp->picnum == APLAYER && ud.clipping) || sc->lotag == 23)
return 0;
squishme = (sc->floorz - sc->ceilingz < (12<<8)); // && (sc->lotag&32768) == 0;
@ -128,7 +129,7 @@ static int32_t VM_CheckSquished(void)
if (!squishme)
return 0;
P_DoQuote(10,g_player[vm.g_p].ps);
P_DoQuote(10, g_player[vm.g_p].ps);
if (A_CheckEnemySprite(vm.g_sp)) vm.g_sp->xvel = 0;
@ -164,7 +165,7 @@ GAMEEXEC_STATIC int32_t A_Dodge(spritetype *s)
for (i=headspritestat[STAT_PROJECTILE]; i>=0; i=nextspritestat[i]) //weapons list
{
if (OW == i || SECT != s->sectnum)
if (OW == i/* || SECT != s->sectnum*/)
continue;
bx = SX-mx;

View file

@ -109,11 +109,11 @@ static int32_t probe_(int32_t type,int32_t x,int32_t y,int32_t i,int32_t n)
{
int16_t centre;
{
handleevents();
CONTROL_GetInput(&minfo);
mi += (minfo.dpitch+minfo.dz);
mii += minfo.dyaw;
}
if (x == (320>>1))
centre = 320>>2;