dsda: expose raven inventory selection
This commit is contained in:
parent
b68649ed70
commit
1783c28fc2
Binary file not shown.
|
@ -241,11 +241,11 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
controller.AcceptNewAxis($"P{port} Turning Speed", unchecked((sbyte) input[i++]));
|
||||
|
||||
var buttons = input[i++];
|
||||
controller[$"P{port} Fire"] = (buttons & 0b00000001) is not 0;
|
||||
controller[$"P{port} Use"] = (buttons & 0b00000010) is not 0;
|
||||
var changeWeapon = (buttons & 0b00000100) is not 0;
|
||||
var weapon = changeWeapon ? (((buttons & 0b00111000) >> 3) + 1) : 0;
|
||||
var buttons = (LibDSDA.Buttons)input[i++];
|
||||
controller[$"P{port} Fire"] = (buttons & LibDSDA.Buttons.Fire) is not 0;
|
||||
controller[$"P{port} Use" ] = (buttons & LibDSDA.Buttons.Use) is not 0;
|
||||
var changeWeapon = (buttons & LibDSDA.Buttons.ChangeWeapon) is not 0;
|
||||
var weapon = changeWeapon ? (((int)(buttons & LibDSDA.Buttons.WeaponMask) >> 3) + 1) : 0;
|
||||
controller.AcceptNewAxis($"P{port} Weapon Select", weapon);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,16 +40,18 @@ namespace BizHawk.Client.Common
|
|||
controller.Definition.BuildMnemonicsCache(Result.Movie.SystemID);
|
||||
void ParsePlayer(string playerPfx)
|
||||
{
|
||||
controller.AcceptNewAxis(playerPfx + "Run Speed", unchecked((sbyte) input[i++]));
|
||||
controller.AcceptNewAxis(playerPfx + "Run Speed" , unchecked((sbyte) input[i++]));
|
||||
controller.AcceptNewAxis(playerPfx + "Strafing Speed", unchecked((sbyte) input[i++]));
|
||||
controller.AcceptNewAxis(playerPfx + "Turning Speed", unchecked((sbyte) input[i++]));
|
||||
var specialValue = input[i++];
|
||||
controller[playerPfx + "Fire"] = (specialValue & 0b00000001) is not 0;
|
||||
controller[playerPfx + "Use"] = (specialValue & 0b00000010) is not 0;
|
||||
bool changeWeapon = (specialValue & 0b00000100) is not 0;
|
||||
int weapon = changeWeapon ? (((specialValue & 0b00111000) >> 3) + 1) : 0;
|
||||
controller.AcceptNewAxis(playerPfx + "Turning Speed" , unchecked((sbyte) input[i++]));
|
||||
|
||||
var specialValue = (LibDSDA.Buttons)input[i++];
|
||||
controller[playerPfx + "Fire"] = (specialValue & LibDSDA.Buttons.Fire) is not 0;
|
||||
controller[playerPfx + "Use" ] = (specialValue & LibDSDA.Buttons.Use ) is not 0;
|
||||
bool changeWeapon = (specialValue & LibDSDA.Buttons.ChangeWeapon) is not 0;
|
||||
int weapon = changeWeapon ? (((int)(specialValue & LibDSDA.Buttons.WeaponMask) >> 3) + 1) : 0;
|
||||
|
||||
controller.AcceptNewAxis(playerPfx + "Weapon Select", weapon);
|
||||
controller.AcceptNewAxis(playerPfx + "Fly / Look", unchecked((sbyte) input[i++]));
|
||||
controller.AcceptNewAxis(playerPfx + "Fly / Look" , unchecked((sbyte) input[i++]));
|
||||
controller.AcceptNewAxis(playerPfx + "Use Artifact", unchecked((sbyte) input[i++]));
|
||||
}
|
||||
do
|
||||
|
|
|
@ -52,20 +52,23 @@ namespace BizHawk.Client.Common
|
|||
controller.Definition.BuildMnemonicsCache(Result.Movie.SystemID);
|
||||
void ParsePlayer(string playerPfx)
|
||||
{
|
||||
controller.AcceptNewAxis(playerPfx + "Run Speed", unchecked((sbyte) input[i++]));
|
||||
controller.AcceptNewAxis(playerPfx + "Run Speed" , unchecked((sbyte) input[i++]));
|
||||
controller.AcceptNewAxis(playerPfx + "Strafing Speed", unchecked((sbyte) input[i++]));
|
||||
controller.AcceptNewAxis(playerPfx + "Turning Speed", unchecked((sbyte) input[i++]));
|
||||
var specialValue = input[i++];
|
||||
controller[playerPfx + "Fire"] = (specialValue & 0b00000001) is not 0;
|
||||
controller[playerPfx + "Use"] = (specialValue & 0b00000010) is not 0;
|
||||
bool changeWeapon = (specialValue & 0b00000100) is not 0;
|
||||
int weapon = changeWeapon ? (((specialValue & 0b00111000) >> 3) + 1) : 0;
|
||||
controller.AcceptNewAxis(playerPfx + "Turning Speed" , unchecked((sbyte) input[i++]));
|
||||
|
||||
var specialValue = (LibDSDA.Buttons)input[i++];
|
||||
controller[playerPfx + "Fire"] = (specialValue & LibDSDA.Buttons.Fire) is not 0;
|
||||
controller[playerPfx + "Use" ] = (specialValue & LibDSDA.Buttons.Use ) is not 0;
|
||||
bool changeWeapon = (specialValue & LibDSDA.Buttons.ChangeWeapon) is not 0;
|
||||
int weapon = changeWeapon ? (((int)(specialValue & LibDSDA.Buttons.WeaponMask) >> 3) + 1) : 0;
|
||||
|
||||
controller.AcceptNewAxis(playerPfx + "Weapon Select", weapon);
|
||||
controller.AcceptNewAxis(playerPfx + "Fly / Look", unchecked((sbyte) input[i++]));
|
||||
|
||||
var useArtifact = input[i++];
|
||||
controller.AcceptNewAxis(playerPfx + "Use Artifact", useArtifact & 0b00111111);
|
||||
controller[playerPfx + "End Player"] = (useArtifact & 0b01000000) is not 0;
|
||||
controller[playerPfx + "Jump"] = (useArtifact & 0b10000000) is not 0;
|
||||
controller.AcceptNewAxis(playerPfx + "Use Artifact", useArtifact & (int)LibDSDA.Buttons.ArtifactMask);
|
||||
controller[playerPfx + "End Player"] = (useArtifact & (int)LibDSDA.Buttons.EndPlayer) is not 0;
|
||||
controller[playerPfx + "Jump" ] = (useArtifact & (int)LibDSDA.Buttons.Jump ) is not 0;
|
||||
}
|
||||
do
|
||||
{
|
||||
|
|
|
@ -75,6 +75,21 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
|||
$"P{port} Weapon Select 7",
|
||||
]);
|
||||
}
|
||||
|
||||
if (settings.InputFormat is not ControllerType.Doom)
|
||||
{
|
||||
if (settings.InputFormat is ControllerType.Heretic)
|
||||
{
|
||||
// TODO
|
||||
//controller.BoolButtons.Add($"P{port} Inventory Skip");
|
||||
}
|
||||
|
||||
controller.BoolButtons.AddRange([
|
||||
$"P{port} Inventory Left",
|
||||
$"P{port} Inventory Right",
|
||||
$"P{port} Use Artifact",
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
|||
new LibDSDA.PackedPlayerInput()
|
||||
];
|
||||
|
||||
int commonButtons = 0;
|
||||
int automapButtons = 0;
|
||||
|
||||
// this is the only change that we're announcing on the front end.
|
||||
// not announcing it at all feels weird given how vanilla and ports do it.
|
||||
|
@ -44,18 +44,18 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
|||
4); // internal messages last 4 seconds
|
||||
}
|
||||
|
||||
if (controller.IsPressed("Automap Toggle")) commonButtons |= (1 << 0);
|
||||
if (controller.IsPressed("Automap +")) commonButtons |= (1 << 1);
|
||||
if (controller.IsPressed("Automap -")) commonButtons |= (1 << 2);
|
||||
if (controller.IsPressed("Automap Full/Zoom")) commonButtons |= (1 << 3);
|
||||
if (controller.IsPressed("Automap Follow")) commonButtons |= (1 << 4);
|
||||
if (controller.IsPressed("Automap Up")) commonButtons |= (1 << 5);
|
||||
if (controller.IsPressed("Automap Down")) commonButtons |= (1 << 6);
|
||||
if (controller.IsPressed("Automap Right")) commonButtons |= (1 << 7);
|
||||
if (controller.IsPressed("Automap Left")) commonButtons |= (1 << 8);
|
||||
if (controller.IsPressed("Automap Grid")) commonButtons |= (1 << 9);
|
||||
if (controller.IsPressed("Automap Mark")) commonButtons |= (1 << 10);
|
||||
if (controller.IsPressed("Automap Clear Marks")) commonButtons |= (1 << 11);
|
||||
if (controller.IsPressed("Automap Toggle")) automapButtons |= (1 << 0);
|
||||
if (controller.IsPressed("Automap +")) automapButtons |= (1 << 1);
|
||||
if (controller.IsPressed("Automap -")) automapButtons |= (1 << 2);
|
||||
if (controller.IsPressed("Automap Full/Zoom")) automapButtons |= (1 << 3);
|
||||
if (controller.IsPressed("Automap Follow")) automapButtons |= (1 << 4);
|
||||
if (controller.IsPressed("Automap Up")) automapButtons |= (1 << 5);
|
||||
if (controller.IsPressed("Automap Down")) automapButtons |= (1 << 6);
|
||||
if (controller.IsPressed("Automap Right")) automapButtons |= (1 << 7);
|
||||
if (controller.IsPressed("Automap Left")) automapButtons |= (1 << 8);
|
||||
if (controller.IsPressed("Automap Grid")) automapButtons |= (1 << 9);
|
||||
if (controller.IsPressed("Automap Mark")) automapButtons |= (1 << 10);
|
||||
if (controller.IsPressed("Automap Clear Marks")) automapButtons |= (1 << 11);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
@ -158,9 +158,11 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
|||
}
|
||||
|
||||
// ultimately strafe speed is limited to max run speed, NOT max strafe speed
|
||||
players[i].StrafingSpeed = players[i].StrafingSpeed.Clamp<int>(-_runSpeeds[1], _runSpeeds[1]);
|
||||
players[i].StrafingSpeed = players[i].StrafingSpeed
|
||||
.Clamp<int>(-_runSpeeds[1], _runSpeeds[1]);
|
||||
|
||||
// for shorttics we expose to player and parse from movies only 1 byte, but the core internally works with 2 bytes
|
||||
// for shorttics we expose to player and parse from movies only 1 byte
|
||||
// but the core internally works with 2 bytes
|
||||
if (_syncSettings.TurningResolution == TurningResolution.Shorttics)
|
||||
{
|
||||
int desiredAngleturn = players[i].TurningSpeed + _turnCarry;
|
||||
|
@ -188,10 +190,24 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
|||
players[i].FlyLook = controller.AxisValue($"P{port} Fly / Look");
|
||||
players[i].ArtifactUse = controller.AxisValue($"P{port} Use Artifact");
|
||||
|
||||
// these "buttons" are not part of ticcmd_t::buttons
|
||||
// we just use their free bits
|
||||
if (controller.IsPressed($"P{port} Inventory Left"))
|
||||
players[i].Buttons |= LibDSDA.Buttons.InventoryLeft;
|
||||
|
||||
if (controller.IsPressed($"P{port} Inventory Right"))
|
||||
players[i].Buttons |= LibDSDA.Buttons.InventoryRight;
|
||||
|
||||
if (controller.IsPressed($"P{port} Use Artifact"))
|
||||
players[i].Buttons |= LibDSDA.Buttons.ArtifactUse;
|
||||
|
||||
if (_syncSettings.InputFormat is ControllerType.Hexen)
|
||||
{
|
||||
players[i].Jump = Convert.ToInt32(controller.IsPressed($"P{port} Jump"));
|
||||
players[i].EndPlayer = Convert.ToInt32(controller.IsPressed($"P{port} End Player"));
|
||||
if (controller.IsPressed($"P{port} Jump"))
|
||||
players[i].ArtifactUse |= (int)LibDSDA.Buttons.Jump;
|
||||
|
||||
if (controller.IsPressed($"P{port} End Player"))
|
||||
players[i].ArtifactUse |= (int)LibDSDA.Buttons.EndPlayer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +235,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
|||
};
|
||||
|
||||
IsLagFrame = _core.dsda_frame_advance(
|
||||
commonButtons,
|
||||
automapButtons,
|
||||
ref players[0],
|
||||
ref players[1],
|
||||
ref players[2],
|
||||
|
|
|
@ -20,15 +20,23 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
|||
Registered = 0b00000010, // DOOM 1 registered, E3, M27
|
||||
Commercial = 0b00000100, // DOOM 2 retail, E1 M34 (DOOM 2 german edition not handled)
|
||||
Retail = 0b00001000, // DOOM 1 retail, E4, M36
|
||||
Indetermined = 0b00010000, // no IWAD found.
|
||||
Indetermined = 0b00010000, // no IWAD found.
|
||||
}
|
||||
|
||||
public enum Buttons : byte
|
||||
{
|
||||
None = 0b00000000,
|
||||
Fire = 0b00000001,
|
||||
Use = 0b00000010,
|
||||
ChangeWeapon = 0b00000100,
|
||||
None = 0b00000000,
|
||||
Fire = 0b00000001,
|
||||
Use = 0b00000010,
|
||||
ChangeWeapon = 0b00000100,
|
||||
WeaponMask = 0b00111000,
|
||||
InventoryLeft = 0b00001000,
|
||||
InventoryRight = 0b00010000,
|
||||
InventorySkip = 0b00100000,
|
||||
ArtifactUse = 0b01000000,
|
||||
EndPlayer = 0b01000000,
|
||||
Jump = 0b10000000,
|
||||
ArtifactMask = 0b00111111,
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
bool foundIWAD = false;
|
||||
bool wipeDone = true;
|
||||
int lastButtons[4] = { 0 };
|
||||
AutomapButtons last_buttons = { 0 };
|
||||
|
||||
void render_updates(struct PackedRenderInfo *renderInfo)
|
||||
|
@ -115,12 +116,37 @@ void player_input(struct PackedPlayerInput *inputs, int playerId)
|
|||
local_cmds[playerId].forwardmove = inputs->RunSpeed;
|
||||
local_cmds[playerId].sidemove = inputs->StrafingSpeed;
|
||||
local_cmds[playerId].lookfly = inputs->FlyLook;
|
||||
local_cmds[playerId].arti = inputs->ArtifactUse;
|
||||
local_cmds[playerId].arti = inputs->ArtifactUse; // use specific artifact (also jump/die)
|
||||
local_cmds[playerId].angleturn = inputs->TurningSpeed;
|
||||
local_cmds[playerId].buttons = inputs->Buttons;
|
||||
local_cmds[playerId].buttons = inputs->Buttons & REGULAR_BUTTON_MASK;
|
||||
|
||||
if (inputs->EndPlayer) local_cmds[playerId].arti |= 0b01000000;
|
||||
if (inputs->Jump) local_cmds[playerId].arti |= 0b10000000;
|
||||
player_t *player = &players[consoleplayer];
|
||||
char extraButtons = inputs->Buttons & EXTRA_BUTTON_MASK;
|
||||
|
||||
// explicitly select artifact through in-game GUI
|
||||
if (extraButtons & INVENTORY_LEFT && !(lastButtons[playerId] & INVENTORY_LEFT))
|
||||
InventoryMoveLeft ();
|
||||
|
||||
if (extraButtons & INVENTORY_RIGHT && !(lastButtons[playerId] & INVENTORY_RIGHT))
|
||||
InventoryMoveRight();
|
||||
|
||||
if (extraButtons & INVENTORY_SKIP && !(lastButtons[playerId] & INVENTORY_SKIP))
|
||||
{ /* TODO */ }
|
||||
|
||||
if (extraButtons & ARTIFACT_USE && !(lastButtons[playerId] & ARTIFACT_USE))
|
||||
{
|
||||
// use currently selected artifact
|
||||
if (inventory)
|
||||
{
|
||||
player->readyArtifact = player->inventory[inv_ptr].type;
|
||||
inventory = false;
|
||||
local_cmds[playerId].arti &= ~AFLAG_MASK; // leave jump/die intact, zero out the rest
|
||||
}
|
||||
else
|
||||
{
|
||||
local_cmds[playerId].arti |= player->inventory[inv_ptr].type & AFLAG_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
if (local_cmds[playerId].buttons & BT_CHANGE)
|
||||
{
|
||||
|
@ -128,7 +154,6 @@ void player_input(struct PackedPlayerInput *inputs, int playerId)
|
|||
|
||||
if (!demo_compatibility)
|
||||
{
|
||||
player_t *player = &players[consoleplayer];
|
||||
// only select chainsaw from '1' if it's owned, it's
|
||||
// not already in use, and the player prefers it or
|
||||
// the fist is already in use, or the player does not
|
||||
|
@ -142,6 +167,8 @@ void player_input(struct PackedPlayerInput *inputs, int playerId)
|
|||
|
||||
local_cmds[playerId].buttons |= (newweapon) << BT_WEAPONSHIFT;
|
||||
}
|
||||
|
||||
lastButtons[playerId] = extraButtons;
|
||||
}
|
||||
|
||||
ECL_EXPORT void dsda_get_audio(int *n, void **buffer)
|
||||
|
|
|
@ -28,6 +28,9 @@ extern void headlessSetSaveStatePointer(void *savePtr, int saveStateSize);
|
|||
extern size_t headlessGetEffectiveSaveSize();
|
||||
extern unsigned int rngseed;
|
||||
|
||||
extern dboolean InventoryMoveLeft();
|
||||
extern dboolean InventoryMoveRight();
|
||||
|
||||
// Video
|
||||
extern void headlessUpdateVideo();
|
||||
extern void* headlessGetVideoBuffer();
|
||||
|
@ -54,6 +57,8 @@ extern int reachedGameEnd;
|
|||
extern int numthings;
|
||||
extern mobj_t **mobj_ptrs;
|
||||
extern dsda_arg_t arg_value[dsda_arg_count];
|
||||
extern int inv_ptr;
|
||||
extern dboolean inventory;
|
||||
|
||||
// Automap
|
||||
extern void AM_addMark();
|
||||
|
@ -86,6 +91,22 @@ extern fixed_t scale_ftom;
|
|||
#define PALETTE_SIZE 256
|
||||
uint32_t _convertedPaletteBuffer[PALETTE_SIZE];
|
||||
|
||||
enum ExtraButtons
|
||||
{
|
||||
REGULAR_BUTTON_MASK = 0b0000000000000111,
|
||||
INVENTORY_LEFT = 0b0000000000001000,
|
||||
INVENTORY_RIGHT = 0b0000000000010000,
|
||||
INVENTORY_SKIP = 0b0000000000100000,
|
||||
ARTIFACT_USE = 0b0000000001000000,
|
||||
LOOK_UP = 0b0000000010000000,
|
||||
LOOK_DOWN = 0b0000000100000000,
|
||||
LOOK_CENTER = 0b0000001000000000,
|
||||
FLY_UP = 0b0000010000000000,
|
||||
FLY_DOWN = 0b0000100000000000,
|
||||
FLY_CENTER = 0b0001000000000000,
|
||||
EXTRA_BUTTON_MASK = 0b0001111111111000,
|
||||
};
|
||||
|
||||
enum HudMode
|
||||
{
|
||||
HUD_VANILLA = 0,
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit a7a3e7de03fd96e79ef340995cf12b04216f3382
|
||||
Subproject commit a19ea8b855cfcbf83ba5bccadb4a9ee8eb5ce4b2
|
Loading…
Reference in New Issue