Replace PlayerOne/PlayerTwo by PlayerControls[0]/PlayerControls[1].
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2939 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
Changes towards version 0.7:
|
Changes towards version 0.7:
|
||||||
|
- Replace PlayerOne/PlayerTwo by PlayerControls[0]/PlayerControls[1] - SvdB
|
||||||
- Moved comm resources into starcon.ls2 - Michael
|
- Moved comm resources into starcon.ls2 - Michael
|
||||||
- Repackaged static comm/ship data to it all uniquely named - Michael
|
- Repackaged static comm/ship data to it all uniquely named - Michael
|
||||||
- On MacOS X, search for the content in the application bundle, from Nic
|
- On MacOS X, search for the content in the application bundle, from Nic
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ extern battle_summary_func PlayerInput[];
|
|||||||
|
|
||||||
extern CONTROLLER_INPUT_STATE CurrentInputState, PulsedInputState;
|
extern CONTROLLER_INPUT_STATE CurrentInputState, PulsedInputState;
|
||||||
extern volatile CONTROLLER_INPUT_STATE ImmediateInputState;
|
extern volatile CONTROLLER_INPUT_STATE ImmediateInputState;
|
||||||
extern CONTROL_TEMPLATE PlayerOne, PlayerTwo;
|
extern CONTROL_TEMPLATE PlayerControls[];
|
||||||
|
|
||||||
void UpdateInputState (void);
|
void UpdateInputState (void);
|
||||||
void FlushInputState (void);
|
void FlushInputState (void);
|
||||||
@@ -113,8 +113,7 @@ BOOLEAN ConfirmExit (void);
|
|||||||
void DoPopupWindow(const char *msg);
|
void DoPopupWindow(const char *msg);
|
||||||
void DoInput (void *pInputState, BOOLEAN resetInput);
|
void DoInput (void *pInputState, BOOLEAN resetInput);
|
||||||
|
|
||||||
BATTLE_INPUT_STATE p1_combat_summary (COUNT player, STARSHIP *StarShipPtr);
|
BATTLE_INPUT_STATE combat_summary (COUNT player, STARSHIP *StarShipPtr);
|
||||||
BATTLE_INPUT_STATE p2_combat_summary (COUNT player, STARSHIP *StarShipPtr);
|
|
||||||
|
|
||||||
extern volatile BOOLEAN GamePaused, ExitRequested;
|
extern volatile BOOLEAN GamePaused, ExitRequested;
|
||||||
|
|
||||||
|
|||||||
@@ -664,10 +664,10 @@ UninitEncounter (void)
|
|||||||
while (!(AnyButtonPress (TRUE)) && GetTimeCounter () < Time)
|
while (!(AnyButtonPress (TRUE)) && GetTimeCounter () < Time)
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
if (!CurrentInputState.key[PlayerOne][KEY_ESCAPE])
|
if (!CurrentInputState.key[PlayerControls[0]][KEY_ESCAPE])
|
||||||
{
|
{
|
||||||
DrawFadeText (str1, str2, FALSE, &scavenge_r);
|
DrawFadeText (str1, str2, FALSE, &scavenge_r);
|
||||||
if (!CurrentInputState.key[PlayerOne][KEY_ESCAPE])
|
if (!CurrentInputState.key[PlayerControls[0]][KEY_ESCAPE])
|
||||||
{
|
{
|
||||||
SetContextForeGroundColor (BLACK_COLOR);
|
SetContextForeGroundColor (BLACK_COLOR);
|
||||||
r.corner.x = scavenge_r.corner.x + 10;
|
r.corner.x = scavenge_r.corner.x + 10;
|
||||||
@@ -695,7 +695,7 @@ UninitEncounter (void)
|
|||||||
&& GetTimeCounter () < Time)
|
&& GetTimeCounter () < Time)
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
if (!CurrentInputState.key[PlayerOne][KEY_ESCAPE])
|
if (!CurrentInputState.key[PlayerControls[0]][KEY_ESCAPE])
|
||||||
DrawFadeText (str1, str2, FALSE, &scavenge_r);
|
DrawFadeText (str1, str2, FALSE, &scavenge_r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-32
@@ -41,14 +41,14 @@ typedef struct
|
|||||||
|
|
||||||
/* These static variables are the values that are set by the controllers. */
|
/* These static variables are the values that are set by the controllers. */
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
DWORD key [NUM_TEMPLATES][NUM_KEYS];
|
DWORD key [NUM_TEMPLATES][NUM_KEYS];
|
||||||
DWORD menu [NUM_MENU_KEYS];
|
DWORD menu [NUM_MENU_KEYS];
|
||||||
} MENU_ANNOTATIONS;
|
} MENU_ANNOTATIONS;
|
||||||
|
|
||||||
|
|
||||||
CONTROL_TEMPLATE PlayerOne, PlayerTwo;
|
CONTROL_TEMPLATE PlayerControls[NUM_PLAYERS];
|
||||||
CONTROLLER_INPUT_STATE CurrentInputState, PulsedInputState;
|
CONTROLLER_INPUT_STATE CurrentInputState, PulsedInputState;
|
||||||
static CONTROLLER_INPUT_STATE CachedInputState, OldInputState;
|
static CONTROLLER_INPUT_STATE CachedInputState, OldInputState;
|
||||||
static MENU_ANNOTATIONS RepeatDelays, Times;
|
static MENU_ANNOTATIONS RepeatDelays, Times;
|
||||||
@@ -375,52 +375,35 @@ GetMenuSounds (MENU_SOUND_FLAGS *s0, MENU_SOUND_FLAGS *s1)
|
|||||||
*s1 = sound_1;
|
*s1 = sound_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These can really be refactored */
|
static BATTLE_INPUT_STATE
|
||||||
|
ControlInputToBattleInput (const int *keyState)
|
||||||
BATTLE_INPUT_STATE
|
|
||||||
p1_combat_summary (COUNT player, STARSHIP *StarShipPtr)
|
|
||||||
{
|
{
|
||||||
BATTLE_INPUT_STATE InputState = 0;
|
BATTLE_INPUT_STATE InputState = 0;
|
||||||
if (CurrentInputState.key[PlayerOne][KEY_UP])
|
|
||||||
|
if (keyState[KEY_UP])
|
||||||
InputState |= BATTLE_THRUST;
|
InputState |= BATTLE_THRUST;
|
||||||
if (CurrentInputState.key[PlayerOne][KEY_LEFT])
|
if (keyState[KEY_LEFT])
|
||||||
InputState |= BATTLE_LEFT;
|
InputState |= BATTLE_LEFT;
|
||||||
if (CurrentInputState.key[PlayerOne][KEY_RIGHT])
|
if (keyState[KEY_RIGHT])
|
||||||
InputState |= BATTLE_RIGHT;
|
InputState |= BATTLE_RIGHT;
|
||||||
if (CurrentInputState.key[PlayerOne][KEY_WEAPON])
|
if (keyState[KEY_WEAPON])
|
||||||
InputState |= BATTLE_WEAPON;
|
InputState |= BATTLE_WEAPON;
|
||||||
if (CurrentInputState.key[PlayerOne][KEY_SPECIAL])
|
if (keyState[KEY_SPECIAL])
|
||||||
InputState |= BATTLE_SPECIAL;
|
InputState |= BATTLE_SPECIAL;
|
||||||
if (CurrentInputState.key[PlayerOne][KEY_ESCAPE])
|
if (keyState[KEY_ESCAPE])
|
||||||
InputState |= BATTLE_ESCAPE;
|
InputState |= BATTLE_ESCAPE;
|
||||||
if (CurrentInputState.key[PlayerOne][KEY_DOWN])
|
if (keyState[KEY_DOWN])
|
||||||
InputState |= BATTLE_DOWN;
|
InputState |= BATTLE_DOWN;
|
||||||
|
|
||||||
(void) player;
|
|
||||||
(void) StarShipPtr;
|
|
||||||
return InputState;
|
return InputState;
|
||||||
}
|
}
|
||||||
|
|
||||||
BATTLE_INPUT_STATE
|
BATTLE_INPUT_STATE
|
||||||
p2_combat_summary (COUNT player, STARSHIP *StarShipPtr)
|
combat_summary (COUNT player, STARSHIP *StarShipPtr)
|
||||||
{
|
{
|
||||||
BATTLE_INPUT_STATE InputState = 0;
|
|
||||||
if (CurrentInputState.key[PlayerTwo][KEY_UP])
|
|
||||||
InputState |= BATTLE_THRUST;
|
|
||||||
if (CurrentInputState.key[PlayerTwo][KEY_LEFT])
|
|
||||||
InputState |= BATTLE_LEFT;
|
|
||||||
if (CurrentInputState.key[PlayerTwo][KEY_RIGHT])
|
|
||||||
InputState |= BATTLE_RIGHT;
|
|
||||||
if (CurrentInputState.key[PlayerTwo][KEY_WEAPON])
|
|
||||||
InputState |= BATTLE_WEAPON;
|
|
||||||
if (CurrentInputState.key[PlayerTwo][KEY_SPECIAL])
|
|
||||||
InputState |= BATTLE_SPECIAL;
|
|
||||||
if (CurrentInputState.key[PlayerTwo][KEY_DOWN])
|
|
||||||
InputState |= BATTLE_DOWN;
|
|
||||||
|
|
||||||
(void) player;
|
|
||||||
(void) StarShipPtr;
|
(void) StarShipPtr;
|
||||||
return InputState;
|
return ControlInputToBattleInput(
|
||||||
|
CurrentInputState.key[PlayerControls[player]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
|||||||
@@ -180,9 +180,9 @@ DoGetMeleePlayer (GETMELEE_STATE *gms, COUNT which_player)
|
|||||||
CONTROL_TEMPLATE template;
|
CONTROL_TEMPLATE template;
|
||||||
|
|
||||||
if (which_player == 0)
|
if (which_player == 0)
|
||||||
template = PlayerOne;
|
template = PlayerControls[0];
|
||||||
else
|
else
|
||||||
template = PlayerTwo;
|
template = PlayerControls[1];
|
||||||
|
|
||||||
left = PulsedInputState.key[template][KEY_LEFT];
|
left = PulsedInputState.key[template][KEY_LEFT];
|
||||||
right = PulsedInputState.key[template][KEY_RIGHT];
|
right = PulsedInputState.key[template][KEY_RIGHT];
|
||||||
|
|||||||
@@ -1644,9 +1644,9 @@ SetVelocityComponents (
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (pMS->delta_item == 0
|
else if (pMS->delta_item == 0
|
||||||
|| (HIBYTE (pMS->delta_item)
|
|| (HIBYTE (pMS->delta_item)
|
||||||
&& ((CurrentInputState.key[PlayerOne][KEY_ESCAPE] ||
|
&& ((CurrentInputState.key[PlayerControls[0]][KEY_ESCAPE] ||
|
||||||
CurrentInputState.key[PlayerOne][KEY_SPECIAL])
|
CurrentInputState.key[PlayerControls[0]][KEY_SPECIAL])
|
||||||
|| ((PLANETSIDE_DESC*)pMenuState->ModuleFrame)->InTransit)))
|
|| ((PLANETSIDE_DESC*)pMenuState->ModuleFrame)->InTransit)))
|
||||||
{
|
{
|
||||||
if (pMS->delta_item || pMS->CurState > EXPLOSION_LIFE + 60)
|
if (pMS->delta_item || pMS->CurState > EXPLOSION_LIFE + 60)
|
||||||
@@ -1707,9 +1707,10 @@ SetVelocityComponents (
|
|||||||
index = GetFrameIndex (LanderFrame[0]);
|
index = GetFrameIndex (LanderFrame[0]);
|
||||||
if (LONIBBLE (pMS->CurState))
|
if (LONIBBLE (pMS->CurState))
|
||||||
pMS->CurState -= MAKE_BYTE (1, 0);
|
pMS->CurState -= MAKE_BYTE (1, 0);
|
||||||
else if (CurrentInputState.key[PlayerOne][KEY_LEFT] || CurrentInputState.key[PlayerOne][KEY_RIGHT])
|
else if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT] ||
|
||||||
|
CurrentInputState.key[PlayerControls[0]][KEY_RIGHT])
|
||||||
{
|
{
|
||||||
if (CurrentInputState.key[PlayerOne][KEY_LEFT])
|
if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT])
|
||||||
{
|
{
|
||||||
dx = -1;
|
dx = -1;
|
||||||
--index;
|
--index;
|
||||||
@@ -1749,7 +1750,7 @@ SetVelocityComponents (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CurrentInputState.key[PlayerOne][KEY_UP])
|
if (!CurrentInputState.key[PlayerControls[0]][KEY_UP])
|
||||||
dx = dy = 0;
|
dx = dy = 0;
|
||||||
else
|
else
|
||||||
GetNextVelocityComponents (
|
GetNextVelocityComponents (
|
||||||
@@ -1758,7 +1759,7 @@ SetVelocityComponents (
|
|||||||
|
|
||||||
if (HINIBBLE (pMS->CurState))
|
if (HINIBBLE (pMS->CurState))
|
||||||
pMS->CurState -= MAKE_BYTE (0, 1);
|
pMS->CurState -= MAKE_BYTE (0, 1);
|
||||||
else if (CurrentInputState.key[PlayerOne][KEY_WEAPON])
|
else if (CurrentInputState.key[PlayerControls[0]][KEY_WEAPON])
|
||||||
{
|
{
|
||||||
HELEMENT hWeaponElement;
|
HELEMENT hWeaponElement;
|
||||||
|
|
||||||
@@ -1787,7 +1788,7 @@ SetVelocityComponents (
|
|||||||
index + ANGLE_TO_FACING (FULL_CIRCLE)
|
index + ANGLE_TO_FACING (FULL_CIRCLE)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!CurrentInputState.key[PlayerOne][KEY_UP])
|
if (!CurrentInputState.key[PlayerControls[0]][KEY_UP])
|
||||||
wdx = wdy = 0;
|
wdx = wdy = 0;
|
||||||
else
|
else
|
||||||
GetCurrentVelocityComponents (
|
GetCurrentVelocityComponents (
|
||||||
|
|||||||
@@ -822,15 +822,15 @@ ProcessShipControls (void)
|
|||||||
|
|
||||||
ClockTick ();
|
ClockTick ();
|
||||||
|
|
||||||
if (CurrentInputState.key[PlayerOne][KEY_UP])
|
if (CurrentInputState.key[PlayerControls[0]][KEY_UP])
|
||||||
delta_y = -1;
|
delta_y = -1;
|
||||||
else
|
else
|
||||||
delta_y = 0;
|
delta_y = 0;
|
||||||
|
|
||||||
delta_x = 0;
|
delta_x = 0;
|
||||||
if (CurrentInputState.key[PlayerOne][KEY_LEFT])
|
if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT])
|
||||||
delta_x -= 1;
|
delta_x -= 1;
|
||||||
if (CurrentInputState.key[PlayerOne][KEY_RIGHT])
|
if (CurrentInputState.key[PlayerControls[0]][KEY_RIGHT])
|
||||||
delta_x += 1;
|
delta_x += 1;
|
||||||
|
|
||||||
if (delta_x || delta_y < 0)
|
if (delta_x || delta_y < 0)
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ uio_DirHandle *rootDir;
|
|||||||
static void
|
static void
|
||||||
InitPlayerInput (void)
|
InitPlayerInput (void)
|
||||||
{
|
{
|
||||||
HumanInput[0] = p1_combat_summary;
|
HumanInput[0] = combat_summary;
|
||||||
HumanInput[1] = p2_combat_summary;
|
HumanInput[1] = combat_summary;
|
||||||
ComputerInput = computer_intelligence;
|
ComputerInput = computer_intelligence;
|
||||||
#ifdef NETPLAY
|
#ifdef NETPLAY
|
||||||
NetworkInput = networkBattleInput;
|
NetworkInput = networkBattleInput;
|
||||||
|
|||||||
@@ -1188,8 +1188,8 @@ GetGlobalOptions (GLOBALOPTS *opts)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
opts->player1 = PlayerOne;
|
opts->player1 = PlayerControls[0];
|
||||||
opts->player2 = PlayerTwo;
|
opts->player2 = PlayerControls[1];
|
||||||
|
|
||||||
opts->musicvol = (((int)(musicVolumeScale * 100.0f) + 2) / 5) * 5;
|
opts->musicvol = (((int)(musicVolumeScale * 100.0f) + 2) / 5) * 5;
|
||||||
opts->sfxvol = (((int)(sfxVolumeScale * 100.0f) + 2) / 5) * 5;
|
opts->sfxvol = (((int)(sfxVolumeScale * 100.0f) + 2) / 5) * 5;
|
||||||
@@ -1306,8 +1306,8 @@ SetGlobalOptions (GLOBALOPTS *opts)
|
|||||||
optWhichShield = (opts->shield == OPTVAL_3DO) ? OPT_3DO : OPT_PC;
|
optWhichShield = (opts->shield == OPTVAL_3DO) ? OPT_3DO : OPT_PC;
|
||||||
optMeleeScale = (opts->meleezoom == OPTVAL_3DO) ? TFB_SCALE_TRILINEAR : TFB_SCALE_STEP;
|
optMeleeScale = (opts->meleezoom == OPTVAL_3DO) ? TFB_SCALE_TRILINEAR : TFB_SCALE_STEP;
|
||||||
optWhichIntro = (opts->intro == OPTVAL_3DO) ? OPT_3DO : OPT_PC;
|
optWhichIntro = (opts->intro == OPTVAL_3DO) ? OPT_3DO : OPT_PC;
|
||||||
PlayerOne = opts->player1;
|
PlayerControls[0] = opts->player1;
|
||||||
PlayerTwo = opts->player2;
|
PlayerControls[1] = opts->player2;
|
||||||
|
|
||||||
res_PutBoolean ("config.subtitles", opts->subtitles == OPTVAL_ENABLED);
|
res_PutBoolean ("config.subtitles", opts->subtitles == OPTVAL_ENABLED);
|
||||||
res_PutBoolean ("config.textmenu", opts->menu == OPTVAL_PC);
|
res_PutBoolean ("config.textmenu", opts->menu == OPTVAL_PC);
|
||||||
|
|||||||
+13
-10
@@ -202,8 +202,8 @@ main (int argc, char *argv[])
|
|||||||
initIO ();
|
initIO ();
|
||||||
prepareConfigDir (options.configDir);
|
prepareConfigDir (options.configDir);
|
||||||
|
|
||||||
PlayerOne = CONTROL_TEMPLATE_KB_1;
|
PlayerControls[0] = CONTROL_TEMPLATE_KB_1;
|
||||||
PlayerTwo = CONTROL_TEMPLATE_JOY_1;
|
PlayerControls[1] = CONTROL_TEMPLATE_JOY_1;
|
||||||
|
|
||||||
// Fill in the options struct based on uqm.cfg
|
// Fill in the options struct based on uqm.cfg
|
||||||
res_LoadFilename (configDir, "uqm.cfg");
|
res_LoadFilename (configDir, "uqm.cfg");
|
||||||
@@ -347,25 +347,28 @@ main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (res_HasKey ("config.pulseshield"))
|
if (res_HasKey ("config.pulseshield"))
|
||||||
{
|
{
|
||||||
options.whichShield = res_GetBoolean ("config.pulseshield") ? OPT_3DO : OPT_PC;
|
options.whichShield =
|
||||||
|
res_GetBoolean ("config.pulseshield") ? OPT_3DO : OPT_PC;
|
||||||
}
|
}
|
||||||
if (res_HasKey ("config.player1control"))
|
if (res_HasKey ("config.player1control"))
|
||||||
{
|
{
|
||||||
PlayerOne = res_GetInteger ("config.player1control");
|
PlayerControls[0] = res_GetInteger ("config.player1control");
|
||||||
/* This is an unsigned, so no < 0 check is necessary */
|
/* This is an unsigned, so no < 0 check is necessary */
|
||||||
if (PlayerOne >= NUM_TEMPLATES)
|
if (PlayerControls[0] >= NUM_TEMPLATES)
|
||||||
{
|
{
|
||||||
log_add (log_Error, "Illegal control template '%d' for Player One.", PlayerOne);
|
log_add (log_Error, "Illegal control template '%d' for Player "
|
||||||
PlayerOne = CONTROL_TEMPLATE_KB_1;
|
"One.", PlayerControls[0]);
|
||||||
|
PlayerControls[0] = CONTROL_TEMPLATE_KB_1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (res_HasKey ("config.player2control"))
|
if (res_HasKey ("config.player2control"))
|
||||||
{
|
{
|
||||||
/* This is an unsigned, so no < 0 check is necessary */
|
/* This is an unsigned, so no < 0 check is necessary */
|
||||||
PlayerTwo = res_GetInteger ("config.player2control");
|
PlayerControls[1] = res_GetInteger ("config.player2control");
|
||||||
if (PlayerTwo >= NUM_TEMPLATES)
|
if (PlayerControls[1] >= NUM_TEMPLATES)
|
||||||
{
|
{
|
||||||
log_add (log_Error, "Illegal control template '%d' for Player Two.", PlayerTwo);
|
log_add (log_Error, "Illegal control template '%d' for Player "
|
||||||
|
"Two.", PlayerControls[1]);
|
||||||
PlayerTwo = CONTROL_TEMPLATE_JOY_1;
|
PlayerTwo = CONTROL_TEMPLATE_JOY_1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user