mirror of
https://github.com/Cesarus85/ringfall-mjolnir-vr.git
synced 2026-10-24 01:00:30 +02:00
Custom Edition Map Discrepancy Fixes
Fixed: Weapons whose trigger had flag "analog rate of fire" now read how far the trigger is pulled: fully for mouse/keyboard, the actual pressure for a controller trigger. Before they never fired. source/input/input_abstraction.c source/input/input_abstraction.h source/game/player_control.c Fixed: Weapon spawn orientation on Custom Edition maps. Multiplayer weapons and items now spawn facing the way the map places them, as in Halo PC. source/game/game_engine.c Added: PC vehicle set. There's a new PC option in the vehicle set list, between Gun Turrets and Custom. A team set to PC gets every vehicle the map places, as in Halo PC. On Custom Edition maps that means every placement whose spawn flags name the gametype. port/assets/menus/ce/strings.xml port/linux/game/menu_functions.c source/game/game_engine.h source/game/game_engine.c Added: Start LAN, internet and split screen games alone. A game with one machine and one player can now start. Pressing start alone begins the countdown, others can join while the game is in progress, and the lobby no longer says it's waiting for another machine or player. source/networking/network_server_manager.c source/interface/ui_widget_game_data_input_functions.c
This commit is contained in:
1 parent
34e2d4fdd8
commit
6b1d81c7b1
9 files changed
+73
-16
No files matched your search
@@ -1111,6 +1111,7 @@
|
||||
<string text="ROCKET WARTHOGS"/>
|
||||
<string text="BANSHEES"/>
|
||||
<string text="GUN TURRETS"/>
|
||||
<string text="PC"/>
|
||||
<string text="CUSTOM"/>
|
||||
</strings>
|
||||
<strings name="main_menu/settings_select/multiplayer_setup/vehicle_options_edit/var_vehicles_respawn">
|
||||
|
||||
@@ -4727,8 +4727,9 @@ static char const *const vehicle_spinners[NUMBER_OF_VARIANT_VEHICLES] =
|
||||
{
|
||||
"warthog_spinner", "ghost_spinner", "scorpion_spinner", "rwarthog_spinner", "banshee_spinner", "cgturret_spinner"
|
||||
};
|
||||
/* (the presets' spinner: the vehicle sets 0 to 7, then CUSTOM) */
|
||||
#define VEHICLE_PRESET_CUSTOM 8
|
||||
/* (the presets' spinner: the vehicle sets 0 to 7, then PC and CUSTOM) */
|
||||
#define VEHICLE_PRESET_PC 8
|
||||
#define VEHICLE_PRESET_CUSTOM 9
|
||||
|
||||
static struct widget_instance *vehicle_spinner(struct widget_instance *list, char const *name)
|
||||
{
|
||||
@@ -4756,7 +4757,8 @@ static void vehicles_show(struct widget_instance *list)
|
||||
spinner->parameters.list.selected_index = side;
|
||||
if ((spinner = vehicle_spinner(list, "vehicle_presets_spinner")) != NULL)
|
||||
spinner->parameters.list.selected_index = options->vehicle_set[side] == VARIANT_VEHICLE_SET_CUSTOM ?
|
||||
VEHICLE_PRESET_CUSTOM : (short)MIN(options->vehicle_set[side], VEHICLE_PRESET_CUSTOM - 1);
|
||||
VEHICLE_PRESET_CUSTOM : options->vehicle_set[side] == VARIANT_VEHICLE_SET_PC ?
|
||||
VEHICLE_PRESET_PC : (short)MIN(options->vehicle_set[side], VEHICLE_PRESET_PC - 1);
|
||||
for (index = 0; index < NUMBER_OF_VARIANT_VEHICLES; index++)
|
||||
{
|
||||
if ((spinner = vehicle_spinner(list, vehicle_spinners[index])) != NULL)
|
||||
@@ -4778,7 +4780,8 @@ static void vehicles_keep(struct widget_instance *list)
|
||||
return;
|
||||
if ((spinner = vehicle_spinner(list, "vehicle_presets_spinner")) != NULL)
|
||||
options->vehicle_set[side] = spinner->parameters.list.selected_index >= VEHICLE_PRESET_CUSTOM ?
|
||||
VARIANT_VEHICLE_SET_CUSTOM : (byte)spinner->parameters.list.selected_index;
|
||||
VARIANT_VEHICLE_SET_CUSTOM : spinner->parameters.list.selected_index == VEHICLE_PRESET_PC ?
|
||||
VARIANT_VEHICLE_SET_PC : (byte)spinner->parameters.list.selected_index;
|
||||
for (index = 0; index < NUMBER_OF_VARIANT_VEHICLES; index++)
|
||||
{
|
||||
if ((spinner = vehicle_spinner(list, vehicle_spinners[index])) != NULL)
|
||||
|
||||
@@ -590,6 +590,7 @@ struct network_game *network_game_server_get_game(struct network_game_server *se
|
||||
#include "text/unicode.h"
|
||||
#include "units/bipeds.h"
|
||||
#include "units/units.h"
|
||||
#include "custom_edition_cache.h" /* port: port/linux/game/custom_edition_cache.c */
|
||||
|
||||
/* network_game_globals.c's */
|
||||
boolean network_game_distributed_client(void);
|
||||
@@ -7104,6 +7105,8 @@ boolean game_engine_vehicle_placement_allowed(
|
||||
return TRUE;
|
||||
side = global_variant.universal_variant.teams ? game_engine_nearest_team(&placement->position) : 0;
|
||||
set = options->vehicle_set[side];
|
||||
if (set == VARIANT_VEHICLE_SET_PC)
|
||||
return TRUE;
|
||||
type = game_engine_variant_vehicle_type(TAG_BLOCK_GET_ELEMENT(palette, placement->palette_entry_index,
|
||||
struct scenario_object_palette_entry)->reference.index);
|
||||
/* (the map's own: the multiplayer ones of the globals, as the Xbox
|
||||
@@ -7203,6 +7206,13 @@ long game_engine_remap_vehicle(
|
||||
(port/linux/game/custom_edition_objects.c) */
|
||||
if (custom_edition_vehicles_by_placement())
|
||||
return result;
|
||||
/* port: and the PC vehicle set's are every one the map places
|
||||
(game_engine_vehicle_placement_allowed) */
|
||||
if (game_engine && (game_variant_options_get()->vehicle_set[0] == VARIANT_VEHICLE_SET_PC ||
|
||||
game_variant_options_get()->vehicle_set[1] == VARIANT_VEHICLE_SET_PC))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (game_engine)
|
||||
{
|
||||
struct game_globals *game_globals;
|
||||
@@ -8396,6 +8406,10 @@ static void game_engine_update_item_spawn(
|
||||
definition_index,
|
||||
NONE);
|
||||
placement_data.position = equipment->position;
|
||||
/* port: Halo PC faces a Custom Edition map's items the way
|
||||
their placements do, where the Xbox copied only the position */
|
||||
if (custom_edition_cache_tags_loaded())
|
||||
vector3d_from_angle(&placement_data.forward, equipment->facing);
|
||||
object_index = object_new(&placement_data);
|
||||
if (object_index != NONE)
|
||||
{
|
||||
|
||||
@@ -206,7 +206,9 @@ enum
|
||||
NUMBER_OF_VARIANT_VEHICLES,
|
||||
MAXIMUM_VARIANT_VEHICLE_COUNT = 4,
|
||||
/* a team's vehicles: those of a vehicle set (universal_variant's
|
||||
vehicle_set values), else its counts */
|
||||
vehicle_set values), else every one the map places, as Halo PC places
|
||||
them (PC), else its counts */
|
||||
VARIANT_VEHICLE_SET_PC = 0xFE,
|
||||
VARIANT_VEHICLE_SET_CUSTOM = 0xFF
|
||||
};
|
||||
|
||||
|
||||
@@ -240,7 +240,6 @@ enum mouse_button
|
||||
|
||||
real const MOUSE_YAW_SCALE = 0.0031415927f;
|
||||
real const MOUSE_PITCH_SCALE = 0.0031415927f;
|
||||
static real const ANALOG_BUTTON_SCALE = 1.f / 255.f;
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -1366,8 +1365,10 @@ static void get_local_player_input_blob(
|
||||
}
|
||||
}
|
||||
|
||||
input->primary_trigger =
|
||||
(real)input_state->buttons[_button_fire] * ANALOG_BUTTON_SCALE;
|
||||
/* port: the fire control's pull, not how long it is held
|
||||
(input_abstraction_port_primary_trigger) */
|
||||
input->primary_trigger = effective_buttons[_button_fire] ?
|
||||
input_abstraction_port_primary_trigger(gamepad_index) : 0.f;
|
||||
SET_FLAG(
|
||||
input->unit_control_flags,
|
||||
_unit_control_weapon_primary_trigger_bit,
|
||||
|
||||
@@ -295,6 +295,29 @@ byte input_abstraction_port_accept(
|
||||
keyboard_controls[controller_index].ticks[_game_control_jump] : 0;
|
||||
}
|
||||
|
||||
/* port: how far the controller's player pulls the fire control, which a
|
||||
trigger with an analog rate of fire reads (weapons.c): a game input state's
|
||||
buttons count the ticks a control is held, not its pressure, so a click
|
||||
reads as no pull at all. The keyboard and mouse pull all the way. */
|
||||
real input_abstraction_port_primary_trigger(
|
||||
short controller_index)
|
||||
{
|
||||
struct gamepad_state const *gamepad;
|
||||
short button_index;
|
||||
|
||||
if (controller_index < 0 || controller_index >= MAXIMUM_GAMEPADS)
|
||||
return 0.f;
|
||||
if (keyboard_controls[controller_index].ticks[_game_control_primary_trigger])
|
||||
return 1.f;
|
||||
gamepad = input_get_gamepad_state(controller_index);
|
||||
if (!gamepad)
|
||||
return 0.f;
|
||||
button_index = input_abstraction_globals.player_control_preferences[controller_index].game_control_to_xbox_buttons[_game_control_primary_trigger];
|
||||
if (button_index < NUMBER_OF_GAMEPAD_ANALOG_BUTTONS)
|
||||
return gamepad->analog_buttons[button_index] * (1.f / 255.f);
|
||||
return gamepad->buttons[button_index] ? 1.f : 0.f;
|
||||
}
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
void input_abstraction_initialize(
|
||||
|
||||
@@ -60,6 +60,8 @@ byte input_abstraction_port_accept(
|
||||
short controller_index);
|
||||
boolean input_abstraction_port_action_only(
|
||||
short controller_index);
|
||||
real input_abstraction_port_primary_trigger(
|
||||
short controller_index);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -2933,14 +2933,15 @@ static void multiplayer_game_directions(
|
||||
|
||||
if (server)
|
||||
{
|
||||
/* port: one machine and one player may start (server_alone) */
|
||||
boolean waiting_for_machines = !network_game_is_splitscreen_local() &&
|
||||
game &&
|
||||
game->machine_count < 2;
|
||||
game->machine_count < 1;
|
||||
|
||||
if (!waiting_for_machines &&
|
||||
network_game_is_splitscreen_local() &&
|
||||
game &&
|
||||
game->player_count < 2)
|
||||
game->player_count < 1)
|
||||
{
|
||||
widget->parameters.text_box.string_list_index =
|
||||
_multiplayer_game_text_string_waiting_for_player;
|
||||
|
||||
@@ -2982,8 +2982,9 @@ boolean server_has_enough_machines(
|
||||
struct network_game_server *server)
|
||||
{
|
||||
boolean has_enough_machines;
|
||||
long minimum_machine_count =
|
||||
network_game_is_splitscreen_local() ? 1 : 2;
|
||||
/* port: a system link or internet game starts with the host's machine
|
||||
alone, and others join it in progress */
|
||||
long minimum_machine_count = 1;
|
||||
long machine_count = 0;
|
||||
long client_machine_index;
|
||||
|
||||
@@ -3005,13 +3006,21 @@ boolean server_has_enough_machines(
|
||||
return has_enough_machines;
|
||||
}
|
||||
|
||||
/* port: a game's one player, with no one else in it yet, may start it:
|
||||
a system link or internet game's host, or split screen's first player */
|
||||
static boolean server_alone(
|
||||
struct network_game_server *server)
|
||||
{
|
||||
return server->game.player_count == 1;
|
||||
}
|
||||
|
||||
boolean server_ok_to_countdown(
|
||||
struct network_game_server *server)
|
||||
{
|
||||
if (server_has_enough_machines(server) &&
|
||||
server_has_a_player_on_each_machine(server) &&
|
||||
!server_needs_more_teams(server) &&
|
||||
server->game.player_count >= server->game.minimum_players)
|
||||
(!server_needs_more_teams(server) || server_alone(server)) &&
|
||||
(server->game.player_count >= server->game.minimum_players || server_alone(server)))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -3172,7 +3181,7 @@ boolean network_game_server_game_can_start(
|
||||
match_assert(NETWORK_SERVER_MANAGER_FILE, 0x782, server);
|
||||
|
||||
return server->state == 0 &&
|
||||
server->game.player_count >= server->game.minimum_players;
|
||||
(server->game.player_count >= server->game.minimum_players || server_alone(server));
|
||||
}
|
||||
|
||||
void network_game_server_pause_countdown(
|
||||
@@ -3672,7 +3681,8 @@ void network_game_server_update_countdown(
|
||||
else
|
||||
{
|
||||
if (network_game_should_accept_remote_connections() == FALSE ||
|
||||
network_game_server_get_client_machine_count(server) > 1)
|
||||
network_game_server_get_client_machine_count(server) > 1 ||
|
||||
server_alone(server))
|
||||
{
|
||||
unsigned long countdown;
|
||||
|
||||
|
||||
Reference in new issue
Block a user