Commit b4e32467 authored by Richard Gobeille's avatar Richard Gobeille
Browse files

Duke3d: preprocessor definitions for extbits, bump extbits up to uint32_t

parent c7b180ec
......@@ -4022,18 +4022,19 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura
if (tilehasmodelorvoxel(t->picnum, t->pal))
{
static int32_t targetang = 0;
uint32_t const extBits = g_player[playerNum].input.extbits;
if (g_player[playerNum].input.extbits&(1<<1))
if (extBits&BIT(EK_MOVE_BACKWARD))
{
if (g_player[playerNum].input.extbits&(1<<2))targetang += 16;
else if (g_player[playerNum].input.extbits&(1<<3)) targetang -= 16;
if (extBits&BIT(EK_STRAFE_LEFT)) targetang += 16;
else if (extBits&BIT(EK_STRAFE_RIGHT)) targetang -= 16;
else if (targetang > 0) targetang -= targetang>>2;
else if (targetang < 0) targetang += (-targetang)>>2;
}
else
{
if (g_player[playerNum].input.extbits&(1<<2))targetang -= 16;
else if (g_player[playerNum].input.extbits&(1<<3)) targetang += 16;
if (extBits&BIT(EK_STRAFE_LEFT)) targetang -= 16;
else if (extBits&BIT(EK_STRAFE_RIGHT)) targetang += 16;
else if (targetang > 0) targetang -= targetang>>2;
else if (targetang < 0) targetang += (-targetang)>>2;
}
......@@ -4065,7 +4066,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura
spritesortcnt++;
}
if (g_player[playerNum].input.extbits & (1 << 7) && !ud.pause_on && spritesortcnt < maxspritesonscreen)
if (g_player[playerNum].input.extbits & BIT(EK_CHAT_MODE) && !ud.pause_on && spritesortcnt < maxspritesonscreen)
{
auto const playerTyping = &tsprite[spritesortcnt];
......
......@@ -99,6 +99,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define SK_INVENTORY 30
#define SK_ESCAPE 31
#define EK_MOVE_FORWARD 0
#define EK_MOVE_BACKWARD 1
#define EK_STRAFE_LEFT 2
#define EK_STRAFE_RIGHT 3
#define EK_TURN_LEFT 4
#define EK_TURN_RIGHT 5
#define EK_ALT_FIRE 6
#define EK_CHAT_MODE 7
// rotatesprite flags
#define ROTATE_SPRITE_TRANSLUCENT (BIT(0))
#define ROTATE_SPRITE_VIEW_CLIP (BIT(1)) // clip to view
......
......@@ -3023,7 +3023,7 @@ void P_GetInput(int const playerNum)
localInput = {};
localInput.bits = (((int32_t)g_gameQuit) << SK_GAMEQUIT);
localInput.extbits |= (1<<7);
localInput.extbits |= BIT(EK_CHAT_MODE);
return;
}
......@@ -3274,13 +3274,13 @@ void P_GetInput(int const playerNum)
if (PWEAPON(playerNum, pPlayer->curr_weapon, Flags) & WEAPON_SEMIAUTO && BUTTON(gamefunc_Fire))
CONTROL_ClearButton(gamefunc_Fire);
localInput.extbits |= (BUTTON(gamefunc_Move_Forward) || (input.fvel > 0));
localInput.extbits |= (BUTTON(gamefunc_Move_Backward) || (input.fvel < 0)) << 1;
localInput.extbits |= (BUTTON(gamefunc_Strafe_Left) || (input.svel > 0)) << 2;
localInput.extbits |= (BUTTON(gamefunc_Strafe_Right) || (input.svel < 0)) << 3;
localInput.extbits |= BUTTON(gamefunc_Turn_Left)<<4;
localInput.extbits |= BUTTON(gamefunc_Turn_Right)<<5;
localInput.extbits |= BUTTON(gamefunc_Alt_Fire)<<6;
localInput.extbits |= (BUTTON(gamefunc_Move_Forward) || (input.fvel > 0)) << EK_MOVE_FORWARD;
localInput.extbits |= (BUTTON(gamefunc_Move_Backward) || (input.fvel < 0)) << EK_MOVE_BACKWARD;
localInput.extbits |= (BUTTON(gamefunc_Strafe_Left) || (input.svel > 0)) << EK_STRAFE_LEFT;
localInput.extbits |= (BUTTON(gamefunc_Strafe_Right) || (input.svel < 0)) << EK_STRAFE_RIGHT;
localInput.extbits |= BUTTON(gamefunc_Turn_Left) << EK_TURN_LEFT;
localInput.extbits |= BUTTON(gamefunc_Turn_Right) << EK_TURN_RIGHT;
localInput.extbits |= BUTTON(gamefunc_Alt_Fire) << EK_ALT_FIRE;
int const movementLocked = P_CheckLockedMovement(playerNum);
......@@ -4185,7 +4185,7 @@ static void P_ProcessWeapon(int playerNum)
}
bool const doFire = (playerBits & BIT(SK_FIRE) && (*weaponFrame) == 0);
bool const doAltFire = g_player[playerNum].input.extbits & (1 << 6);
bool const doAltFire = g_player[playerNum].input.extbits & BIT(EK_ALT_FIRE);
if (doAltFire)
{
......@@ -5443,15 +5443,15 @@ void P_ProcessInput(int playerNum)
}
}
if (pInput.extbits & (1)) VM_OnEvent(EVENT_MOVEFORWARD, pPlayer->i, playerNum);
if (pInput.extbits & (1 << 1)) VM_OnEvent(EVENT_MOVEBACKWARD, pPlayer->i, playerNum);
if (pInput.extbits & (1 << 2)) VM_OnEvent(EVENT_STRAFELEFT, pPlayer->i, playerNum);
if (pInput.extbits & (1 << 3)) VM_OnEvent(EVENT_STRAFERIGHT, pPlayer->i, playerNum);
if (pInput.extbits & BIT(EK_MOVE_FORWARD)) VM_OnEvent(EVENT_MOVEFORWARD, pPlayer->i, playerNum);
if (pInput.extbits & BIT(EK_MOVE_BACKWARD)) VM_OnEvent(EVENT_MOVEBACKWARD, pPlayer->i, playerNum);
if (pInput.extbits & BIT(EK_STRAFE_LEFT)) VM_OnEvent(EVENT_STRAFELEFT, pPlayer->i, playerNum);
if (pInput.extbits & BIT(EK_STRAFE_RIGHT)) VM_OnEvent(EVENT_STRAFERIGHT, pPlayer->i, playerNum);
if (pInput.extbits & (1 << 4) || pInput.q16avel < 0)
if (pInput.extbits & BIT(EK_TURN_LEFT) || pInput.q16avel < 0)
VM_OnEvent(EVENT_TURNLEFT, pPlayer->i, playerNum);
if (pInput.extbits & (1 << 5) || pInput.q16avel > 0)
if (pInput.extbits & BIT(EK_TURN_RIGHT) || pInput.q16avel > 0)
VM_OnEvent(EVENT_TURNRIGHT, pPlayer->i, playerNum);
if (pPlayer->vel.x || pPlayer->vel.y || pInput.fvel || pInput.svel)
......
......@@ -168,14 +168,14 @@ typedef struct {
char inven_icon, jetpack_on, heat_on;
} DukeStatus_t;
#pragma pack(push,1)
typedef struct {
uint32_t bits;
int16_t fvel, svel;
fix16_t q16avel, q16horz;
uint8_t extbits;
uint32_t extbits;
} input_t;
#pragma pack(push,1)
// XXX: r1625 changed a lot types here, among others
// * int32_t --> int16_t
// * int16_t --> int8_t
......
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