Compare commits

...
Author SHA1 Message Date
Stefan MaierandClaude Opus 5.5 24ddaecd78 Merge upstream/main (2026-10-23): OpenCE network version 36
New gametypes (SWAT, Infection, Gun Game, Hardcore), shield effects the
host's choice in network games, co-op ally friendly fire, network fixes
(scenery shields, tripmines, co-op teleports), Custom Edition HUD and
texture fixes, ASTC for Android GPUs without S3TC.

Left out on purpose: upstream's two Android workarounds for Mali phones,
the GL shadow state refreshed before every draw (prepare_draw) and the
geometry cache bypassed (mirror_range). Both would cost every draw of
both eyes on the Quest, which never showed the corruption they work
around; their tests are skipped. Conflicts: the GL capabilities log
keeps multiview and adds ASTC; xbox_textures.c keeps vr.c's texture work
counters; README.md stays the player's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 21:58:11 +02:00
bnunu dedb3755d4 Merge pull request #462 from OpenCommunityEdition/testing
Merge Testing
2026-10-23 14:03:01 -04:00
bnunu d86e8b01ee Merge branch 'main' into testing 2026-10-23 13:34:20 -04:00
bnunu 3a917551ca Merge pull request #460 from bnunu/halo-ce-universal/coop-client-floor-plane
Co-op clients take a teleport that leaves their feet on a floor's plane
2026-10-23 09:35:48 -04:00
Jonas VolmanandClaude Opus 5.5 d17ecdd6ad Co-op clients take a teleport that leaves their feet on a floor's plane
After 343 Guilty Spark's flood cutscene (x50) with three or more players, a
client could stay on its own screen where the cutscene had parked its
player (at player0_int_base or player1_int_base) while the host had it in
the room. That client saw everyone but itself in the first Flood fight.

A client keeps its own player where it is while the host's position for it
is outside the client's loaded BSP (a BSP switch still on its way). That
was tested at the unit's feet. A teleport can leave the feet a few
millionths below the floor's plane (z -3.1e-6 on the control room's floor
at 0), which bsp3d_test_point counts as solid, so the client never took the
host's position. In a two-player game the only client is player0, whose
spot happens to test inside.

The test now uses the unit's middle: the host's position plus the client's
own feet-to-bounding-sphere offset, against its own bounding sphere center.

Checked on Windows: a hidden c10 host, two joining copies and a system link
bot, the cutscene played and skipped. Before, both clients stayed at the
parking spot; after, every machine has all four players in the room, and
each client still waited at the cutscene's two BSP switches until it had
loaded the BSP. test_elevator_correction passes (its fake object gains
bounding_sphere_center). No network version change: nothing the machines
send or agree on changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 06:33:13 -07:00
bnunu 3c7fe4594c Merge pull request #463 from bnunu/host-shield-effects
Make the shield effects the host's choice in network games
2026-10-23 09:12:00 -04:00
bnunuandClaude Opus 5.5 63fd36775e Make the shield effects the host's choice in network games
The shield glow (display.shield_glow and its Light Show intensity) and the
overshield effect (display.overshield_effect) were each player's own, in
network games too. The glow lights what is around a shield as it flares,
so a player who had it saw enemies a player without it did not, and the
overshield effect keeps an overshielded player lit: anyone who did not
turn them on was at a disadvantage.

Now a network game's are the host's, for every machine: SHIELD EFFECTS in
Server Setup > Player Options (network.shield_effects): STOCK (the
default), GLOW, LIGHT SHOW, OVERSHIELD, GLOW+OVERSHIELD or
SHOW+OVERSHIELD. Each player's own settings apply offline only (the
campaign, split screen), and Video Setup's helps say so.

- network_shield_effects.c: the host sends its choice to each client
  reliably when it is ready (distributed message 91) and to them all when
  it changes, as the aim assist policy is sent; a client takes it only
  from the host's stream, whole and valid, and draws stock until it has it.
  shield_glow.c and overshield_effect.c draw what it says in a network
  game.
- Network version 36: a build that would draw its player's own cannot
  join. network_format.txt recorded.
- Player Options' rows 27 apart in place of 30 (ce_menus.py's
  CHILD_OFFSETS), so that the tenth fits above the help, which keeps its
  three lines, and the screen's divider and buttons stay where they were;
  test_aim_assist.py's layout check follows.

Checked: ninja android builds, the changed files compile for the web, and
CI's tests pass (936). On the Android emulator, Player Options shows the
row and steps through its values with each value's help, and Extra
Effects shows its new helps. Not played as a network game.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 05:57:35 -07:00
bnunu 83ae96e2d7 Merge pull request #456 from bnunu/android-etc2-transcode
Give Android GPUs without S3TC DXT1 textures as ASTC 4x4, by moving bits (no encoder)
2026-10-23 08:08:53 -04:00
Jonas VolmanandClaude Opus 5.5 99c2030784 Give Android GPUs without S3TC DXT1 textures as ASTC 4x4, by moving bits
On Android GPUs without S3TC (Mali), DXT textures are decoded on the CPU
and uploaded as 32-bit texels, 8 times DXT1's 4 bits. A DXT1 block is two
565 colors and a 2-bit index per texel, which an ASTC 4x4 block holds
nearly as it is, so where the driver has KHR_texture_compression_astc_ldr
each DXT1 block is now rewritten as an ASTC block (dxt1_astc_block):
8 bits a texel on the GPU, with no encoder, no search and no threads.
- Four colors (c0 > c1): RGB direct endpoints of 8 bits, weights of 0,
  21, 43 and 64 sixty-fourths for DXT's thirds.
- Three colors, none transparent: weights of 0, 32 and 64 (exact).
- Three colors with transparent texels: two planes (alpha's weights of
  its own) and RGBA endpoints of 7 bits, as many as fit; a transparent
  texel takes the darker color where DXT's is black.
- The endpoints are ordered so that the decoder does not swap them and
  blend blue into the others.

DXT3 and DXT5, whose alpha does not fit beside full colors, are decoded as
before, as are volume textures, the web, and GPUs with S3TC or without
ASTC. display.dxt1_astc (Android only, true) turns it off.

On the four maps measured for the earlier encoder (928 of 1,469 DXT
textures DXT1), DXT1's GPU memory goes from 287 MiB to 72 MiB, all
textures' from 439 MiB to about 224 MiB.

Checked: a one-off check, not
kept, decoded 65,536 blocks with astcenc 5.7.0's decoder: no invalid
blocks, colors within 2 of the
game's DXT1 decode, alpha exact. ninja android builds; the CI test suite
passes. Not run on a device.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 04:43:36 -07:00
bnunu fbc71b42de Merge pull request #461 from bnunu/fix-vehicle-set-strings
Show the PC vehicle set's name and help instead of <missing string>
2026-10-23 07:16:08 -04:00
MrBruh cfb212fed9 Add SWAT, Infection, Gun Game and Hardcore as OpenCE gametypes in their own OPENCE bank of Select Gametype, with an OPENCE OPTIONS screen in the gametype editor. 2026-10-23 23:55:39 +13:00
bnunuandClaude Opus 5.5 782f4ce1bd Show the PC vehicle set's name and help instead of <missing string>
Vehicle Options' VEHICLE SET spinner indexes its strings as the sets 0
to 7, then PC (8) and CUSTOM (9) (menu_functions.c's VEHICLE_PRESET_PC
and VEHICLE_PRESET_CUSTOM), but its list had no PC: a side whose set is
CUSTOM showed "<missing string>", and one whose set is PC showed CUSTOM.

6b1d81c7 added the PC string to strings.xml by hand, and f97b3339 made
strings.xml again with tools/ce_menus.py, which wrote only what
port_settings.py says, so it went. It is now one of port_settings.py's
STRING_INSERTS, where making strings.xml again keeps it, and so is its
help: the helps are the rows' values' in turn (gametype_option_help),
so without one, PC showed CUSTOM's help, CUSTOM the first vehicle
count's, and every count the one before its own.

tools/harness/tests/test_vehicle_set_strings.py checks that the list has
the code's sets, that each value has its help, and that strings.xml has
port_settings.py's inserts. On testing, all three fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 03:10:44 -07:00
bnunu f1066974ca Merge pull request #453 from chestahh/opence-customedition-hudfixes
Fix Custom Edition custom HUD placements, textures and bitmap rendering
2026-10-22 18:55:32 -04:00
chestahh 384d9ba5d0 Fix Custom Edition HUD replacements, meters and gameplay prompts
Match stock CE resource sheets by pixel identity and translate stock meter
redraws to CE layouts. Preserve custom artwork, correct mixed-use meter
channels and warning placement, and draw aligned controller glyphs with
High-Res HUD enabled or disabled. Scope Bigass Open v1.1 ammo changes to
its known map name and checksum.

Based on OpenCE testing 4cb621cd. Keep upstream Android texture ownership,
eviction and validation unchanged; use its residency helper in the new
stock CE upscale lookup. No unrelated main-branch commits, networking
changes, regression test files or investigation documents are included.

Validation: Windows portable release build passed; 175 local CE HUD and
Android regression checks passed, 4 asset-dependent checks skipped.
Additional residency checks cover Android-managed pixels, desktop cache
entries, identity rejection and map reset. git diff --check passed.
Android/Web targets are unavailable in this Windows build graph; no new
runtime gameplay validation was performed for this rebase.

Player-Note: Fix Custom Edition HUDs, ammo counters and prompts while preserving custom artwork.
2026-10-22 23:47:28 +01:00
bnunu 4cb621cd26 Merge pull request #450 from OpenCommunityEdition/fix-scenery-shields-network
Scenery shields break, and tripmines go off, for clients as for the host
2026-10-22 18:25:20 -04:00
Stefan MaierandClaude Opus 5.5 4e9de9a11c Merge upstream/main (2026-10-22): co-op script fixes, cached high_res_hud, menu cursor
Network version stays 32. The conflict in D3DDevice_Present: the swap
stays in the window's branch (VR presents through vr.c); upstream's
visibility_read_batch, after the swap, is desktop GL only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 19:23:25 +02:00
GuvenandClaude Opus 5.5 4ab042e144 The stale player damage test's world has static_target_damage [skip ci]
test_stale_player_damage compiles network_damage_deals from the sources,
which now asks static_target_damage whether damage is a static target's
own; its world had static_target but not that, so the test no longer
compiled (the Linux job's failure since the tripmine commit). Its world has
no static targets, so no damage is one's own.

Checked: test_stale_player_damage and test_static_target pass (33); the
whole harness on Windows fails the same 245 environment-bound tests as
testing, no others.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 14:05:58 +01:00
GuvenandClaude Opus 5.5 962c3eca45 A client's hit on its own copy of a tripmine reaches the host's
A tripmine (Altis94's Bigass) is scenery a grenade's effect makes, so each
machine makes its own copy, at an index of its own: the map's scenery is at
the same index everywhere, but such an object need not be. A client's hit
on its copy named an index at which the host had no such object, and was
refused: clients could not shoot their own tripmines to set them off. And
the host's damage to its copy named an index the client had none at, so the
client's copy did not break or go off on its screen.

A machine given another's index of a static target it has no object at
now takes its own nearest static target where the other had it
(network_damage.c's static_target_near): the host, for a client's hit, its
nearest to where the client had the target, within the target's size and
STATIC_TARGET_MATCH_TOLERANCE (a world unit), and then checks the hit as
any other; a client, for the host's damage, its nearest to the damage,
within REPORT_IMPACT_TOLERANCE and an explosion's radius. The map's
scenery, at the same index everywhere, is found by its index as before.
Part of network version 34 (no message changes); NETCODE.md says so.

Checked: the Windows build; network_format.py; test_static_target with
cases of the nearest static target where another machine had one, none
out of reach, no unit or unbreakable scenery, and the nearer of two, and
two negative controls. Not yet checked in a game: a client shooting its
own tripmine, and seeing the host's go off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 13:52:25 +01:00
bnunu ce95f7deed Merge pull request #424 from eltanschauung/fix/coop-a10-softlock
Fix co-op Pillar of Autumn softlock glitch
2026-10-22 08:36:58 -04:00
bnunu a20ced034c Merge branch 'main' into fix/coop-a10-softlock 2026-10-22 08:36:44 -04:00
GuvenandClaude Opus 5.5 ef0e3be45b The host deals a client's player's tripmine going off under its vehicle
A tripmine a client's player throws (Altis94's Bigass) is scenery the
grenade's effect creates, owned by the thrower, so the explosion of its
shield breaking is theirs too. The host deals no damage of a connected
client's player's but what that client reports, and this explosion went
off where the host had it, its vehicle running over the tripmine, so no
client had a hit of it to report: the host's vehicle drove over a client's
tripmine unharmed, though a host's tripmine hurt clients.

What a static target deals itself (network_damage.c's
static_target_damage: the damage's owner object scenery or a device that
damage can break) the host now deals whoever owns it, and a client does
not report it, so that it is dealt once. Part of network version 34 with
the shields' sharing before it; NETCODE.md says so.

Checked: the Windows build; network_format.py; test_static_target with a
case of a tripmine's own damage, a destructible scenery's, a unit's or
projectile's, and none, and a negative control. Not yet checked in a game:
a client's tripmine under the host's vehicle, and whether the client sees
its own copy of that tripmine go off (a tripmine is made in the game, so
it need not be at the host's index on the client).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 13:35:58 +01:00
GuvenandClaude Opus 5.5 5744d2d174 Clients break and see broken the map's scenery shields, as the host does
A scenery or device whose shield is all damage can break (Rat Race's
energy shields, the tripmines of Altis94's Bigass) was no static target
of the netcode, which took only those with a body to destroy
(network_damage.c's static_target). So a client's hits on it were never
reported to the host and the host never sent its damage: clients could
not break the shields, and when the host broke one, clients still saw it
and stood on it while the host saw them floating.

static_target now takes those with a shield too. The host sends its
damage to them, as to destructible scenery, and takes clients' hits on
them. Clients, which otherwise run no object's shields but take the
host's state of them, run these objects' shield stun and recharge
themselves (damage.c's objects_update_shields), since the host sends no
state of the map's scenery: each machine deals the same damage and
recharges the same way, so the shield's regions go and come back on
every machine.

Network version 34: a host and a client must agree on which objects'
damage is shared. NETCODE.md says so and network_format.txt is recorded
for 34.

Checked: the Windows build; the new harness test test_static_target (a
body, a shield only on scenery and on a device, neither, a unit, no
object, and three negative controls, one the old rule); the whole harness
on Windows fails the same 245 environment-bound tests as testing does,
no others; network_format.py. Not yet checked in a game: a client
breaking Rat Race's shields and Bigass's tripmines, and seeing the host's
broken and recharged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 12:33:06 +01:00
bnunu fc22e8467d Merge pull request #442 from bnunu/cache-high-res-hud-setting
Read display.high_res_hud once per settings change, not at every bind
2026-10-22 06:56:16 -04:00
bnunu 9a1160573f Merge pull request #449 from OpenCommunityEdition/coop-ally-friendly-fire
Co-op hosts can make the players' AI allies immune to their fire
2026-10-22 06:49:23 -04:00
GuvenandClaude Opus 5.5 1d38b3f936 Co-op hosts can make the players' AI allies immune to their fire
Server Setup's Co-op Options has ALLY FRIENDLY FIRE
(network.coop_ally_friendly_fire), ON by default as in the campaign. OFF,
the players' weapons, grenades, melee and vehicles do their AI allies no
damage, so that no player can kill Captain Keyes on Truth and
Reconciliation, the Marines, or the other allies a level needs. The AI's
own hits of its allies, the enemies' damage, and FRIENDLY FIRE between
players are unchanged. A hit is the players' when its owner is a player
and the victim is a friendly unit that is no player's, so friendly-team
vehicles are immune to the players too, splatter included. An ally that
cannot die cannot raise an allegiance incident, so the players cannot turn
the Marines hostile either.

The rule is in game_engine_friendly_damage (game_engine.c), which only the
host's damage reaches: a client's hits are the host's to deal. The host
sends the choice with the game's settings, as bit 1 of network_game's
cooperative_flags beside PLAYER COLLISIONS', so network version 33: a
client of version 32 would play the game's settings without it. NETCODE.md
says so, and network_format.txt is recorded for 33.

The menu row is tools/port_settings.py's (COOP_SETUP_SCREENS); only the
server settings screen was written again. Its 8 rows fit above the help
area.

Checked: the Windows build; the harness tests, the new
test_coop_ally_friendly_fire (a player's hit of an ally ON and OFF, the
AI's own hit, players' friendly fire in every mode, no unit, the campaign
without co-op, and four negative controls) and test_coop_scaling_menu with
the eighth row; network_format.py; the Co-op Options screen drawn with the
row; and in play as the host on a10 and a50 (Keyes and the Marines
unharmed with OFF) and b30 (no splatter). Not yet: a client's hits online,
d20's ending, c20's Sentinels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 10:45:03 +01:00
bnunuandClaude Opus 5.5 038252b1ae Read display.high_res_hud once per settings change, not at every bind
texture_entry_result, reached from every texture bind (even the recent
table's fast path in xgpu_texture_get), called
config_boolean("display.high_res_hud"): the settings' lock and a strcmp
over every setting's name, about 2000 times a frame. It is now read again
only when config_changes() moves, as the renderer's other settings are
(per_pixel_lighting in d3d8_gl.c). config_write, the only writer once the
settings are loaded, counts each change, so a change in the menus takes
effect at the next bind as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 19:48:16 -07:00
bnunu 61621e6513 Merge pull request #435 from bnunu/halo-ce-universal/menu-cursor
The menus show a blue arrow cursor in place of the system's
2026-10-21 19:41:11 -04:00
bnunuandClaude Opus 5.5 1d79584ea4 Hide the menus' cursor while a controller is used
The menus turn the pointer on whenever they are up, so a player on a
controller had the arrow left in the middle of the screen until the menu
closed (as with the system's cursor before). Now a controller's button,
or a stick or trigger past its rest (8000, as gamepad_idle has it), hides
the cursor while a menu is up, and the mouse moved or clicked shows it
again. A menu opened while the controller was used last opens without
it: platform_ui_pointer_set_active hides it again after the release's
SDL_ShowCursor.

The warps are not taken for the mouse being used: the one to the middle
as a menu opens (SDL reports it as motion), and the ones back to where
the mouse is held without relative mode. Hidden, the cursor cannot move
the focus, so the d-pad keeps it. Desktop builds only, as the cursor.

Checked: the new functions built with clang -Wall -Wextra -Werror
against SDL 3.4.16 and run on Windows (a controller hides the cursor in
the menus, not in play; the mouse shows it again). The whole game not
built here, nor played with a controller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 16:40:04 -07:00
bnunuandClaude Opus 5.5 577f718a63 Put the menus' cursor's click point on the arrow's tip
The picture's arrow has a soft edge, so its tip is at (2, 2), not the
picture's corner, where the click point was. MENU_CURSOR_TIP is scaled to
the cursor's size with the picture (rounded): (1, 1) up to 1080p, (2, 2)
at 1440p and 2160p. From GuvenHuso's review.

Checked: built with clang -Wall -Wextra -Werror against SDL 3.4.16 and
run on Windows from 640x480 to 3840x2160, the click point SDL kept read
back at each size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 16:32:10 -07:00
bnunuandClaude Opus 5.5 b68d259c81 Size the menus' cursor to the window, as Halo PC's was
Halo PC drew its cursor in the menus' 640 x 480, so it took the same part
of the screen at any resolution. The cursor was a fixed 20 x 29 (or SDL's
scaling of it on Windows), small at 1440p and 4K. It is now 32 of the
menus' 480 lines tall: 48 pixels at 720p, 72 at 1080p, 96 at 1440p, 144 at
2160p. The lines are the window's height, or for a window narrower than
4:3 its width's three quarters, and the cursor is never under 16 pixels.

menu_cursor_fit makes it from the embedded picture (halved while that is
twice the height or more, then scaled once) and is called at window
creation and at every event pump, where it does nothing unless the
window's size in pixels has changed: resizes and fullscreen toggles
follow. With a pixel density above 1 (macOS, Wayland at a scale) the
cursor is made at its size in points with the pixels' image as its
alternate; SDL_HINT_MOUSE_DPI_SCALE_CURSORS is no longer set, since the
size already comes from the window's pixels.

Checked: the new functions built with clang -Wall -Wextra -Werror
against SDL 3.4.16 and run on Windows at 640x480 to 3840x2160 (cursors
22x32 to 99x144, one made per size change and none when the size is the
same). The cursor SDL makes on Windows matches the picture's rows (the
upside-down arrow seen in an OBS recording was OBS's). The whole game
not built here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 16:03:37 -07:00
bnunu 600edf7bb9 Merge pull request #433 from hkmodd/fix/visibility-readback-nosync
Ask the driver nothing before the swap in the visibility readback
2026-10-21 18:55:09 -04:00
bnunu 0b3b6f0749 Merge pull request #432 from chestahh/opence-android-customedition-fix
Fix Android rendering bugs on Custom Edition maps
2026-10-21 18:31:16 -04:00
bnunu 343716689d Merge branch 'testing' into opence-android-customedition-fix
# Conflicts:
#	.github/workflows/build.yml
2026-10-21 15:23:21 -07:00
Stefan MaierandClaude Opus 5.5 35554cd243 Rename the mod to Mjolnir VR
"Ringfall" is another game's name. Every name players see is now
"Mjolnir VR": the app, the Steam Frame installer and shortcut, the logo
(tools/mjolnir_art.py, was ringfall_art.py), the release's title and
assets (MjolnirVR.apk, mjolnir-vr-android-*.zip,
mjolnir-vr-steam-frame.zip, Install-Mjolnir-VR.desktop), the docs. The
updaters look for Cesarus85/mjolnir-vr, the repository's new name
(GitHub forwards the old one).

Builds 302 to 313 keep working: every release also carries its assets
under their old names, which those builds' updaters and the links
already shared ask for. Kept as they were: the app id, the signing key's
alias, the Steam Frame's ~/Documents/RingfallMjolnirVR and the file
names inside its bundle (an installed game's Steam shortcut starts the
launcher there). The Frame installer now also refreshes the library
pictures of a shortcut that is there already, and says how to rename a
shortcut still called "Ringfall: Mjolnir VR".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:01:25 +02:00
hkmoddandClaude Opus 5.5 a0f22cbba7 Ask the driver nothing before the swap in the visibility readback
The desktop readback through the query buffer (711aa46d, aecdd895) asked
the driver for answers at every present before the swap: a GL error three
times, a fence's state once a batch, and a flush. A threaded driver
(NVIDIA's) answers only once its thread has carried out every command
queued before the question, here the whole frame just drawn, so the
render thread stopped working ahead of the driver at every frame. Build
220's readback asked nothing.

Now a batch is sent before the swap and read after it:

- visibility_send_batch, before the swap, writes VISIBILITY_UNCOPIED over
  the batch's places in the coherent mapping, sends the copies and a
  fence, and asks nothing. GL errors are asked for with debug.gl_debug
  only, as the renderer's other per-frame checks are, and the glFlush is
  gone: the swap sends the commands.
- visibility_read_batch, after the swap, reads a batch only once its
  fence has passed (glClientWaitSync with GL_SYNC_FLUSH_COMMANDS_BIT and
  no wait), so completion is still known from the fence; the batch sent
  that present is looked for from the next one. A batch the GPU is late
  with is waited for however long; none is given up on. A place that
  still holds VISIBILITY_UNCOPIED after the fence is a copy that failed,
  seen without asking for GL errors.
- A batch whose copies or fence failed is dropped, as before, and from
  then on the counts are read from each query, as with AMD's driver: a
  dropped batch is not used again, and with the buffer the readback would
  stop once all three had been.

AMD's CPU readback, the counts, the batches and the query ownership from
711aa46d are unchanged.

Checked: tools/harness/tests/test_visibility_readback.py, 5 cases and 7
negative controls. On the code before (its readback taken as the send,
before the swap), 2 cases fail: the driver asked 46 times before the swap
in 12 presents, and a count that was never copied taken for one.
A 4-machine a50 co-op on an RTX 4080 (Windows, 1440p, 4x MSAA,
debug.gl_debug), 120 seconds: 13000 batches sent and 13000 read, every
fence passed by the next present (none unavailable), no GL error, none
dropped, the buffer used throughout, 8649 nonzero counts. The harness
suite fails the same tests with and without the change (those that need
POSIX headers, on Windows). The Windows release build compiles.

Not checked: Linux, Mesa, Intel, AMD (whose path changes only in being
read after the swap), and a 32-player co-op game.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 18:23:30 +02:00
bnunu 9f04a51259 Merge pull request #429 from eltanschauung/fix/coop-gravity-lift
Fix co-op gravity lift soft lock glitch
2026-10-21 05:35:42 -04:00
bnunu 1ea29f7675 Merge pull request #419 from chestahh/opence-android-render-fix
Fix Android geometry & graphics corruption by bypassing the persistent geometry cache
2026-10-21 03:42:24 -04:00
Jonas VolmanandClaude Opus 5.5 47981601da Credit pugzysixtyfour for the menus' cursor (#435)
The blue arrow cursor this pull request adds (port/assets/cursor) is
pugzysixtyfour's art. AUTHORS.md says so beside the other art credits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 23:49:00 -07:00
Jonas VolmanandClaude Opus 5.5 a4e4bd8317 The menus show a blue arrow cursor in place of the system's.
With a mouse, the menus' pointer (platform_ui_pointer_set_active) was the
system's cursor. The game window now has a cursor of its own:
port/assets/cursor/menu_cursor.png, an 80 x 116 blue arrow with a
transparent background, embedded by tools/embed_assets.py as the window
icon is and made into an SDL colour cursor when the window is created.

At 100% display scale the cursor is the picture at a quarter of its size
(20 x 29, by two halvings); the picture itself is the alternate image SDL
scales from at larger display scales (SDL_HINT_MOUSE_DPI_SCALE_CURSORS,
which SDL implements on Windows). The hot spot is the arrow's tip, the
picture's top-left corner.

Desktop builds only: the code sits beside the window icon's, so Android
and the web keep theirs. The cursor shows wherever SDL shows one over the
window, which is the menus' pointer, the scoreboard's and a mouse freed
with F12; in play the mouse stays captured and hidden as before.

Checked on Windows: the build, and one start to the main menu with a
hidden window. A check line (not in this commit) logged the cursor made
and active, 20 x 29 with the 80 x 116 alternate, and saved SDL's 20 x 29
image, which looks as intended. Not built here for Linux, where SDL uses
the 20 x 29 image at every display scale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 23:40:55 -07:00
chestahh 3975480a3b Fix Android Custom Edition texture residency and draw state
Keep synchronous cached CE pixels and hardware headers at stable addresses
outside the fixed Xbox arena, bounded to 128 MiB and 8192 entries. Only
older-frame textures can be evicted; unregister bindings, GPU copies and
channel annotations before freeing, including map/bitmap teardown and flush.
Preserve the original readers, conversion, normal GPU caching and HUD
replacement behavior. Refresh Android GL shadow state before each draw.

Keep the player-tested Android streaming geometry bypass and its regression
tests, since current upstream main does not contain that fix yet. Desktop
and web preserve their cache, upload and draw-state behavior. No fullscreen,
simulation, networking or map-format changes are included.

The engine-owned bitmap getter and teardown require small source hooks,
each marked port:. The renderer admits heap pixels only through a registered
header and validates the resource extent against its allocation. Diagnostics
are limited to unload summaries and the first allocation warning per lifetime.

Device evidence: the tester reports correct rendering and stable FPS, with
zero allocation failures, fallback substitutions or evictions across four CE
visits on Mali-G615 and 87.5 MiB peak residency. Local tests cover stable
uploads, bounds, OOM, frame locks, eviction, cleanup, HUD residency, reduced
diagnostics, normal write tracking, Android-only state refresh and geometry
streaming. All 30 upstream-focused checks passed before final CI validation.
Full Android/web builds require CI because local targets are unavailable.
No fork packaging, branding, map adapters or unrelated changes are included.

Player-Note: Fix Android Custom Edition texture corruption and repeated cache upload hitches.
Player-Note: Prevent stretched or missing geometry on Android by streaming geometry directly.

(cherry picked from commit 4ac4685b96c39b20491095579ce469f8afcd2d3c)
2026-10-21 01:27:08 +01:00
eltanschauung 9044950d78 Remove unused co-op script test counter (#429)
The CI compiler treats -Wunused-but-set-global as an error. list_count was incremented by the fixture but never read, so remove it instead of weakening compiler warnings. All 12 targeted regressions, including their negative controls, pass. This changes test code only.
2026-10-20 14:23:46 -04:00
eltanschauung 9d7436bd64 Fix co-op gravity lift teleports for extra players
Match the reverse unit order of hs_players when selecting player0 and followers. The forward datum-order assumption returned no followers, leaving players beyond the two named by a50's lift script in the unloaded outdoor BSP.

Tested the actual a50 transition with a host and two clients, including the played and skipped cutscene placement sequences and settled floor positions. Regression coverage exercises 0-128 players, sparse/dead/recycled slots, output bounds, host authority, and every follower action, with negative controls. Windows and Linux release builds pass. This is host-side placement only; the network protocol is unchanged.

(cherry picked from commit 51abcfff9968eee5b91de2bba9d273b70be91850)
2026-10-20 13:25:38 -04:00
bnunu 951b8387dd Merge pull request #425 from OpenCommunityEdition/readme-rewrite 2026-10-20 08:34:08 -04:00
eltanschauung cdce33647a Fix co-op Pillar of Autumn softlock glitch
A co-op ALL-player trigger could advance after an unchecked teleport, or while (players) was empty during respawn. Pillar of Autumn then permanently closed its blast door with players still outside.

Preserve player-list provenance in the existing unused header word, block empty or unavailable player-list waits only on the co-op host, and recheck all arrivals after gathering. Use the existing crowd fallback and restore rejected placements instead of leaving a player outside the volume or on a BSP switch. Empty AI lists, non-waiting tests and non-host behavior retain their semantics; no network message or protocol changes.

Validated with 17 production-source gate tests and negative controls, covering 1-128 players, failed or displaced teleports, BSP boundaries, retries, list reuse, allocation failure and empty AI/player lists. Windows and Linux release builds and the full local regression suite pass.

(cherry picked from commit 49b4716c4be187a16800300671221a964094e6fb)
2026-10-20 07:25:20 -04:00
chestahh 34c17f11fc Use streamed geometry on Android to prevent cache corruption
Affected Android players report that the cache-bypass APK resolves stretched
and missing geometry, with some also reporting better performance. Decline
persistent vertex/index mirror requests on Android so draws use the existing
streaming fallback and current CPU index extents. No settings are needed.
The exact cache failure mechanism remains unconfirmed.

Keep streaming uploads, frame fences, shaders, texture caching and CPU write
tracking unchanged. Desktop and web retain their existing cache paths.
Xbox and Custom Edition loaders are unchanged. No simulation or network
protocol change is involved.

Carry the focused fix onto OpenCE main without fork history. Resolve the CI
entry against upstream's existing test list and omit fork-only documentation.
Add real-source Android, GLES, desktop and web regression controls, including
large/reused ranges, counter rollover and negative controls. All 33 focused
checks passed locally; the resolved files match the tested adaptation.
Local configure cannot fetch SDL3 and has no Android/web targets; CI must
perform full builds. Device evidence is player feedback on the bypass APK,
not a new on-device or cross-platform multiplayer run of this revision.

Player-Note: Prevent stretched or missing geometry on Android by streaming geometry directly.

(cherry picked from commit ea85578bf80c8d937b8c66704aff6cf6aa96e68b)
2026-10-19 20:21:06 +01:00
135 changed files with 7500 additions and 570 deletions

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: How to install
url: https://github.com/Cesarus85/ringfall-mjolnir-vr#install-on-meta-quest-3--3s
url: https://github.com/Cesarus85/mjolnir-vr#install-on-meta-quest-3--3s
about: Step-by-step installation for the Quest 3 / 3S and the Steam Frame.
+24 -16
View File
@@ -13,7 +13,7 @@ name: Build
# - a newer push to the same branch cancels a run still going;
# - pushes that only change documentation do not build;
# - Windows, whose minutes cost twice Linux's, builds only Windows;
# - Ringfall: Mjolnir VR builds only Android (the VR app): the Linux and
# - Mjolnir VR builds only Android (the VR app): the Linux and
# Windows jobs are kept, off (if: false), so that upstream's changes to
# them still merge;
# - artifacts are kept for three days.
@@ -24,7 +24,7 @@ name: Build
# gives the latest build; the last five are kept. Its web build is then the
# site on GitHub Pages (https://halocombatevolved.com/, port/web/README.md).
on:
# (Ringfall: Mjolnir VR: main only; its branches are tried on the headsets
# (Mjolnir VR: main only; its branches are tried on the headsets
# from local builds)
push:
branches: [main]
@@ -52,7 +52,7 @@ env:
jobs:
linux:
# (off: Ringfall: Mjolnir VR ships the Android app only)
# (off: Mjolnir VR ships the Android app only)
if: ${{ false }}
# Arch Linux has what the build needs as packages: clang 22 (for the
# profile-guided optimisation in pgo/), and CMake, pkg-config and
@@ -99,7 +99,7 @@ jobs:
- name: Test
run: |
python -m pytest -q tools/test_linux_port.py tools/test_android_asm_convert.py tools/test_host_watch_hash.py tools/test_touch_menu.py tools/harness tools/test_profile.py tools/stagekit/tests tools/test_net_compare.py
python -m pytest -q tools/test_linux_port.py tools/test_android_asm_convert.py tools/test_android_mirror_uploads.py tools/test_android_ce_texture_cache.py tools/test_host_watch_hash.py tools/test_touch_menu.py tools/harness tools/test_profile.py tools/stagekit/tests tools/test_net_compare.py
python tools/test_light_storage.py
- name: Compile cache
@@ -203,7 +203,7 @@ jobs:
retention-days: 3
windows:
# (off: Ringfall: Mjolnir VR ships the Android app only)
# (off: Mjolnir VR ships the Android app only)
if: ${{ false }}
# The runner image has LLVM, Python and Visual Studio's x86 libraries and
# Windows SDK.
@@ -279,7 +279,7 @@ jobs:
retention-days: 3
web:
# (off: Ringfall: Mjolnir VR ships the Android app only)
# (off: Mjolnir VR ships the Android app only)
if: ${{ false }}
# Emscripten (emsdk, the version below, cached) builds the web port's
# site (port/web/README.md); the tests check its graph, the page's
@@ -389,18 +389,26 @@ jobs:
- name: Package
run: |
mkdir release
# (Ringfall: Mjolnir VR publishes its Android builds only, under
# (Mjolnir VR publishes its Android builds only, under
# its own name: Updater.java looks for them; the desktop ports are
# built to keep them building)
for config in debug release; do
(cd "artifacts/halo-android-$config" &&
zip -qr "$GITHUB_WORKSPACE/release/ringfall-mjolnir-vr-android-$config.zip" .)
zip -qr "$GITHUB_WORKSPACE/release/mjolnir-vr-android-$config.zip" .)
done
# the Steam Frame's installer (port/android/STEAM_FRAME.md): its
# bundle with the release APK, and the desktop file that fetches it
python3 tools/steam_frame_bundle.py artifacts/halo-android-release/app-release.apk release "$GH_REPO"
# the APK itself, for sideloading on the Quest (SideQuest, adb)
cp artifacts/halo-android-release/app-release.apk release/RingfallMjolnirVR.apk
cp artifacts/halo-android-release/app-release.apk release/MjolnirVR.apk
# the same under the names before "Mjolnir VR" (Ringfall: Mjolnir
# VR, builds 302 to 313): their updaters (Updater.java, the Frame's
# launcher) and the links already shared ask for them
cp release/mjolnir-vr-android-debug.zip release/ringfall-mjolnir-vr-android-debug.zip
cp release/mjolnir-vr-android-release.zip release/ringfall-mjolnir-vr-android-release.zip
cp release/mjolnir-vr-steam-frame.zip release/ringfall-mjolnir-vr-steam-frame.zip
cp release/Install-Mjolnir-VR.desktop release/Install-Ringfall-Mjolnir-VR.desktop
cp release/MjolnirVR.apk release/RingfallMjolnirVR.apk
ls -l release
- name: Publish
@@ -415,15 +423,15 @@ jobs:
readme="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
{
printf '%s\n\n' "$subject"
printf '**Ringfall: Mjolnir VR** is an unofficial VR mod for Halo: Combat Evolved. It needs a disc image of your own, purchased Xbox copy of the game; no game files are included.\n\n'
printf '**Mjolnir VR** is an unofficial VR mod for Halo: Combat Evolved. It needs a disc image of your own, purchased Xbox copy of the game; no game files are included.\n\n'
printf '| Headset | Download | How to install |\n| --- | --- | --- |\n'
printf '| Meta Quest 3 / 3S | `RingfallMjolnirVR.apk` | [Install on Quest](%s#install-on-meta-quest-3--3s) |\n' "$readme"
printf '| Steam Frame | `Install-Ringfall-Mjolnir-VR.desktop` (open it in Desktop Mode) | [Install on Steam Frame](%s#install-on-steam-frame) |\n\n' "$readme"
printf 'The other files are for the built-in updater and the Steam Frame installer.\n\n'
printf '| Meta Quest 3 / 3S | `MjolnirVR.apk` | [Install on Quest](%s#install-on-meta-quest-3--3s) |\n' "$readme"
printf '| Steam Frame | `Install-Mjolnir-VR.desktop` (open it in Desktop Mode) | [Install on Steam Frame](%s#install-on-steam-frame) |\n\n' "$readme"
printf 'The other files are for the built-in updater and the Steam Frame installer (those named `ringfall-…` / `Ringfall…`: the same, for the builds before the name Mjolnir VR).\n\n'
printf 'Commit: %s\nBuild: %s\n' "$COMMIT_URL" "$RUN_URL"
} > notes.md
gh release create "$tag" release/* --target "$GITHUB_SHA" --latest \
--title "Ringfall: Mjolnir VR, build $GITHUB_RUN_NUMBER (${GITHUB_SHA:0:7})" --notes-file notes.md
--title "Mjolnir VR, build $GITHUB_RUN_NUMBER (${GITHUB_SHA:0:7})" --notes-file notes.md
echo "tag=$tag" >> "$GITHUB_OUTPUT"
# The Windows builds' executables and PDBs to Sentry, which turns the
@@ -465,7 +473,7 @@ jobs:
done
pages:
# (off: Ringfall: Mjolnir VR ships the Android app only)
# (off: Mjolnir VR ships the Android app only)
if: ${{ false }}
# The release's web build to GitHub Pages, which serves it at
# https://halocombatevolved.com/ (port/web/README.md, "Hosting"). Only
@@ -586,7 +594,7 @@ jobs:
title="Build failed"; color=15548997
fi
latest="$SERVER/$REPOSITORY/releases/latest"
downloads="[Quest]($latest/download/ringfall-mjolnir-vr-android-release.zip) · [Steam Frame]($latest/download/Install-Ringfall-Mjolnir-VR.desktop) ([all builds]($latest))"
downloads="[Quest]($latest/download/mjolnir-vr-android-release.zip) · [Steam Frame]($latest/download/Install-Mjolnir-VR.desktop) ([all builds]($latest))"
if [ -n "$RELEASE_TAG" ]; then
release="[$RELEASE_TAG]($SERVER/$REPOSITORY/releases/tag/$RELEASE_TAG)"
if [ "$PAGES" = success ]; then
+1 -1
View File
@@ -16,7 +16,7 @@ end.
| --- | --- |
| `source/` | The game: 466 C files of the decompilation, compiled as they are with few changes (each marked, below) |
| `port/linux/src/` | The platform layer the three ports share: Direct3D 8 on OpenGL (`d3d8_gl.c`), DirectSound and XInput on SDL3, files, threads, memory, sockets, settings (`port_config.c`), the mods folder (`port_mods.c`), internet play (`p2p*.c`) |
| `port/linux/game/` | The port's game-side code, compiled as the game's sources are: the distributed netcode (`network_*.c`), co-op, map sharing (`map_share*.c`), the menus (`menu_tags.c`, `menu_functions.c`), Custom Edition maps (`custom_edition_*.c`, `cache_file_formats.c`), the tag validator (`tag_validate.c`, `tag_schema_*.c`), mods (`mods.c`, `mod_*.c`), streamer mode's word filter (`text_filter*.c`), touch, FOV and more |
| `port/linux/game/` | The port's game-side code, compiled as the game's sources are: the distributed netcode (`network_*.c`), co-op, OpenCE's gametypes (`game_modes.c`, `infection.c`, `gun_game.c`), map sharing (`map_share*.c`), the menus (`menu_tags.c`, `menu_functions.c`), Custom Edition maps (`custom_edition_*.c`, `cache_file_formats.c`), the tag validator (`tag_validate.c`, `tag_schema_*.c`), mods (`mods.c`, `mod_*.c`), streamer mode's word filter (`text_filter*.c`), touch, FOV and more |
| `port/linux/include/` | The port's headers: the limits (`halo_port_limits.h`, with `HALO_PORT_NETWORK_VERSION`), capacities (`halo_port_capacity.h`), the prefix header, `halo_linux_source_fixups.h` (port functions the game's sources call) |
| `port/include/xdk/` | Stand-ins for the Xbox SDK's headers (declarations only) |
| `port/windows/` | The Windows build's own files (`win32_*.c`, headers) |
+2
View File
@@ -10,6 +10,8 @@
weapons' reticles): redraws by MrBruh (`port/assets/hud`), based on
reference photos by Aerocatia. The sniper rifle's zoom labels (2x, 10x)
are set in Overpass (`port/assets/fonts`).
- **The menus' mouse cursor** (the blue arrow the menus show for the
mouse): by pugzysixtyfour (`port/assets/cursor`).
## Third-party art
+15 -12
View File
@@ -1,22 +1,25 @@
<p align="center">
<img src="port/android/steam_frame_grid/library.png" width="640" alt="Ringfall: Mjolnir VR">
<img src="port/android/steam_frame_grid/library.png" width="640" alt="Mjolnir VR">
</p>
# Ringfall: Mjolnir VR
# Mjolnir VR
**A VR mod for Halo: Combat Evolved** (the original Xbox game) on the
**Meta Quest 3 / 3S** and the **Steam Frame**. Play the campaign and
multiplayer in full 6DoF virtual reality, with your hands in the game.
Ringfall: Mjolnir VR runs on your headset by itself, without a PC. It
Mjolnir VR runs on your headset by itself, without a PC. It
brings no game files: it uses a disc image of **your own, purchased copy**
of the game.
> **Unofficial fan project.** Ringfall: Mjolnir VR is a free,
> **Unofficial fan project.** Mjolnir VR is a free,
> non-commercial fan project. It is not affiliated with, endorsed,
> sponsored or approved by Microsoft, Xbox Game Studios, Halo Studios or
> Bungie. See [Legal](#legal).
Until build 313 it was called *Ringfall: Mjolnir VR*. Installed builds
update to the new name by themselves, and the old links lead here.
## Contents
- [What you get](#what-you-get)
@@ -86,14 +89,14 @@ that it updates itself.
2. **Install [SideQuest](https://sidequestvr.com/setup-howto)** (the
"Advanced Installer") on your computer and connect the Quest with a
USB cable. In the headset, allow USB debugging for this computer.
3. **Download `RingfallMjolnirVR.apk`** from the
3. **Download `MjolnirVR.apk`** from the
[latest release](../../releases/latest) and drag it onto the SideQuest
window. It installs the game.
4. **Copy your disc image** to the Quest's `Download` folder: in
SideQuest, open the file manager (the folder icon), go to `Download`
and drag the `.iso` file in.
5. **In the headset**, open your *Library*, choose *Unknown Sources* and
start **Ringfall: Mjolnir VR**. Select **Choose disc image** and pick
start **Mjolnir VR**. Select **Choose disc image** and pick
your file in `Download`. The game copies what it needs (about 1.8 GB,
a minute or two) and starts.
@@ -108,14 +111,14 @@ No computer and no keyboard needed.
*Switch to Desktop*.
2. **Put your disc image** in the `Downloads` folder (for example from a
USB stick or memory card with the file manager, Dolphin).
3. **Download `Install-Ringfall-Mjolnir-VR.desktop`** from the
3. **Download `Install-Mjolnir-VR.desktop`** from the
[latest release](../../releases/latest) with the web browser.
4. **Open it**: in Dolphin, open `Downloads` and double-click the file.
If you are asked whether to run it, choose to continue.
5. **Answer the dialogs.** The installer finds your disc image, copies
what the game needs, adds **Ringfall: Mjolnir VR** to your Steam
what the game needs, adds **Mjolnir VR** to your Steam
library and offers to switch back to Gaming Mode.
6. Start **Ringfall: Mjolnir VR** from your library (under *Non-Steam*).
6. Start **Mjolnir VR** from your library (under *Non-Steam*).
The game updates itself: when a new version is out, it is downloaded
while you play and used from the next start on. Your settings, saves and
@@ -155,7 +158,7 @@ telemetry.
## Credits
Ringfall: Mjolnir VR stands on the work of others:
Mjolnir VR stands on the work of others:
- **[OpenCE](https://github.com/OpenCommunityEdition/OpenCE)** (Open
Community Edition): the port of the decompiled game to Linux, Windows
@@ -186,7 +189,7 @@ port it is built on.
## Legal
Ringfall: Mjolnir VR is an unofficial, free, non-commercial fan project.
Mjolnir VR is an unofficial, free, non-commercial fan project.
It is not affiliated with, endorsed, sponsored or approved by Microsoft
Corporation, Xbox Game Studios, Halo Studios or Bungie. Halo, Halo: Combat
Evolved and Xbox are trademarks of Microsoft Corporation; they are named
@@ -201,7 +204,7 @@ their games.
### Licence
Ringfall: Mjolnir VR is free software: you can give it to others and change
Mjolnir VR is free software: you can give it to others and change
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, version 3 of the License or (at your option)
any later version (`AGPL-3.0-or-later`), as OpenCE, which it builds on, is.
+1 -1
View File
@@ -1,6 +1,6 @@
# Third-party notices
Ringfall: Mjolnir VR is released under the GNU Affero General Public
Mjolnir VR is released under the GNU Affero General Public
License, version 3 or later ([LICENSE](LICENSE)); releases before build 312
were released under [CC0 1.0](LICENSES/CC0-1.0.txt). It includes or builds
on the following, under their own licenses; each license's full text is in
+1 -1
View File
@@ -1,5 +1,5 @@
> This is the README of [OpenCE](https://github.com/OpenCommunityEdition/OpenCE),
> the port Ringfall: Mjolnir VR is built on, kept for its build and
> the port Mjolnir VR is built on, kept for its build and
> development notes. Its download links are OpenCE's. For the VR mod, see
> the [main README](../README.md).
+24 -6
View File
@@ -1,6 +1,7 @@
# Android
The app of Ringfall: Mjolnir VR (application id `io.github.cesarus85.ringfall`;
The app of Mjolnir VR (application id `io.github.cesarus85.ringfall`, from
the name before, "Ringfall: Mjolnir VR", kept so that installed apps update;
its Java classes keep the decompilation's package, `com.halo.decomp`).
`ninja android` builds the game for 64-bit ARM Android (arm64-v8a).
`ninja android_apk` makes an app from it:
@@ -232,7 +233,7 @@ These settings are only for Android:
| `display.shader_cache` | `true` (the default): the linked shader programs are kept in `shader_cache` in the data folder (their binaries, the driver that made them and their sources), and each map's list of the programs it drew with; as a map loads, the programs on its list are made ready, so that its first frames do not wait for the driver to compile them. A driver update compiles them again from the kept sources. `false`: each program is compiled the first time it is drawn. The folder may be deleted at any time. |
| `display.shader_worker` | `true` (the default): the shader programs are made on a thread of their own, whose GL context shares the game's (loaded from the shader cache, or compiled), and drawn with once there (`debug.shader_warm_up`: `"worker"`, `"load"` on the game's thread as a map loads, or `"off"`); a draw whose program is not made yet is left out for the frames it takes, and the frame does not wait. As a map loads, its own programs and then every map's (`shader_cache/all.txt`) are asked for. `false`: each is made on the game's thread when first drawn with. |
| `debug.sample_seconds` | Refer to "Find problems". |
| `debug.memory_watch` | `true` (the default): the app notices the game's writes to textures and vertices by page protection. `false`: it compares page contents once a frame instead, which is slower. Refer to "Limits". |
| `debug.memory_watch` | `true` (the default): the app notices the game's writes to cached textures by page protection. `false`: it compares page contents once a frame instead, which is slower. Geometry uses the streaming path in either mode. Refer to "Limits". |
## Internet play
@@ -542,6 +543,23 @@ assembly of the port is necessary:
- The symbol aliases in `guest/libc/src_include/features.h`. The Darwin
target does not accept alias attributes.
## Geometry uploads
Android streams vertex and index data from the current CPU bytes instead
of reusing the persistent geometry mirror or its cached index extents.
This is automatic; no console command or configuration change is needed.
Affected players reported that bypassing the cache resolved stretched or
missing geometry, with some also reporting better performance. The exact
cache failure mechanism remains unconfirmed.
The Android-only guard in `mirror_range` uses the existing streaming
fallback. Streamed upload methods, frame fences, shaders, texture caching
and CPU write tracking are unchanged. Desktop and web retain their cache.
Xbox and Custom Edition maps keep their existing loaders and resource
paths. `tools/test_android_mirror_uploads.py` checks the bypass with large
and reused ranges, frame-counter rollover and desktop/web cache controls;
it does not substitute for device gameplay validation.
## Find problems
- Enter `adb logcat -s halo` to see the log of the port and the errors of
@@ -571,11 +589,11 @@ assembly of the port is necessary:
operate. The Xbox memory uses 4 KB pages.
- The x86 Android emulator runs the app through its ARM translation. The
translation cannot deliver the page faults that the renderer uses to
notice changed textures and vertices. On the emulator the app compares
notice changed textures. On the emulator the app compares
page contents once a frame instead ("write tracking: page hashes" in the
log). This is slower, and a write shows one frame later, so moving
geometry can glitch briefly. `debug.memory_watch = false` does the same
on a device. The translation also has no scalar conversion from floating
log). This is slower, and texture changes may appear one frame later.
`debug.memory_watch = false` does the same on a device. The translation
also has no scalar conversion from floating
point to an integer in a SIMD register (`fcvtzs s0, s1`, an illegal
instruction there), so `tools/android_asm_convert.py` writes each as the
vector form, which leaves the register and the exception flags the same.
+8 -6
View File
@@ -10,10 +10,10 @@ On the Frame, in Desktop Mode (Steam menu > Power > Switch to Desktop):
1. Put your own disc image of Halo: Combat Evolved for the original Xbox (`.iso` or
`.xiso`, any version) in Downloads (or Documents, the Desktop, a memory
card).
2. Download `Install-Ringfall-Mjolnir-VR.desktop` from the latest release and open it
2. Download `Install-Mjolnir-VR.desktop` from the latest release and open it
(double-click; confirm running it).
3. Answer the dialogs: the installer finds the disc image (or asks for it),
copies the game data out of it, adds "Ringfall: Mjolnir VR" to the Steam library
copies the game data out of it, adds "Mjolnir VR" to the Steam library
and switches back to Gaming Mode. Start it from the library there.
The game updates itself: while it runs, its launcher looks for a newer
@@ -23,18 +23,20 @@ release, fetches it and puts it in place as the next start begins
too (settings, saves and game data stay).
The desktop file (`steam_frame_installer.desktop`) downloads the latest
release's `ringfall-mjolnir-vr-steam-frame.zip` (`tools/steam_frame_bundle.py`, made by
release's `mjolnir-vr-steam-frame.zip` (`tools/steam_frame_bundle.py`, made by
the release job of `.github/workflows/build.yml`) and runs its
`install.sh` (`steam_frame_install.sh`), with zenity dialogs:
- `~/Documents/RingfallMjolnirVR`: the launcher (`ringfall-mjolnir-vr.sh`)
and the release APK (`RingfallMjolnirVR.apk`); the folder of the builds
before the name, `~/Documents/HaloCE`, renamed to it, and their "Halo VR"
shortcut replaced;
shortcut replaced. (These keep the name of builds 302 to 313, "Ringfall:
Mjolnir VR": the Steam shortcut of an installed game starts the launcher
there, and the launcher's update looks for them in the bundle.);
- the maps folder out of the disc image (`steam_frame_xiso.py`, the app's
`XisoExtractor.java` in Python), unless `maps/ui.map` is there;
- the Steam shortcut, unless it is there: added by Steam itself
(`steam://addnonsteamgame`, as SteamOS's "Add to Steam" does) from
`Ringfall Mjolnir VR.desktop` beside the game, then the library pictures
`Mjolnir VR.desktop` beside the game, then the library pictures
under the id Steam gave it. Steam is not closed: on the Frame, Desktop
Mode runs inside Gaming Mode's session, and closing Steam ends it (and the
installer with it). An old "Halo VR" shortcut is left for the player to
@@ -83,7 +85,7 @@ dialogs, for testing over adb; it leaves Steam and its shortcuts alone.
## Starting it on the Frame
A button in the Steam library ("Ringfall: Mjolnir VR", a non-Steam game)
A button in the Steam library ("Mjolnir VR", a non-Steam game)
runs `~/Documents/RingfallMjolnirVR/ringfall-mjolnir-vr.sh` (`port/android/steam_frame_launch.sh`),
which starts the game as Steam starts an Android title of its own:
`lepton waitforexitandrun -- ~/Documents/RingfallMjolnirVR/RingfallMjolnirVR.apk`, in a container
+2 -1
View File
@@ -1,6 +1,6 @@
# VR roadmap
What Ringfall: Mjolnir VR (Quest 3, Steam Frame) has, and what comes next, in the
What Mjolnir VR (Quest 3, Steam Frame) has, and what comes next, in the
agreed order. Updated with every step: a step is **done** once the user has
tried it in the headset and it is merged into `main`; **built** means in a
branch, not yet tried in the headset.
@@ -46,6 +46,7 @@ named where code is taken over.
| 4 | Later: disc image import in the launcher; moving by swinging the arms (in place of the stick, never faster than it: online too), and a sprint by swinging them harder (faster than the game allows: offline only) | import **done** (in `main` 2026-10-06): the app's import (tried on the Quest 3: all 24 maps; on the Frame kept in `~/Documents/RingfallMjolnirVR`), a Steam Frame installer from Desktop Mode (`STEAM_FRAME.md`; tried on the Frame: the old folder renamed, the shortcut added by Steam), a release signing key (CI and local builds the same). Arm swinging and its offline sprint still open |
| 5 | Later: multiview again (both eyes in one pass, half the drawing's CPU cost): find why its eyes do not fuse in big online games on the Quest 3 (and now and then on the Steam Frame), then turn it back on | open: off by default since 2026-10-16 (`debug.multiview`); findings in the open points |
| R | Release as **Ringfall: Mjolnir VR** (no "Halo" in the product's name): app name, id `io.github.cesarus85.ringfall`, icon and library pictures (`tools/ringfall_art.py`), Frame folder and installer, release assets, README; the repository renamed | **done** (in `main` 2026-10-06; Quest 3 and Steam Frame good) |
| R2 | Renamed **Mjolnir VR** ("Ringfall" is another game's name): app and Steam names, logo (`tools/mjolnir_art.py`), release assets (also under the old names for the updaters of builds 302 to 313), updaters, README; the repository renamed `Cesarus85/mjolnir-vr` (GitHub forwards the old links). Kept: the app id, the signing key's alias, the Frame's `~/Documents/RingfallMjolnirVR` and the names inside its bundle (installed games and their shortcuts) | in `feature/rename-mjolnir-vr` (2026-10-21) |
## Step 2, first part (done)
@@ -147,7 +147,7 @@ public class LauncherActivity extends Activity {
layout.setBackgroundColor(Color.rgb(12, 16, 20));
TextView title = new TextView(this);
title.setText("Ringfall: Mjolnir VR needs game data");
title.setText("Mjolnir VR needs game data");
title.setTextColor(Color.WHITE);
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 24);
title.setGravity(Gravity.CENTER);
@@ -36,7 +36,7 @@ import java.util.zip.ZipInputStream;
* the latest release when it starts, on a thread of its own, and if it is
* newer asks the player whether to update:
*
* - Yes: the release's app (ringfall-mjolnir-vr-android-release.zip or
* - Yes: the release's app (mjolnir-vr-android-release.zip or
* -debug.zip) is
* downloaded and handed to Android's package installer, which replaces the
* game (closing it) and offers to open the new version.
@@ -53,8 +53,8 @@ import java.util.zip.ZipInputStream;
final class Updater {
/* the VR port's own releases: the original's, made without VR, must
never replace it (they share the package name) */
private static final String APP_NAME = "Ringfall: Mjolnir VR";
private static final String REPOSITORY = "Cesarus85/ringfall-mjolnir-vr";
private static final String APP_NAME = "Mjolnir VR";
private static final String REPOSITORY = "Cesarus85/mjolnir-vr";
private static final String USER_AGENT = "halo-ce-universal-updater";
private static final int TIMEOUT_MILLISECONDS = 20000;
/** the most a download (a release's zip, about 35 MB) or the app in it may be */
@@ -240,7 +240,7 @@ final class Updater {
/* ---------- updating */
private static void update(Activity activity, int latest) {
String asset = "ringfall-mjolnir-vr-android-" + (BuildConfig.DEBUG ? "debug" : "release") + ".zip";
String asset = "mjolnir-vr-android-" + (BuildConfig.DEBUG ? "debug" : "release") + ".zip";
File directory = new File(activity.getCacheDir(), UpdateProvider.DIRECTORY);
LinearLayout layout = new LinearLayout(activity);
TextView status = new TextView(activity);
@@ -153,7 +153,7 @@ final class XisoExtractor {
break;
}
}
// (Ringfall: a European disc in two languages, Spanish and Italian,
// (Mjolnir VR: a European disc in two languages, Spanish and Italian,
// has no maps folder but one for each, maps_es and maps_it: the
// device's language's is taken, else English's, else the first, and
// its language written to maps/language.txt, which the game asks the
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Ringfall: Mjolnir VR</string>
<string name="app_name">Mjolnir VR</string>
</resources>
+2 -2
View File
@@ -65,7 +65,7 @@ void host_fatal(const char *format, ...)
vsnprintf(message, sizeof(message), format, arguments);
va_end(arguments);
__android_log_write(ANDROID_LOG_FATAL, "halo", message);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Ringfall: Mjolnir VR", message, NULL);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Mjolnir VR", message, NULL);
_exit(1);
}
@@ -540,7 +540,7 @@ int main(int argc, char *argv[])
{
(void)argc;
(void)argv;
host_logf(HOST_LOG_INFO, "Ringfall: Mjolnir VR starting");
host_logf(HOST_LOG_INFO, "Mjolnir VR starting");
host_install_signal_handlers();
if (host_native_thread_create(game_main, NULL, MAIN_STACK_SIZE) != 0)
host_fatal("cannot start the game thread");
+2 -2
View File
@@ -1256,7 +1256,7 @@ with vr.log_performance: host_main.c) */
android.applicationVM = machine;
android.applicationActivity = activity;
instance.next = &android;
strcpy(instance.applicationInfo.applicationName, "Ringfall Mjolnir VR");
strcpy(instance.applicationInfo.applicationName, "Mjolnir VR");
instance.applicationInfo.applicationVersion = 1;
strcpy(instance.applicationInfo.engineName, "halo-ce-universal");
instance.applicationInfo.engineVersion = 1;
@@ -2275,7 +2275,7 @@ void host_xr_test(void)
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
window = SDL_CreateWindow("Ringfall: Mjolnir VR", 640, 480, SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN);
window = SDL_CreateWindow("Mjolnir VR", 640, 480, SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN);
context = window ? SDL_GL_CreateContext(window) : NULL;
if (!context || !SDL_GL_MakeCurrent(window, context))
host_fatal("VR test: no OpenGL ES context: %s", SDL_GetError());
Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 70 KiB

+28 -12
View File
@@ -1,6 +1,6 @@
#!/bin/bash
# Ringfall: Mjolnir VR's installer for the Steam Frame, run in its Desktop
# Mode from the bundle the release's "Install Ringfall: Mjolnir VR" desktop
# Mjolnir VR's installer for the Steam Frame, run in its Desktop
# Mode from the bundle the release's "Install Mjolnir VR" desktop
# file downloads (steam_frame_installer.desktop; the bundle: this script,
# RingfallMjolnirVR.apk, ringfall-mjolnir-vr.sh = steam_frame_launch.sh,
# steam_frame_xiso.py and the library pictures in grid/). Everything is
@@ -19,28 +19,31 @@
# Steam Frame Desktop Mode runs inside Gaming Mode's session, which ends
# with Steam. The shortcut of the builds before the name ("Halo VR") is
# left for the player to remove (Steam would write it back).
# RINGFALL_UNATTENDED=1 answers every question with its default and prints
# instead of showing dialogs (RINGFALL_IMAGE: the disc image to use), for
# MJOLNIR_UNATTENDED=1 answers every question with its default and prints
# instead of showing dialogs (MJOLNIR_IMAGE: the disc image to use), for
# testing over adb; it never closes Steam.
BUNDLE="$(cd "$(dirname "$0")" && pwd)"
GAME_DIR="$HOME/Documents/RingfallMjolnirVR"
STEAM_DIR="$HOME/.local/share/Steam"
LEPTON="$STEAM_DIR/steamapps/common/Lepton/lepton"
TITLE="Ringfall: Mjolnir VR"
NAME="Ringfall: Mjolnir VR"
TITLE="Mjolnir VR"
NAME="Mjolnir VR"
APK_NAME="RingfallMjolnirVR.apk"
LAUNCHER="ringfall-mjolnir-vr.sh"
EXE="\"$GAME_DIR/$LAUNCHER\""
# (the desktop file Steam adds the game from)
NAME_FILE="Ringfall Mjolnir VR"
NAME_FILE="Mjolnir VR"
# the builds before the name: their folder and Steam shortcut
OLD_DIR="$HOME/Documents/HaloCE"
OLD_NAME="Halo VR"
# the name of builds 302 to 313, which their shortcut keeps (Steam writes
# its shortcuts back from memory: the player renames it)
FORMER_NAME="Ringfall: Mjolnir VR"
# what the installer did, for looking into problems: written to /tmp while
# it runs, then kept beside the game as install.log
LOG="/tmp/ringfall-mjolnir-vr-install.log"
LOG="/tmp/mjolnir-vr-install.log"
: > "$LOG"
log() { echo "$(date '+%F %T') $*" >> "$LOG"; }
keep_log() { [ -d "$GAME_DIR" ] && cp -f "$LOG" "$GAME_DIR/install.log" 2>/dev/null; }
@@ -59,7 +62,7 @@ steam_running()
pgrep -f 'ubuntu12_32/steam( |$)' >/dev/null || pgrep -x steam >/dev/null
}
unattended() { [ "${RINGFALL_UNATTENDED:-0}" = 1 ] || ! command -v zenity >/dev/null; }
unattended() { [ "${MJOLNIR_UNATTENDED:-0}" = 1 ] || ! command -v zenity >/dev/null; }
info()
{
@@ -185,7 +188,7 @@ PYTHON
# must run), from a desktop file beside the game; then its pictures
add_shortcut()
{
local desktop="$GAME_DIR/$NAME_FILE.desktop" url file id
local desktop="$GAME_DIR/$NAME_FILE.desktop" url
printf '[Desktop Entry]\nType=Application\nName=%s\nExec=%s\nPath=%s\nIcon=steam\nTerminal=false\n' \
"$NAME" "$GAME_DIR/$LAUNCHER" "$GAME_DIR" > "$desktop" && chmod 755 "$desktop" || return 1
url="steam://addnonsteamgame/$(python3 -c 'import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1], safe=""))' "$desktop")"
@@ -195,6 +198,16 @@ add_shortcut()
steam "$url" >/dev/null 2>&1 &
for _ in $(seq 30); do have_shortcut && break; sleep 1; done
have_shortcut || return 1
add_pictures
return 0
}
# the library pictures of the game's shortcut, for every Steam user who has
# it (again on an update: the builds before the name "Mjolnir VR" had
# Ringfall's)
add_pictures()
{
local file id
while read -r file; do
id="$(shortcut_id "$file" "$EXE")" || continue
log "shortcut $id in $file"
@@ -204,7 +217,6 @@ add_shortcut()
cp "$BUNDLE/grid/library_hero.png" "$(dirname "$file")/grid/${id}_hero.png"
cp "$BUNDLE/grid/library_logo.png" "$(dirname "$file")/grid/${id}_logo.png"
done < <(shortcut_files)
return 0
}
# --- the game
@@ -245,7 +257,7 @@ rm -rf "$GAME_DIR/update"
# --- the game data
if [ ! -f "$GAME_DIR/maps/ui.map" ]; then
image="${RINGFALL_IMAGE:-}"
image="${MJOLNIR_IMAGE:-}"
if [ -z "$image" ]; then
mapfile -t images < <(find_images)
for candidate in "${images[@]}"; do
@@ -271,6 +283,7 @@ fi
if have_shortcut; then
log "the Steam shortcut is there"
add_pictures
elif unattended; then
echo "info: the Steam shortcut is missing (not added unattended)"
elif ! steam_running; then
@@ -286,6 +299,9 @@ fi
if have_shortcut_to "$OLD_DIR/halo-vr.sh"; then
info "The library still shows the old \"$OLD_NAME\" from before the game's new name. It no longer starts: remove it in Steam (its gear or Manage > Remove non-Steam game)."
fi
if have_shortcut_to "$FORMER_NAME"; then
info "The library shows the game by its former name, \"$FORMER_NAME\". To call it $NAME there: its gear > Properties, then its name at the top."
fi
if ask "$NAME is installed.${image_note:-}\n\nSwitch to Gaming Mode now? Start $NAME from your library there (its pictures may show once Steam starts again)." yes; then
steamos-session-select gamescope >/dev/null 2>&1 ||
info "Switch to Gaming Mode yourself (the \"Return to Gaming Mode\" icon or the power menu)."
+5 -5
View File
@@ -1,14 +1,14 @@
[Desktop Entry]
# Ringfall: Mjolnir VR's installer for the Steam Frame
# Mjolnir VR's installer for the Steam Frame
# (port/android/STEAM_FRAME.md): a release asset,
# "Install-Ringfall-Mjolnir-VR.desktop", opened in Desktop Mode. It downloads
# "Install-Mjolnir-VR.desktop", opened in Desktop Mode. It downloads
# the latest release's bundle (tools/steam_frame_bundle.py, which fills in
# the repository) and runs its installer, steam_frame_install.sh.
# (no "$", "\" or "%" in Exec: the desktop entry format would need them
# escaped)
Type=Application
Name=Install Ringfall: Mjolnir VR
Comment=Installs Ringfall: Mjolnir VR for the Steam Frame, or updates it
Name=Install Mjolnir VR
Comment=Installs Mjolnir VR for the Steam Frame, or updates it
Icon=steam
Terminal=false
Exec=bash -c "if curl -fL --retry 3 -o /tmp/ringfall-mjolnir-vr-steam-frame.zip https://github.com/@REPOSITORY@/releases/latest/download/ringfall-mjolnir-vr-steam-frame.zip && rm -rf /tmp/ringfall-mjolnir-vr-install && python3 -m zipfile -e /tmp/ringfall-mjolnir-vr-steam-frame.zip /tmp/ringfall-mjolnir-vr-install; then exec bash /tmp/ringfall-mjolnir-vr-install/install.sh; else zenity --error --width=460 --title='Ringfall: Mjolnir VR' --text='Ringfall: Mjolnir VR could not be downloaded. Is the Steam Frame online?'; fi"
Exec=bash -c "if curl -fL --retry 3 -o /tmp/mjolnir-vr-steam-frame.zip https://github.com/@REPOSITORY@/releases/latest/download/mjolnir-vr-steam-frame.zip && rm -rf /tmp/mjolnir-vr-install && python3 -m zipfile -e /tmp/mjolnir-vr-steam-frame.zip /tmp/mjolnir-vr-install; then exec bash /tmp/mjolnir-vr-install/install.sh; else zenity --error --width=460 --title='Mjolnir VR' --text='Mjolnir VR could not be downloaded. Is the Steam Frame online?'; fi"
+2 -2
View File
@@ -1,5 +1,5 @@
#!/bin/bash
# Ringfall: Mjolnir VR on the Steam Frame: Lepton runs the APK in a container of its own,
# Mjolnir VR on the Steam Frame: Lepton runs the APK in a container of its own,
# and installs it anew whenever the APK is newer than the installed one
# (port/android/STEAM_FRAME.md). The game's data: ~/Documents/RingfallMjolnirVR.
# (a container of its own, not the shortcut's id: with that, SteamVR's
@@ -121,7 +121,7 @@ update_check()
log "update: build $latest found (this is $installed), fetching it"
rm -rf "$UPDATE" && mkdir -p "$UPDATE" || return 0
if curl -fsSL --retry 2 --max-time 900 -o "$UPDATE/bundle.zip" \
"https://github.com/$REPOSITORY/releases/download/build-$latest/ringfall-mjolnir-vr-steam-frame.zip" &&
"https://github.com/$REPOSITORY/releases/download/build-$latest/mjolnir-vr-steam-frame.zip" &&
python3 -I -m zipfile -e "$UPDATE/bundle.zip" "$UPDATE/bundle" &&
[ "$(cat "$UPDATE/bundle/build.txt" 2>/dev/null)" = "$latest" ] &&
[ -s "$UPDATE/bundle/RingfallMjolnirVR.apk" ] && [ -s "$UPDATE/bundle/ringfall-mjolnir-vr.sh" ]
+2 -2
View File
@@ -42,7 +42,7 @@ name that no file before it had (ignoring case).
A European disc in two languages (Spanish and Italian) has no maps folder
but one for each, maps_es and maps_it: the one for the language asked for
(RINGFALL_LANGUAGE, else the system's) is taken, else English's, else the
(MJOLNIR_LANGUAGE, else the system's) is taken, else English's, else the
first, and its language written to maps/language.txt, which the game takes
as the Xbox's language while game.language is unset.
"""
@@ -161,7 +161,7 @@ def choose_maps(folders):
if folder[0].lower() == "maps":
return folder, None
languages = [(maps_language(folder[0]), folder) for folder in folders if maps_language(folder[0])]
wanted = (os.environ.get("RINGFALL_LANGUAGE") or os.environ.get("LC_ALL") or
wanted = (os.environ.get("MJOLNIR_LANGUAGE") or os.environ.get("LC_ALL") or
os.environ.get("LC_MESSAGES") or os.environ.get("LANG") or "")[:2].lower()
for preferred in (wanted, "en"):
for language, folder in languages:
+223
View File
@@ -0,0 +1,223 @@
/* Real mirror decisions with a delayed, renaming GPU. No API failures. */
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef int BOOL;
typedef unsigned GLuint, GLenum;
#define TRUE 1
#define FALSE 0
#ifndef TEST_DESKTOP
#define HALO_GLES 1
#endif
#define STREAM_BUFFER_RING 3
#define GL_COPY_WRITE_BUFFER 1
#define GL_DYNAMIC_DRAW 2
#define SEGMENT_SIZE 0x400000u
#define PLATFORM_CONTIGUOUS_SIZE (2 * SEGMENT_SIZE)
static unsigned char cpu[PLATFORM_CONTIGUOUS_SIZE];
#define PLATFORM_CONTIGUOUS_BASE ((unsigned long)cpu)
#define CHECK(x) do { if (!(x)) { fprintf(stderr, "line %d: %s\n", __LINE__, #x); exit(1); } } while (0)
static struct { unsigned long frame, buffer_ring; } device;
static struct { unsigned long mirrored_bytes; } stats;
static unsigned long generations[PLATFORM_CONTIGUOUS_SIZE / 4096], serial;
static unsigned mapped, subdata, overlaps, draws, mismatches, uploads;
static unsigned watch_reads, protections;
/* A subdata update may rename storage immediately and queue preservation
of the old store plus its changed bytes. A later unsynchronized write to
the new store can then be overwritten, even at a disjoint offset. */
static unsigned char *stores[2];
static GLuint bound, next_buffer;
struct command
{
struct command *next;
unsigned char *source, *destination, *expected;
unsigned long offset, size, sequence;
};
static struct command *head, *tail;
static unsigned long submitted, fences[STREAM_BUFFER_RING];
static void enqueue(unsigned char *source, unsigned char *destination,
unsigned char *expected, unsigned long offset, unsigned long size)
{
struct command *command = calloc(1, sizeof(*command));
CHECK(command);
command->source = source;
command->destination = destination;
command->expected = expected;
command->offset = offset;
command->size = size;
command->sequence = ++submitted;
if (tail) tail->next = command;
else head = command;
tail = command;
}
static void complete(unsigned long sequence)
{
while (head && head->sequence <= sequence)
{
struct command *command = head;
if (command->expected)
{
draws++;
if (memcmp(command->source + command->offset, command->expected, command->size)) mismatches++;
free(command->expected);
}
else
{
memcpy(command->destination + command->offset, command->source, command->size);
free(command->source);
}
head = command->next;
free(command);
}
if (!head) tail = NULL;
}
static void host_gl_fence_frame(unsigned slot) { fences[slot] = submitted; }
static void host_gl_wait_frame(unsigned slot) { complete(fences[slot]); }
static void next_frame(void)
{
/* The actual fence/rotation/wait statements from Present. */
#include "rotation.inc"
device.frame++;
}
static unsigned long memory_watch_generation(unsigned long address, unsigned long size)
{
unsigned long page = (address - PLATFORM_CONTIGUOUS_BASE) / 4096;
unsigned long last = (address - PLATFORM_CONTIGUOUS_BASE + size - 1) / 4096, newest = 0;
watch_reads++;
for (; page <= last; page++) if (generations[page] > newest) newest = generations[page];
return newest;
}
static void memory_watch_protect(unsigned long address, unsigned long size) { (void)address; (void)size; protections++; }
static void write_pages(unsigned first, unsigned count, unsigned char value)
{
unsigned page;
for (page = first; page < first + count; page++) generations[page] = ++serial;
memset(cpu + first * 4096, value, count * 4096);
}
static void glGenBuffers(int count, GLuint *buffer) { CHECK(count == 1 && next_buffer < 2); *buffer = ++next_buffer; }
static void glBindBuffer(GLenum target, GLuint buffer) { CHECK(target == GL_COPY_WRITE_BUFFER && buffer && buffer <= 2); bound = buffer - 1; }
static void glBufferData(GLenum target, unsigned long size, const void *data, GLenum usage)
{
CHECK(target == GL_COPY_WRITE_BUFFER && size == SEGMENT_SIZE && !data && usage == GL_DYNAMIC_DRAW);
stores[bound] = calloc(1, size);
CHECK(stores[bound]);
}
static void buffer_upload(GLenum target, unsigned long offset, unsigned long size, const void *data)
{
unsigned char *old = stores[bound], *copy = malloc(size);
CHECK(target == GL_COPY_WRITE_BUFFER && offset + size <= SEGMENT_SIZE && copy);
stores[bound] = calloc(1, SEGMENT_SIZE);
CHECK(stores[bound]);
memcpy(copy, data, size);
enqueue(old, stores[bound], NULL, 0, SEGMENT_SIZE);
enqueue(copy, stores[bound], NULL, offset, size);
subdata++;
uploads++;
}
static void host_gl_buffer_write(GLenum target, unsigned offset, unsigned size, const void *data)
{
struct command *command;
CHECK(target == GL_COPY_WRITE_BUFFER && offset + size <= SEGMENT_SIZE);
for (command = head; command; command = command->next)
{
if (command->destination == stores[bound] && offset < command->offset + command->size &&
command->offset < offset + size) overlaps++;
if (command->expected && command->source == stores[bound] && offset < command->offset + command->size &&
command->offset < offset + size) overlaps++;
}
memcpy(stores[bound] + offset, data, size);
mapped++;
uploads++;
}
#include "mirror.inc"
static int draw_pages(unsigned first, unsigned count)
{
GLuint buffer;
unsigned long offset;
unsigned char *expected;
if (!mirror_range(PLATFORM_CONTIGUOUS_BASE + first * 4096, count * 4096, &buffer, &offset, NULL)) return 0;
expected = malloc(count * 4096);
CHECK(expected);
memcpy(expected, cpu + first * 4096, count * 4096);
enqueue(stores[buffer - 1], NULL, expected, offset, count * 4096);
return 1;
}
int main(int argc, char **argv)
{
unsigned index, old_uploads;
int rollover = argc > 1 && !strcmp(argv[1], "rollover");
device.frame = rollover ? ~0UL - 1 : 100;
#ifdef HALO_ANDROID
/* First-use and reused ranges must always go to the caller's existing
streaming path, without creating GPU storage or consulting tracking. */
for (index = 0; index < 1200; index++)
{
GLuint buffer = 99;
unsigned long offset = 77, generation = 55;
write_pages(0, 300, (unsigned char)index);
CHECK(!mirror_range(PLATFORM_CONTIGUOUS_BASE, 300 * 4096, &buffer, &offset, &generation));
CHECK(buffer == 99 && offset == 77 && generation == 55);
CHECK(!draw_pages(0, 1));
CHECK(!draw_pages(1023, 2));
CHECK(!draw_pages(1024, 1));
next_frame();
}
CHECK(!next_buffer && !uploads && !watch_reads && !protections && !stats.mirrored_bytes);
fprintf(stderr, "bypassed=4800 allocations=0 uploads=0 watch_reads=0 protections=0\n");
return 0;
#endif
write_pages(0, 1, 1);
CHECK(draw_pages(0, 1));
CHECK(watch_reads && protections);
next_frame();
/* An ordinary reused allocation: some previously mirrored pages and
some first-time pages. 300 pages also crosses the 256-page refresh chunk. */
write_pages(0, 300, 2);
CHECK(draw_pages(0, 300));
CHECK(draw_pages(0, 1));
next_frame();
write_pages(300, 1, 3);
CHECK(draw_pages(300, 1));
next_frame();
write_pages(301, 1, 4);
CHECK(draw_pages(301, 1));
/* A different segment has no pending preservation copy. */
write_pages(1024, 1, 5);
CHECK(draw_pages(1024, 1));
CHECK(!draw_pages(1023, 2)); /* segment boundary streams instead */
for (index = 0; index < STREAM_BUFFER_RING; index++) next_frame();
index = mapped;
write_pages(302, 1, 6);
CHECK(draw_pages(302, 1));
#if defined(HALO_ANDROID) || defined(TEST_DESKTOP)
CHECK(mapped == 0); /* every persistent-cache upload is ordered */
#else
CHECK(mapped == index + 1); /* fast path returns after the fence */
#endif
complete(submitted);
old_uploads = uploads;
/* CPU generations are unchanged: any GPU damage is retained. */
for (index = 0; index < 1200; index++)
{
CHECK(draw_pages(256, 1));
next_frame();
}
complete(submitted);
CHECK(uploads == old_uploads);
fprintf(stderr, "mapped=%u subdata=%u overlaps=%u bad_draws=%u draws=%u repair_uploads=%u\n",
mapped, subdata, overlaps, mismatches, draws, uploads - old_uploads);
for (index = 0; index < 2; index++) free(stores[index]);
CHECK(overlaps == 0 && mismatches == 0);
return 0;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

+317
View File
@@ -0,0 +1,317 @@
{
"assets": [
{
"name": "ce_hud_unit_meters",
"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_meters",
"bitmap": 0,
"scale": 4,
"format": "a8r8g8b8",
"ce_only": true,
"cells": [
{
"source": "hud_unit_meters__0",
"from": [
20,
288,
958,
505
],
"to": [
23.0,
136.0,
257.5,
190.25
],
"alignment": {
"anchor": "top_right",
"xbox_sprite": [
122,
34
],
"ce_sprite": [
262,
132
],
"pixels_per_xbox_texel": 8,
"ce_resolution": 2
}
},
{
"source": "hud_unit_meters__0",
"from": [
1141,
16,
1904,
129
],
"to": [
271.0,
2.0,
366.0,
16.0
]
},
{
"source": "hud_unit_meters__0",
"from": [
714,
527,
1403,
625
],
"to": [
84.5,
199.75,
256.75,
224.25
],
"alignment": {
"anchor": "top_right",
"xbox_sprite": [
176,
65
],
"ce_sprite": [
258,
198
],
"pixels_per_xbox_texel": 8,
"ce_resolution": 2
}
},
{
"source": "hud_unit_meters__0",
"from": [
68,
527,
684,
577
],
"to": [
389.0,
1.0,
466.0,
7.0
]
},
{
"source": "hud_unit_meters__0",
"from": [
132,
648,
923,
688
],
"to": [
33.0,
251.0,
237.0,
262.0
]
},
{
"source": "hud_unit_meters__0",
"from": [
1085,
400,
1803,
416
],
"to": [
271.0,
67.0,
364.0,
71.0
]
},
{
"source": "hud_unit_meters__0",
"from": [
5,
95,
799,
193
],
"to": [
15.0,
84.0,
169.0,
103.0
]
},
{
"source": "hud_unit_meters__0",
"from": [
981,
279,
1670,
377
],
"to": [
14.0,
3.0,
153.0,
22.0
]
}
],
"width": 512,
"height": 512,
"size": 262144,
"crc": 3491893663,
"coverage": true,
"point_threshold": true
},
{
"name": "ce_hud_ammo_meters",
"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_meters",
"bitmap": 0,
"scale": 4,
"format": "a8r8g8b8",
"ce_only": true,
"cells": [
{
"source": "hud_ammo_meters__0",
"from": [
0,
504,
830,
616
],
"to": [
2.0,
122.0,
208.0,
151.0
]
},
{
"source": "hud_ammo_meters__0",
"from": [
7,
11,
898,
208
],
"to": [
1.0,
2.0,
225.0,
51.0
]
},
{
"source": "hud_ammo_meters__0",
"from": [
1048,
224,
1903,
352
],
"to": [
268.0,
54.0,
469.0,
86.0
]
},
{
"source": "hud_ammo_meters__0",
"from": [
848,
504,
1672,
592
],
"to": [
211.0,
122.0,
417.0,
145.0
]
},
{
"source": "hud_ammo_meters__0",
"from": [
872,
368,
1740,
488
],
"to": [
216.0,
89.0,
434.0,
120.0
]
},
{
"source": "hud_ammo_meters__0",
"from": [
4,
368,
855,
484
],
"to": [
2.0,
89.0,
214.0,
119.0
]
},
{
"source": "hud_ammo_meters__0",
"from": [
920,
8,
1756,
168
],
"to": [
245.0,
2.0,
431.0,
41.0
]
},
{
"source": "hud_ammo_meters__0",
"from": [
14,
224,
887,
352
],
"to": [
2.0,
54.0,
219.0,
87.0
]
},
{
"source": "hud_ammo_meters__0",
"from": [
18,
632,
835,
664
],
"to": [
2.0,
153.0,
187.0,
162.0
]
}
],
"width": 512,
"height": 512,
"size": 1048576,
"crc": 1316117604,
"coverage": true,
"point_threshold": true
}
]
}
+82
View File
@@ -0,0 +1,82 @@
{
"resource_sha256": "317658e0ebd4aa189bac68e994fe0b515928f44d17b62ba676d8850aa329dd3d",
"bitmaps": [
{"tag": "ui\\hud\\bitmaps\\combined\\hud_weapon_backgrounds", "bitmap": 0, "width": 128, "height": 32, "size": 16384, "crc": 2336761448},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_weapon_backgrounds", "bitmap": 1, "width": 128, "height": 32, "size": 16384, "crc": 1382921092},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_weapon_backgrounds", "bitmap": 2, "width": 128, "height": 32, "size": 16384, "crc": 2368424546},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_weapon_backgrounds", "bitmap": 3, "width": 128, "height": 128, "size": 65536, "crc": 2101251412},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_weapon_backgrounds", "bitmap": 4, "width": 64, "height": 64, "size": 16384, "crc": 1083921210},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_outlines", "bitmap": 0, "width": 128, "height": 32, "size": 4096, "crc": 2685300349},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_outlines", "bitmap": 1, "width": 128, "height": 8, "size": 1024, "crc": 2768572645},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_outlines", "bitmap": 2, "width": 128, "height": 32, "size": 4096, "crc": 4194268279},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_outlines", "bitmap": 3, "width": 128, "height": 32, "size": 4096, "crc": 1151077783},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_type_icons", "bitmap": 0, "width": 32, "height": 16, "size": 2048, "crc": 3757329756},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_type_icons", "bitmap": 1, "width": 64, "height": 16, "size": 4096, "crc": 1699380589},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_type_icons", "bitmap": 2, "width": 32, "height": 16, "size": 2048, "crc": 1250297732},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_type_icons", "bitmap": 3, "width": 32, "height": 16, "size": 2048, "crc": 1096370127},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_type_icons", "bitmap": 4, "width": 32, "height": 16, "size": 2048, "crc": 1461299380},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_msg_icons", "bitmap": 0, "width": 128, "height": 128, "size": 65536, "crc": 634647465},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_msg_icons", "bitmap": 1, "width": 128, "height": 128, "size": 65536, "crc": 2663295025},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_msg_icons", "bitmap": 2, "width": 128, "height": 128, "size": 65536, "crc": 4013307535},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_msg_icons", "bitmap": 3, "width": 128, "height": 128, "size": 65536, "crc": 1215291247},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_msg_icons", "bitmap": 4, "width": 128, "height": 128, "size": 65536, "crc": 4173016642},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_waypoints", "bitmap": 0, "width": 128, "height": 128, "size": 65536, "crc": 1547299393},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 0, "width": 128, "height": 128, "size": 65536, "crc": 2514937598},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 1, "width": 64, "height": 64, "size": 16384, "crc": 1934334840},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 2, "width": 64, "height": 64, "size": 16384, "crc": 2036152485},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 3, "width": 64, "height": 64, "size": 16384, "crc": 1222075981},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 4, "width": 64, "height": 64, "size": 16384, "crc": 3524091297},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 5, "width": 64, "height": 64, "size": 16384, "crc": 1478490245},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 6, "width": 64, "height": 64, "size": 16384, "crc": 2425719365},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 7, "width": 64, "height": 64, "size": 16384, "crc": 2841977525},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 8, "width": 64, "height": 64, "size": 16384, "crc": 1789610607},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 9, "width": 64, "height": 64, "size": 16384, "crc": 10769595},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 10, "width": 64, "height": 64, "size": 16384, "crc": 112721360},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 11, "width": 64, "height": 64, "size": 16384, "crc": 1500905970},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 12, "width": 64, "height": 64, "size": 16384, "crc": 2831607766},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 13, "width": 64, "height": 64, "size": 16384, "crc": 3213345147},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticle_warnings", "bitmap": 0, "width": 128, "height": 128, "size": 65536, "crc": 598528602},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_damage_arrows", "bitmap": 0, "width": 256, "height": 256, "size": 262144, "crc": 4014689458},
{"tag": "ui\\hud\\bitmaps\\hud_sweeper", "bitmap": 0, "width": 64, "height": 64, "size": 4096, "crc": 1530348706},
{"tag": "ui\\hud\\bitmaps\\hud_sweeper_mask", "bitmap": 0, "width": 64, "height": 64, "size": 4096, "crc": 3264958306},
{"tag": "ui\\hud\\bitmaps\\hud_multiplayer", "bitmap": 0, "width": 64, "height": 32, "size": 2048, "crc": 279669690},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_counter_numbers", "bitmap": 0, "width": 128, "height": 128, "size": 65536, "crc": 22576901},
{"tag": "ui\\hud\\bitmaps\\hud_sensor_blip", "bitmap": 0, "width": 32, "height": 32, "size": 1024, "crc": 2905414509},
{"tag": "ui\\hud\\bitmaps\\hud_sensor_blip_custom", "bitmap": 0, "width": 32, "height": 32, "size": 512, "crc": 2318551224},
{"tag": "ui\\hud\\bitmaps\\hud_msg_icons_sm", "bitmap": 0, "width": 128, "height": 128, "size": 65536, "crc": 2829841605},
{"tag": "ui\\hud\\bitmaps\\hud_msg_icons_sm", "bitmap": 1, "width": 128, "height": 128, "size": 65536, "crc": 2261388858},
{"tag": "ui\\hud\\bitmaps\\hud_health_base", "bitmap": 0, "width": 128, "height": 32, "size": 8192, "crc": 2334111445},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_alphas", "bitmap": 0, "width": 512, "height": 512, "size": 1048576, "crc": 2672369332},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_meters", "bitmap": 0, "width": 512, "height": 512, "size": 1048576, "crc": 1316117604},
{"tag": "ui\\hud\\bitmaps\\sniper\\hud_reticles_scope", "bitmap": 0, "width": 64, "height": 64, "size": 16384, "crc": 3359213591},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs2", "bitmap": 0, "width": 64, "height": 256, "size": 65536, "crc": 2440566533},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs2", "bitmap": 1, "width": 64, "height": 256, "size": 65536, "crc": 1451459225},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs2", "bitmap": 2, "width": 128, "height": 8, "size": 4096, "crc": 2199832653},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs2", "bitmap": 3, "width": 128, "height": 8, "size": 4096, "crc": 1036536086},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs2", "bitmap": 4, "width": 8, "height": 128, "size": 4096, "crc": 3263269116},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs_sm", "bitmap": 0, "width": 32, "height": 128, "size": 16384, "crc": 703763697},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs_sm", "bitmap": 1, "width": 32, "height": 128, "size": 16384, "crc": 183991369},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs_sm", "bitmap": 2, "width": 128, "height": 4, "size": 2048, "crc": 2030486740},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs_sm", "bitmap": 3, "width": 128, "height": 4, "size": 2048, "crc": 1345205876},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs_sm", "bitmap": 4, "width": 4, "height": 64, "size": 1024, "crc": 1676080439},
{"tag": "ui\\hud\\bitmaps\\sniper\\caption", "bitmap": 0, "width": 128, "height": 128, "size": 65536, "crc": 120126724},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_mask2", "bitmap": 0, "width": 512, "height": 256, "size": 524288, "crc": 2575239539},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_mask_sm", "bitmap": 0, "width": 256, "height": 256, "size": 262144, "crc": 2593381205},
{"tag": "ui\\hud\\bitmaps\\pistol\\pistol_scope_mask", "bitmap": 0, "width": 256, "height": 256, "size": 262144, "crc": 1764629049},
{"tag": "ui\\hud\\bitmaps\\pistol\\pistol_scope_mask split", "bitmap": 0, "width": 256, "height": 256, "size": 262144, "crc": 343664195},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 0, "width": 256, "height": 64, "size": 65536, "crc": 3748199011},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 1, "width": 128, "height": 32, "size": 16384, "crc": 550837563},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 2, "width": 256, "height": 32, "size": 32768, "crc": 2456043857},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 3, "width": 256, "height": 32, "size": 32768, "crc": 1948057961},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 4, "width": 256, "height": 16, "size": 16384, "crc": 2860676839},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 5, "width": 128, "height": 8, "size": 4096, "crc": 3272812517},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 6, "width": 128, "height": 128, "size": 65536, "crc": 1984211349},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 7, "width": 64, "height": 64, "size": 16384, "crc": 1269964274},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 8, "width": 256, "height": 64, "size": 65536, "crc": 526077822},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 9, "width": 256, "height": 64, "size": 65536, "crc": 2003746041},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 10, "width": 256, "height": 64, "size": 65536, "crc": 3746007716},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 11, "width": 128, "height": 32, "size": 16384, "crc": 3375336138},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 12, "width": 256, "height": 64, "size": 65536, "crc": 4225542721},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_meters", "bitmap": 0, "width": 512, "height": 512, "size": 262144, "crc": 3491893663}
]
}
+65 -194
View File
@@ -1,197 +1,68 @@
{
"note": "High-res HUD textures whose bitmap has the same layout in Halo Custom Edition (the same sprites, the same size or twice it), compared against the stock bitmaps.map and bloodgulch.map; hud_hires.c draws them for a Custom Edition map's stock bitmap of that name as well.",
"assets": [
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_outlines",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_outlines",
"bitmap": 1
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_outlines",
"bitmap": 2
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_outlines",
"bitmap": 3
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_type_icons",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_type_icons",
"bitmap": 1
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_type_icons",
"bitmap": 2
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_type_icons",
"bitmap": 3
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_type_icons",
"bitmap": 4
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_counter_numbers",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_damage_arrows",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds",
"bitmap": 1
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds",
"bitmap": 2
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds",
"bitmap": 3
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds",
"bitmap": 4
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds",
"bitmap": 5
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds",
"bitmap": 6
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds",
"bitmap": 7
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_waypoints",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_weapon_backgrounds",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_weapon_backgrounds",
"bitmap": 1
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_weapon_backgrounds",
"bitmap": 2
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_weapon_backgrounds",
"bitmap": 3
},
{
"tag": "ui\\hud\\bitmaps\\combined\\hud_weapon_backgrounds",
"bitmap": 4
},
{
"tag": "ui\\hud\\bitmaps\\hud_health_base",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\hud_multiplayer",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\hud_sensor_blip",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\hud_sensor_blip_custom",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\hud_sweeper",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\hud_sweeper_mask",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\pistol\\pistol_scope_mask",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\pistol\\pistol_scope_mask split",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs2",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs2",
"bitmap": 1
},
{
"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs2",
"bitmap": 2
},
{
"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs2",
"bitmap": 3
},
{
"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs2",
"bitmap": 4
},
{
"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs_sm",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs_sm",
"bitmap": 1
},
{
"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs_sm",
"bitmap": 2
},
{
"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs_sm",
"bitmap": 3
},
{
"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs_sm",
"bitmap": 4
},
{
"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_mask2",
"bitmap": 0
},
{
"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_mask_sm",
"bitmap": 0
},
{
"tag": "weapons\\sniper rifle\\bitmaps\\angle_ticks",
"bitmap": 0
},
{
"tag": "weapons\\sniper rifle\\bitmaps\\angle_ticks2",
"bitmap": 0
},
{
"tag": "weapons\\sniper rifle\\bitmaps\\angle_ticks_mask",
"bitmap": 0
}
]
}
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_outlines", "bitmap": 0, "width": 128, "height": 32, "size": 4096, "crc": 2685300349},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_outlines", "bitmap": 1, "width": 128, "height": 8, "size": 1024, "crc": 2768572645},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_outlines", "bitmap": 2, "width": 128, "height": 32, "size": 4096, "crc": 4194268279},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_outlines", "bitmap": 3, "width": 128, "height": 32, "size": 4096, "crc": 1151077783},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_type_icons", "bitmap": 0, "width": 32, "height": 16, "size": 2048, "crc": 3757329756},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_type_icons", "bitmap": 1, "width": 64, "height": 16, "size": 4096, "crc": 1699380589},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_type_icons", "bitmap": 2, "width": 32, "height": 16, "size": 2048, "crc": 1250297732},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_type_icons", "bitmap": 3, "width": 32, "height": 16, "size": 2048, "crc": 1096370127},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_type_icons", "bitmap": 4, "width": 32, "height": 16, "size": 2048, "crc": 1461299380},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_counter_numbers", "bitmap": 0, "width": 128, "height": 128, "size": 65536, "crc": 22576901},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_damage_arrows", "bitmap": 0, "width": 256, "height": 256, "size": 262144, "crc": 4014689458},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 0, "width": 256, "height": 64, "size": 65536, "crc": 3748199011},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 1, "width": 128, "height": 32, "size": 16384, "crc": 550837563},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 2, "width": 256, "height": 32, "size": 32768, "crc": 2456043857},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 3, "width": 256, "height": 32, "size": 32768, "crc": 1948057961},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 4, "width": 256, "height": 16, "size": 16384, "crc": 2860676839},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 5, "width": 128, "height": 8, "size": 4096, "crc": 3272812517},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 6, "width": 128, "height": 128, "size": 65536, "crc": 1984211349},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", "bitmap": 7, "width": 64, "height": 64, "size": 16384, "crc": 1269964274},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_waypoints", "bitmap": 0, "width": 128, "height": 128, "size": 65536, "crc": 1547299393},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_weapon_backgrounds", "bitmap": 0, "width": 128, "height": 32, "size": 16384, "crc": 2336761448},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_weapon_backgrounds", "bitmap": 1, "width": 128, "height": 32, "size": 16384, "crc": 1382921092},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_weapon_backgrounds", "bitmap": 2, "width": 128, "height": 32, "size": 16384, "crc": 2368424546},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_weapon_backgrounds", "bitmap": 3, "width": 128, "height": 128, "size": 65536, "crc": 2101251412},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_weapon_backgrounds", "bitmap": 4, "width": 64, "height": 64, "size": 16384, "crc": 1083921210},
{"tag": "ui\\hud\\bitmaps\\hud_health_base", "bitmap": 0, "width": 128, "height": 32, "size": 8192, "crc": 2334111445},
{"tag": "ui\\hud\\bitmaps\\hud_multiplayer", "bitmap": 0, "width": 64, "height": 32, "size": 2048, "crc": 279669690},
{"tag": "ui\\hud\\bitmaps\\hud_sensor_blip", "bitmap": 0, "width": 32, "height": 32, "size": 1024, "crc": 2905414509},
{"tag": "ui\\hud\\bitmaps\\hud_sensor_blip_custom", "bitmap": 0, "width": 32, "height": 32, "size": 512, "crc": 2318551224},
{"tag": "ui\\hud\\bitmaps\\hud_sweeper", "bitmap": 0, "width": 64, "height": 64, "size": 4096, "crc": 1530348706},
{"tag": "ui\\hud\\bitmaps\\hud_sweeper_mask", "bitmap": 0, "width": 64, "height": 64, "size": 4096, "crc": 3264958306},
{"tag": "ui\\hud\\bitmaps\\pistol\\pistol_scope_mask", "bitmap": 0, "width": 256, "height": 256, "size": 262144, "crc": 1764629049},
{"tag": "ui\\hud\\bitmaps\\pistol\\pistol_scope_mask split", "bitmap": 0, "width": 256, "height": 256, "size": 262144, "crc": 343664195},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs2", "bitmap": 0, "width": 64, "height": 256, "size": 65536, "crc": 2440566533},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs2", "bitmap": 1, "width": 64, "height": 256, "size": 65536, "crc": 1451459225},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs2", "bitmap": 2, "width": 128, "height": 8, "size": 4096, "crc": 2199832653},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs2", "bitmap": 3, "width": 128, "height": 8, "size": 4096, "crc": 1036536086},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs2", "bitmap": 4, "width": 8, "height": 128, "size": 4096, "crc": 3263269116},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs_sm", "bitmap": 0, "width": 32, "height": 128, "size": 16384, "crc": 703763697},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs_sm", "bitmap": 1, "width": 32, "height": 128, "size": 16384, "crc": 183991369},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs_sm", "bitmap": 2, "width": 128, "height": 4, "size": 2048, "crc": 2030486740},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs_sm", "bitmap": 3, "width": 128, "height": 4, "size": 2048, "crc": 1345205876},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_crosshairs_sm", "bitmap": 4, "width": 4, "height": 64, "size": 1024, "crc": 1676080439},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_mask2", "bitmap": 0, "width": 512, "height": 256, "size": 524288, "crc": 2575239539},
{"tag": "ui\\hud\\bitmaps\\sniper\\sniper_scope_mask_sm", "bitmap": 0, "width": 256, "height": 256, "size": 262144, "crc": 2593381205},
{"tag": "weapons\\sniper rifle\\bitmaps\\angle_ticks", "bitmap": 0, "width": 8, "height": 512, "size": 4096, "crc": 2262136367},
{"tag": "weapons\\sniper rifle\\bitmaps\\angle_ticks2", "bitmap": 0, "width": 8, "height": 512, "size": 4096, "crc": 2208884634},
{"tag": "weapons\\sniper rifle\\bitmaps\\angle_ticks_mask", "bitmap": 0, "width": 8, "height": 256, "size": 2048, "crc": 283547923},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_unit_meters", "bitmap": 0, "width": 512, "height": 512, "size": 262144, "crc": 3491893663, "replacement": "ce_hud_unit_meters"},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_ammo_meters", "bitmap": 0, "width": 512, "height": 512, "size": 1048576, "crc": 1316117604, "replacement": "ce_hud_ammo_meters"},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 0, "width": 128, "height": 128, "size": 65536, "crc": 2514937598},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 1, "width": 64, "height": 64, "size": 16384, "crc": 1934334840},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 2, "width": 64, "height": 64, "size": 16384, "crc": 2036152485},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 3, "width": 64, "height": 64, "size": 16384, "crc": 1222075981},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 4, "width": 64, "height": 64, "size": 16384, "crc": 3524091297},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 5, "width": 64, "height": 64, "size": 16384, "crc": 1478490245},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 6, "width": 64, "height": 64, "size": 16384, "crc": 2425719365},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 7, "width": 64, "height": 64, "size": 16384, "crc": 2841977525},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 8, "width": 64, "height": 64, "size": 16384, "crc": 1789610607},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 9, "width": 64, "height": 64, "size": 16384, "crc": 10769595},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 10, "width": 64, "height": 64, "size": 16384, "crc": 112721360},
{"tag": "ui\\hud\\bitmaps\\combined\\hud_reticles", "bitmap": 11, "width": 64, "height": 64, "size": 16384, "crc": 1500905970}
],
"resource_sha256": "317658e0ebd4aa189bac68e994fe0b515928f44d17b62ba676d8850aa329dd3d"
}
@@ -241,6 +241,7 @@
<child widget="main_menu/multiplayer_type_select/server_settings/coop_options/op_coop_enemies_multiplier" x="54" y="193"/>
<child widget="main_menu/multiplayer_type_select/server_settings/coop_options/op_coop_enemies_per_player" x="54" y="223"/>
<child widget="main_menu/multiplayer_type_select/server_settings/coop_options/op_coop_player_collisions" x="54" y="253"/>
<child widget="main_menu/multiplayer_type_select/server_settings/coop_options/op_coop_ally_friendly_fire" x="54" y="283"/>
<child widget="main_menu/multiplayer_type_select/server_settings/coop_options/coop_options_button_bar" y="414"/>
</widget>
<widget name="main_menu/multiplayer_type_select/server_settings/coop_options/coop_options_button_bar" type="column_list" width="640" height="28" flags="pass_unhandled_to_focused_child left_right_tabs_items">
@@ -355,6 +356,19 @@
<string text="ON"/>
<string text="OFF"/>
</strings>
<widget name="main_menu/multiplayer_type_select/server_settings/coop_options/op_coop_ally_friendly_fire" width="512" height="28" flags="pass_unhandled_to_focused_child" bitmap="bitmaps/option_bkds" color="#FF2896FF">
<child widget="main_menu/multiplayer_type_select/server_settings/coop_options/coop_ally_friendly_fire_label"/>
<child widget="main_menu/multiplayer_type_select/server_settings/coop_options/coop_ally_friendly_fire_spinner" x="286" y="1"/>
</widget>
<widget name="main_menu/multiplayer_type_select/server_settings/coop_options/coop_ally_friendly_fire_label" type="text" controller="1" width="300" height="22" string_list="main_menu/multiplayer_type_select/server_settings/coop_options/coop_options_labels" string_index="7" font="ui\large_ui" color="#FF2896FF" text_x="13" text_y="4">
</widget>
<widget name="main_menu/multiplayer_type_select/server_settings/coop_options/coop_ally_friendly_fire_spinner" type="spinner" top="2" width="206" height="20" flags="pass_unhandled_to_focused_child left_right_tabs_items" string_list="main_menu/multiplayer_type_select/server_settings/coop_options/var_coop_ally_friendly_fire" font="ui\large_ui" color="#FF2896FF" align="center" text_y="4" list_flags="items_from_strings" header_bitmap="bitmaps/arrow_sm_left" footer_bitmap="bitmaps/arrow_sm_right" header_bounds="7 -13 19 -7" footer_bounds="7 208 19 214">
<on event="left_mouse" run="mouse spinner 1wide click"/>
</widget>
<strings name="main_menu/multiplayer_type_select/server_settings/coop_options/var_coop_ally_friendly_fire">
<string text="ON"/>
<string text="OFF"/>
</strings>
<strings name="main_menu/multiplayer_type_select/server_settings/coop_options/coop_options_labels">
<string text="FRIENDLY FIRE:"/>
<string text="EXTRA ENEMIES:"/>
@@ -363,6 +377,7 @@
<string text="MULTIPLIER:"/>
<string text="PER PLAYER:"/>
<string text="PLAYER COLLISIONS:"/>
<string text="ALLY FRIENDLY FIRE:"/>
</strings>
<strings name="main_menu/multiplayer_type_select/server_settings/coop_options/cap_coop_options">
<string text="Players can not be hurt by weapons and explosives\nfired by the other players."/>
@@ -390,6 +405,8 @@
<string text="For each player past the first, options set to Per\nPlayer get this much more (100%: as many again)."/>
<string text="Players bump into each other, as in the campaign."/>
<string text="Players walk through each other, so that no one\nblocks a doorway. The AI's characters still block."/>
<string text="Players can hurt and kill their AI allies, as in\nthe campaign."/>
<string text="Players can not hurt their AI allies, so that no\none can kill Keyes or the Marines a level needs."/>
</strings>
<widget name="main_menu/multiplayer_type_select/server_settings/voice_options/voice_options_screen" width="640" height="480" flags="pass_unhandled_to_focused_child" bitmap="bitmaps/gradient">
<child widget="main_menu/multiplayer_type_select/server_settings/voice_options/header_voice_options"/>
@@ -0,0 +1,246 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- The port's multiplayer screens, in the PC version's style (tools/port_settings.py) -->
<menus>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_screen" width="640" height="480" flags="pass_unhandled_to_focused_child" bitmap="bitmaps/gradient">
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/header_opence"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_menu"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/header_opence" controller="1" left="35" top="11" width="363" height="59" type="text" text="OPENCE OPTIONS" font="ui\large_ui" color="#FFFFFFFF" text_x="13" text_y="16">
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_help" type="text" controller="1" left="68" top="341" width="482" height="79" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/cap_opence" font="ui\large_ui" color="#FFFFFFFF">
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_menu" type="column_list" width="640" height="480" flags="pass_unhandled_to_focused_child up_down_tabs_children" description="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_help">
<data input="game settings lists text update"/>
<on event="created" run="mp profile init opence options"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_oce_mode" x="54" y="73"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_oce_hardcore" x="54" y="103"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_inf_zombies" x="54" y="133"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_inf_speed" x="54" y="163"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_inf_damage" x="54" y="193"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_inf_respawn" x="54" y="223"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_inf_countdown" x="54" y="253"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_inf_shields" x="54" y="283"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_gg_order" x="54" y="313"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_gg_melee" x="54" y="343"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_button_bar" y="414"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_button_bar" type="column_list" width="640" height="28" flags="pass_unhandled_to_focused_child left_right_tabs_items">
<data input="common button bar update"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_button_ok" x="380" y="1"/>
<child widget="common_button_cancel" x="510" y="1"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_button_ok" type="text" width="128" height="24" bitmap="bitmaps/text_button_background" string_list="strings/common_button_captions" string_index="1" font="ui\small_ui" color="#FFFFFFFF" align="center" text_y="2">
<on event="a" run="mp profile set opence options" back="true"/>
<on event="start" run="mp profile set opence options" back="true"/>
<on event="left_mouse" run="mouse emit accept event"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_oce_mode" width="512" height="28" flags="pass_unhandled_to_focused_child" bitmap="bitmaps/option_bkds" color="#FF2896FF">
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/oce_mode_label"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/oce_mode_spinner" x="286" y="1"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/oce_mode_label" type="text" controller="1" width="300" height="22" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_labels" string_index="0" font="ui\large_ui" color="#FF2896FF" text_x="13" text_y="4">
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/oce_mode_spinner" type="spinner" top="2" width="206" height="20" flags="pass_unhandled_to_focused_child left_right_tabs_items" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_oce_mode" font="ui\large_ui" color="#FF2896FF" align="center" text_y="4" list_flags="items_from_strings" header_bitmap="bitmaps/arrow_sm_left" footer_bitmap="bitmaps/arrow_sm_right" header_bounds="7 -13 19 -7" footer_bounds="7 208 19 214">
<on event="left_mouse" run="mouse spinner 1wide click"/>
</widget>
<strings name="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_oce_mode">
<string text="NONE"/>
<string text="SWAT"/>
<string text="INFECTION"/>
<string text="GUN GAME"/>
</strings>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_oce_hardcore" width="512" height="28" flags="pass_unhandled_to_focused_child" bitmap="bitmaps/option_bkds" color="#FF2896FF">
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/oce_hardcore_label"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/oce_hardcore_spinner" x="286" y="1"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/oce_hardcore_label" type="text" controller="1" width="300" height="22" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_labels" string_index="1" font="ui\large_ui" color="#FF2896FF" text_x="13" text_y="4">
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/oce_hardcore_spinner" type="spinner" top="2" width="206" height="20" flags="pass_unhandled_to_focused_child left_right_tabs_items" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_oce_hardcore" font="ui\large_ui" color="#FF2896FF" align="center" text_y="4" list_flags="items_from_strings" header_bitmap="bitmaps/arrow_sm_left" footer_bitmap="bitmaps/arrow_sm_right" header_bounds="7 -13 19 -7" footer_bounds="7 208 19 214">
<on event="left_mouse" run="mouse spinner 1wide click"/>
</widget>
<strings name="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_oce_hardcore">
<string text="OFF"/>
<string text="ON"/>
</strings>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_inf_zombies" width="512" height="28" flags="pass_unhandled_to_focused_child" bitmap="bitmaps/option_bkds" color="#FF2896FF">
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_zombies_label"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_zombies_spinner" x="286" y="1"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_zombies_label" type="text" controller="1" width="300" height="22" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_labels" string_index="2" font="ui\large_ui" color="#FF2896FF" text_x="13" text_y="4">
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_zombies_spinner" type="spinner" top="2" width="206" height="20" flags="pass_unhandled_to_focused_child left_right_tabs_items" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_inf_zombies" font="ui\large_ui" color="#FF2896FF" align="center" text_y="4" list_flags="items_from_strings" header_bitmap="bitmaps/arrow_sm_left" footer_bitmap="bitmaps/arrow_sm_right" header_bounds="7 -13 19 -7" footer_bounds="7 208 19 214">
<on event="left_mouse" run="mouse spinner 1wide click"/>
</widget>
<strings name="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_inf_zombies">
<string text="1"/>
<string text="2"/>
<string text="3"/>
<string text="4"/>
<string text="8"/>
<string text="16"/>
</strings>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_inf_speed" width="512" height="28" flags="pass_unhandled_to_focused_child" bitmap="bitmaps/option_bkds" color="#FF2896FF">
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_speed_label"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_speed_spinner" x="286" y="1"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_speed_label" type="text" controller="1" width="300" height="22" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_labels" string_index="3" font="ui\large_ui" color="#FF2896FF" text_x="13" text_y="4">
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_speed_spinner" type="spinner" top="2" width="206" height="20" flags="pass_unhandled_to_focused_child left_right_tabs_items" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_inf_speed" font="ui\large_ui" color="#FF2896FF" align="center" text_y="4" list_flags="items_from_strings" header_bitmap="bitmaps/arrow_sm_left" footer_bitmap="bitmaps/arrow_sm_right" header_bounds="7 -13 19 -7" footer_bounds="7 208 19 214">
<on event="left_mouse" run="mouse spinner 1wide click"/>
</widget>
<strings name="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_inf_speed">
<string text="100%"/>
<string text="110%"/>
<string text="125%"/>
<string text="150%"/>
<string text="175%"/>
<string text="200%"/>
</strings>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_inf_damage" width="512" height="28" flags="pass_unhandled_to_focused_child" bitmap="bitmaps/option_bkds" color="#FF2896FF">
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_damage_label"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_damage_spinner" x="286" y="1"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_damage_label" type="text" controller="1" width="300" height="22" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_labels" string_index="4" font="ui\large_ui" color="#FF2896FF" text_x="13" text_y="4">
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_damage_spinner" type="spinner" top="2" width="206" height="20" flags="pass_unhandled_to_focused_child left_right_tabs_items" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_inf_damage" font="ui\large_ui" color="#FF2896FF" align="center" text_y="4" list_flags="items_from_strings" header_bitmap="bitmaps/arrow_sm_left" footer_bitmap="bitmaps/arrow_sm_right" header_bounds="7 -13 19 -7" footer_bounds="7 208 19 214">
<on event="left_mouse" run="mouse spinner 1wide click"/>
</widget>
<strings name="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_inf_damage">
<string text="100%"/>
<string text="150%"/>
<string text="200%"/>
<string text="250%"/>
</strings>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_inf_respawn" width="512" height="28" flags="pass_unhandled_to_focused_child" bitmap="bitmaps/option_bkds" color="#FF2896FF">
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_respawn_label"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_respawn_spinner" x="286" y="1"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_respawn_label" type="text" controller="1" width="300" height="22" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_labels" string_index="5" font="ui\large_ui" color="#FF2896FF" text_x="13" text_y="4">
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_respawn_spinner" type="spinner" top="2" width="206" height="20" flags="pass_unhandled_to_focused_child left_right_tabs_items" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_inf_respawn" font="ui\large_ui" color="#FF2896FF" align="center" text_y="4" list_flags="items_from_strings" header_bitmap="bitmaps/arrow_sm_left" footer_bitmap="bitmaps/arrow_sm_right" header_bounds="7 -13 19 -7" footer_bounds="7 208 19 214">
<on event="left_mouse" run="mouse spinner 1wide click"/>
</widget>
<strings name="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_inf_respawn">
<string text="1 SECOND"/>
<string text="3 SECONDS"/>
<string text="5 SECONDS"/>
<string text="10 SECONDS"/>
<string text="15 SECONDS"/>
<string text="30 SECONDS"/>
</strings>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_inf_countdown" width="512" height="28" flags="pass_unhandled_to_focused_child" bitmap="bitmaps/option_bkds" color="#FF2896FF">
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_countdown_label"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_countdown_spinner" x="286" y="1"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_countdown_label" type="text" controller="1" width="300" height="22" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_labels" string_index="6" font="ui\large_ui" color="#FF2896FF" text_x="13" text_y="4">
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_countdown_spinner" type="spinner" top="2" width="206" height="20" flags="pass_unhandled_to_focused_child left_right_tabs_items" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_inf_countdown" font="ui\large_ui" color="#FF2896FF" align="center" text_y="4" list_flags="items_from_strings" header_bitmap="bitmaps/arrow_sm_left" footer_bitmap="bitmaps/arrow_sm_right" header_bounds="7 -13 19 -7" footer_bounds="7 208 19 214">
<on event="left_mouse" run="mouse spinner 1wide click"/>
</widget>
<strings name="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_inf_countdown">
<string text="NONE"/>
<string text="5 SECONDS"/>
<string text="10 SECONDS"/>
<string text="15 SECONDS"/>
<string text="30 SECONDS"/>
</strings>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_inf_shields" width="512" height="28" flags="pass_unhandled_to_focused_child" bitmap="bitmaps/option_bkds" color="#FF2896FF">
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_shields_label"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_shields_spinner" x="286" y="1"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_shields_label" type="text" controller="1" width="300" height="22" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_labels" string_index="7" font="ui\large_ui" color="#FF2896FF" text_x="13" text_y="4">
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/inf_shields_spinner" type="spinner" top="2" width="206" height="20" flags="pass_unhandled_to_focused_child left_right_tabs_items" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_inf_shields" font="ui\large_ui" color="#FF2896FF" align="center" text_y="4" list_flags="items_from_strings" header_bitmap="bitmaps/arrow_sm_left" footer_bitmap="bitmaps/arrow_sm_right" header_bounds="7 -13 19 -7" footer_bounds="7 208 19 214">
<on event="left_mouse" run="mouse spinner 1wide click"/>
</widget>
<strings name="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_inf_shields">
<string text="OFF"/>
<string text="ON"/>
</strings>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_gg_order" width="512" height="28" flags="pass_unhandled_to_focused_child" bitmap="bitmaps/option_bkds" color="#FF2896FF">
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/gg_order_label"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/gg_order_spinner" x="286" y="1"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/gg_order_label" type="text" controller="1" width="300" height="22" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_labels" string_index="8" font="ui\large_ui" color="#FF2896FF" text_x="13" text_y="4">
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/gg_order_spinner" type="spinner" top="2" width="206" height="20" flags="pass_unhandled_to_focused_child left_right_tabs_items" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_gg_order" font="ui\large_ui" color="#FF2896FF" align="center" text_y="4" list_flags="items_from_strings" header_bitmap="bitmaps/arrow_sm_left" footer_bitmap="bitmaps/arrow_sm_right" header_bounds="7 -13 19 -7" footer_bounds="7 208 19 214">
<on event="left_mouse" run="mouse spinner 1wide click"/>
</widget>
<strings name="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_gg_order">
<string text="STRONGEST FIRST"/>
<string text="WEAKEST FIRST"/>
<string text="RANDOM"/>
</strings>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/op_gg_melee" width="512" height="28" flags="pass_unhandled_to_focused_child" bitmap="bitmaps/option_bkds" color="#FF2896FF">
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/gg_melee_label"/>
<child widget="main_menu/settings_select/multiplayer_setup/opence_options_edit/gg_melee_spinner" x="286" y="1"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/gg_melee_label" type="text" controller="1" width="300" height="22" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_labels" string_index="9" font="ui\large_ui" color="#FF2896FF" text_x="13" text_y="4">
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/opence_options_edit/gg_melee_spinner" type="spinner" top="2" width="206" height="20" flags="pass_unhandled_to_focused_child left_right_tabs_items" string_list="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_gg_melee" font="ui\large_ui" color="#FF2896FF" align="center" text_y="4" list_flags="items_from_strings" header_bitmap="bitmaps/arrow_sm_left" footer_bitmap="bitmaps/arrow_sm_right" header_bounds="7 -13 19 -7" footer_bounds="7 208 19 214">
<on event="left_mouse" run="mouse spinner 1wide click"/>
</widget>
<strings name="main_menu/settings_select/multiplayer_setup/opence_options_edit/var_gg_melee">
<string text="OFF"/>
<string text="ON"/>
</strings>
<strings name="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_labels">
<string text="MODE:"/>
<string text="HARDCORE:"/>
<string text="FIRST ZOMBIES:"/>
<string text="ZOMBIE SPEED:"/>
<string text="SKULL DAMAGE:"/>
<string text="ZOMBIE RESPAWN:"/>
<string text="COUNTDOWN:"/>
<string text="ZOMBIE SHIELDS:"/>
<string text="WEAPON ORDER:"/>
<string text="MELEE DEMOTES:"/>
</strings>
<strings name="main_menu/settings_select/multiplayer_setup/opence_options_edit/cap_opence">
<string text="The game type's own rules."/>
<string text="No shields, and a shot to the head kills. Slayer only."/>
<string text="Humans killed join the zombies, who win when\nno human is left. Team Slayer only."/>
<string text="Each kill gives the next weapon; a kill with the\nlast wins. Free for all Slayer only."/>
<string text="The motion sensor and aim assist as the game\ntype has them."/>
<string text="No motion sensor, no aim assist, and a kill\nrestores the killer's health and shields."/>
<string text="The zombies chosen when the round starts\n(a human is always left)."/>
<string text="The zombies chosen when the round starts\n(a human is always left)."/>
<string text="The zombies chosen when the round starts\n(a human is always left)."/>
<string text="The zombies chosen when the round starts\n(a human is always left)."/>
<string text="The zombies chosen when the round starts\n(a human is always left)."/>
<string text="The zombies chosen when the round starts\n(a human is always left)."/>
<string text="How fast zombies move, of a human's speed."/>
<string text="How fast zombies move, of a human's speed."/>
<string text="How fast zombies move, of a human's speed."/>
<string text="How fast zombies move, of a human's speed."/>
<string text="How fast zombies move, of a human's speed."/>
<string text="How fast zombies move, of a human's speed."/>
<string text="The damage of a zombie's skull's melee."/>
<string text="The damage of a zombie's skull's melee."/>
<string text="The damage of a zombie's skull's melee."/>
<string text="The damage of a zombie's skull's melee."/>
<string text="How long a dead zombie waits to respawn."/>
<string text="How long a dead zombie waits to respawn."/>
<string text="How long a dead zombie waits to respawn."/>
<string text="How long a dead zombie waits to respawn."/>
<string text="How long a dead zombie waits to respawn."/>
<string text="How long a dead zombie waits to respawn."/>
<string text="How long the round waits, once two players are\nalive, before the first zombies are chosen."/>
<string text="How long the round waits, once two players are\nalive, before the first zombies are chosen."/>
<string text="How long the round waits, once two players are\nalive, before the first zombies are chosen."/>
<string text="How long the round waits, once two players are\nalive, before the first zombies are chosen."/>
<string text="How long the round waits, once two players are\nalive, before the first zombies are chosen."/>
<string text="Zombies have no shields."/>
<string text="Zombies have shields, as humans do."/>
<string text="From the rocket launcher to the pistol."/>
<string text="From the pistol to the rocket launcher."/>
<string text="In an order the host draws for each game."/>
<string text="A melee kill takes nothing from the victim."/>
<string text="A melee kill takes the victim back a weapon."/>
</strings>
<widget name="main_menu/settings_select/multiplayer_setup/playlist_edit/playlist_edit_opence_item" type="text" left="51" top="309" width="232" height="32" bitmap="bitmaps/list_item_bkd" text="OPENCE OPTIONS" font="ui\large_ui" color="#FF2896FF" text_x="13" text_y="5">
<on event="a" open="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_screen"/>
<on event="start" open="main_menu/settings_select/multiplayer_setup/opence_options_edit/opence_screen"/>
<on event="left_mouse" run="mouse emit accept event"/>
</widget>
</menus>
@@ -10,8 +10,25 @@
<widget name="main_menu/settings_select/multiplayer_setup/player_options_edit/aim_assist_spinner" type="spinner" top="2" width="206" height="20" flags="pass_unhandled_to_focused_child left_right_tabs_items" string_list="main_menu/settings_select/multiplayer_setup/player_options_edit/var_aim_assist" font="ui\large_ui" color="#FF2896FF" align="center" text_y="4" list_flags="items_from_strings" header_bitmap="bitmaps/arrow_sm_left" footer_bitmap="bitmaps/arrow_sm_right" header_bounds="7 -13 19 -7" footer_bounds="7 208 19 214">
<on event="left_mouse" run="mouse spinner 1wide click"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/player_options_edit/op_shield_effects" width="512" height="28" flags="pass_unhandled_to_focused_child" bitmap="bitmaps/option_bkds" color="#FF2896FF">
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/shield_effects_label"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/shield_effects_spinner" x="286" y="1"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/player_options_edit/shield_effects_label" type="text" controller="1" width="280" height="22" string_list="main_menu/settings_select/multiplayer_setup/player_options_edit/player_options_labels" string_index="9" font="ui\large_ui" color="#FF2896FF" text_x="13" text_y="4">
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/player_options_edit/shield_effects_spinner" type="spinner" top="2" width="206" height="20" flags="pass_unhandled_to_focused_child left_right_tabs_items" string_list="main_menu/settings_select/multiplayer_setup/player_options_edit/var_shield_effects" font="ui\large_ui" color="#FF2896FF" align="center" text_y="4" list_flags="items_from_strings" header_bitmap="bitmaps/arrow_sm_left" footer_bitmap="bitmaps/arrow_sm_right" header_bounds="7 -13 19 -7" footer_bounds="7 208 19 214">
<on event="left_mouse" run="mouse spinner 1wide click"/>
</widget>
<strings name="main_menu/settings_select/multiplayer_setup/player_options_edit/var_aim_assist">
<string text="ALLOWED"/>
<string text="BLOCK M+KB"/>
</strings>
<strings name="main_menu/settings_select/multiplayer_setup/player_options_edit/var_shield_effects">
<string text="STOCK"/>
<string text="GLOW"/>
<string text="LIGHT SHOW"/>
<string text="OVERSHIELD"/>
<string text="GLOW+OVERSHIELD"/>
<string text="SHOW+OVERSHIELD"/>
</strings>
</menus>
@@ -71,14 +71,15 @@
<data input="game settings lists text update"/>
<on event="created" run="mp profile init player opts"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_number_of_lives" x="54" y="73"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_maximum_health" x="54" y="103"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_shields" x="54" y="133"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_respawn_time" x="54" y="163"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_respawn_time_growth" x="54" y="193"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_odd_man_out" x="54" y="223"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_invisible_players" x="54" y="253"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_suicide_penalty" x="54" y="283"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_aim_assist" x="54" y="313"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_maximum_health" x="54" y="100"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_shields" x="54" y="127"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_respawn_time" x="54" y="154"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_respawn_time_growth" x="54" y="181"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_odd_man_out" x="54" y="208"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_invisible_players" x="54" y="235"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_suicide_penalty" x="54" y="262"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_aim_assist" x="54" y="289"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/op_shield_effects" x="54" y="316"/>
<child widget="main_menu/settings_select/multiplayer_setup/player_options_edit/player_button_bar" y="414"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/player_options_edit/player_options_screen" width="640" height="480" flags="pass_unhandled_to_focused_child" bitmap="bitmaps/gradient">
@@ -3,6 +3,7 @@
<menus>
<widget name="main_menu/settings_select/multiplayer_setup/playlist_edit/edit_playlist_select_list" type="column_list" width="640" height="480" flags="pass_unhandled_to_focused_child up_down_tabs_children" description="main_menu/settings_select/multiplayer_setup/playlist_edit/playlist_edit_list_extended_desc">
<data input="playlist settings menu update desc"/>
<data input="port playlist edit desc"/>
<child widget="main_menu/settings_select/multiplayer_setup/playlist_edit/playlist_edit_name_list_item"/>
<child widget="main_menu/settings_select/multiplayer_setup/playlist_edit/playlist_edit_game_type_item"/>
<child widget="main_menu/settings_select/multiplayer_setup/playlist_edit/playlist_edit_player_opts_item"/>
@@ -10,6 +11,7 @@
<child widget="main_menu/settings_select/multiplayer_setup/playlist_edit/playlist_edit_vehicles_list_item"/>
<child widget="main_menu/settings_select/multiplayer_setup/playlist_edit/playlist_edit_indicators_item"/>
<child widget="main_menu/settings_select/multiplayer_setup/playlist_edit/playlist_edit_team_item"/>
<child widget="main_menu/settings_select/multiplayer_setup/playlist_edit/playlist_edit_opence_item"/>
<child widget="main_menu/settings_select/multiplayer_setup/playlist_edit/playlist_edit_button_bar" y="414"/>
</widget>
<widget name="main_menu/settings_select/multiplayer_setup/playlist_edit/gametype_edit_screen" width="640" height="480" flags="pass_unhandled_to_focused_child" bitmap="bitmaps/gradient">
@@ -89,9 +89,9 @@
</strings>
<strings name="main_menu/settings_select/player_setup/player_profile_edit/video_settings/extra_effects/help_strings">
<string text=""/>
<string text="The overshield rises up the body as it charges\nand stays lit, in its own color. Off: stock."/>
<string text="Shields light their surroundings as they flare,\nin the shield's own color."/>
<string text="Light Show: the shield glow three times as far,\nat full from a third of the flare."/>
<string text="The overshield rises up the body and stays lit,\nin its own color. Online: the host's choice."/>
<string text="Shields light their surroundings as they flare.\nOnline: the host's choice."/>
<string text="Light Show: three times as far, at full from a\nthird of the flare. Online: the host's choice."/>
<string text="Keep the light of explosions, plasma and the sun\npast white, and roll it off instead of clipping."/>
<string text="With HDR, on an HDR display, show that light\nbrighter than white. From the next start."/>
</strings>
+11
View File
@@ -221,6 +221,7 @@
</strings>
<strings name="main_menu/gametype_select/var_gametype_banks" map="ui\shell\main_menu\gametype_select\var_gametype_banks">
<string text="STANDARD" map="0"/>
<string text="OPENCE"/>
<string text="CUSTOM" map="2"/>
</strings>
<strings name="main_menu/main_menu_options" map="ui\shell\main_menu\main_menu_options">
@@ -591,6 +592,12 @@
<string text="When you suicide, you must wait fifteen seconds \nbefore you can respawn. This will give you an idea of \nwhat eternity is like." map="27"/>
<string text="Players keep their current mouse aim assist setting."/>
<string text="Disable mouse aim assist for mouse/keyboard players.\nController and touch aim assist are unchanged."/>
<string text="Everyone sees the stock game's shields and\novershield, whatever their own settings."/>
<string text="Everyone's shields light their surroundings as\nthey flare."/>
<string text="Everyone's shields light their surroundings as\nthey flare, three times as far (Light Show)."/>
<string text="For everyone, the overshield rises up the body\nand stays lit, in its own color."/>
<string text="For everyone, shields light their surroundings,\nand the overshield rises and stays lit."/>
<string text="For everyone, Light Show's shield glow, and the\novershield rising and staying lit."/>
</strings>
<strings name="main_menu/settings_select/multiplayer_setup/player_options_edit/player_options_labels" map="ui\shell\main_menu\settings_select\multiplayer_setup\player_options_edit\player_options_labels">
<string text="NUMBER OF LIVES:" map="0"/>
@@ -602,6 +609,7 @@
<string text="INVISIBLE PLAYERS:" map="6"/>
<string text="SUICIDE PENALTY:" map="7"/>
<string text="AIM ASSIST:"/>
<string text="SHIELD EFFECTS:"/>
</strings>
<strings name="main_menu/settings_select/multiplayer_setup/player_options_edit/var_invisible_players" map="ui\shell\main_menu\settings_select\multiplayer_setup\player_options_edit\var_invisible_players">
<string text="YES" map="0"/>
@@ -893,6 +901,7 @@
<string text="Choose which interface indica-\ntors are available while playing \nthis gametype.\nThis gametype:" map="5"/>
<string text="Modify gameplay options and\nrules used by teamplay game\nmodes.\nThis gametype:" map="6"/>
<string text="Save changes you've made to\nthis gametype and return to\nthe previous screen.\nThis gametype:" map="7"/>
<string text="Choose the rules of OpenCE's\ngametypes: SWAT, Infection,\nGun Game and Hardcore.\nThis gametype:"/>
</strings>
<strings name="main_menu/settings_select/multiplayer_setup/playlist_edit/playlist_edit_options" map="ui\shell\main_menu\settings_select\multiplayer_setup\playlist_edit\playlist_edit_options">
<string text="CHANGE NAME" map="0"/>
@@ -1093,6 +1102,7 @@
<string text="You'll traverse the map in the Rocket Warthog, a\nhardy jeep with a rocket launcher mounted in the back." map="14"/>
<string text="Command the skies in the Banshee." map="15"/>
<string text="Defend the lands with the powerful Covenant Gun\nTurret." map="16"/>
<string text="Every vehicle the map places will spawn, as in\nHalo PC."/>
<string text="Customize the set of vehicles which will spawn\nin the map." map="17"/>
<string text="No Warthogs will spawn in the map." map="18"/>
<string text="Up to one Warthog will spawn in the map." map="19"/>
@@ -1145,6 +1155,7 @@
<string text="ROCKET WARTHOGS" map="5"/>
<string text="BANSHEES" map="6"/>
<string text="GUN TURRETS" map="7"/>
<string text="PC"/>
<string text="CUSTOM" map="8"/>
</strings>
<strings name="main_menu/settings_select/multiplayer_setup/vehicle_options_edit/var_vehicles_respawn" map="ui\shell\main_menu\settings_select\multiplayer_setup\vehicle_options_edit\var_vehicles_respawn">
+1
View File
@@ -27,6 +27,7 @@
"ce/main_menu.settings_select.multiplayer_setup.item_options_edit.port.xml",
"ce/main_menu.settings_select.multiplayer_setup.item_options_edit.xml",
"ce/main_menu.settings_select.multiplayer_setup.name_edit.xml",
"ce/main_menu.settings_select.multiplayer_setup.opence_options_edit.port.xml",
"ce/main_menu.settings_select.multiplayer_setup.player_options_edit.port.xml",
"ce/main_menu.settings_select.multiplayer_setup.player_options_edit.xml",
"ce/main_menu.settings_select.multiplayer_setup.playlist_edit.ctf_edit.xml",
+30 -1
View File
@@ -47,6 +47,11 @@ with ideas from VALORANT's netcode articles, keeping the 30 Hz tick:
host's is once that stops, or if they drift apart while it moves;
- which named objects exist, so scripted creates and deletes match.
Script actions naming player0 also reach the players beyond player1.
They use the same reverse datum order as the script's `(players)` list,
skipping players without units, so a scripted BSP transition does not
leave the extra players in the unloaded part of the level.
Every machine follows the host's structure BSP: a switch is sent at once
and reliably, and each client's input says which BSP it has loaded.
Until a client has the host's, the host takes none of its players'
@@ -233,7 +238,31 @@ from, so that a second copy of the game on one computer, on a port of its
own, plays too; version 32 sends the host's mouse aim assist policy
(distributed message 90, `network_aim_assist.c`), which a client must not
ignore, and has a client's input say whether its player plays co-op with
friendly fire.
friendly fire; version 33 sends with the game's settings whether co-op's
players hurt their AI allies (Server Setup's ALLY FRIENDLY FIRE: the host
then deals the players' hits of them no damage); version 34 takes clients'
hits on, and sends the host's damage to, the map's scenery and devices
whose shield is all damage can break (Rat Race's energy shields, a Custom
Edition map's tripmines), which version 17 left out as having no body to
destroy, and has every machine run those shields' stun and recharge itself;
and the host deals what such an object deals itself (its shield or body
breaking: a tripmine a client's player threw going off under the host's
vehicle), which a client no longer reports and the host took from no one.
One made in the game, a tripmine, is at an index of its own on each machine:
the host takes a client's hit on its copy as one on the host's nearest where
the client had it, and a client the host's damage to one as damage to its own
copy nearest the damage. Then version 35 sends with the game's settings the
options of OpenCE's gametypes (SWAT, Infection, Gun Game and Hardcore:
`port/linux/game/game_modes.c`), which make the gametype's PC options 0x2C
bytes where they were 0x1C, and the game settings record 16 bytes longer; and
in an Infection game the host sends its round in the game type's state
(`struct distributed_infection_state`: each player's role and score, the
round's phase and winner) in place of Slayer's, which each client checks whole
before taking it. Then version 36 sends the host's shield effects (distributed
message 91, `network_shield_effects.c`: the shield glow, its Light Show reach
and the overshield effect, Server Setup's SHIELD EFFECTS), which every client
draws in place of its player's own, so that a build that would draw its own
cannot join.
`port/linux/network_format.txt` records the wire format of the current
version (`tools/network_format.py`): `test_linux_port.py` fails when the
+42 -7
View File
@@ -263,7 +263,9 @@ second get a numeric suffix so previous screenshots are preserved.
One movement of the mouse wheel changes the weapon one time. A second
movement after a short pause changes it again.
In the menus, the mouse moves a pointer:
In the menus, the mouse moves a pointer, a blue arrow
(`port/assets/cursor/menu_cursor.png`) in place of the system's, sized to
the window as Halo PC's was (32 of the menus' 480 lines tall):
- The item below the pointer gets the focus.
- A left click selects the item. On a setting with values, a click on the
@@ -375,8 +377,38 @@ follow the teams' changes in the lobby. They look for enemies, aim, fire,
throw grenades and pick up better weapons, as well as `bots.skill` lets
them, and walk the paths that the campaign's AI finds on the maps' walkable
surfaces (`game/bots.c`). They are never in system link or internet games,
nor in other gametypes, and nothing that the machines send each other
changes.
nor in other gametypes (but SWAT, Infection and Gun Game, which are
Slayer's: below), and nothing that the machines send each other changes.
## OpenCE gametypes
Create Game's Select Gametype screen has a bank between STANDARD and
CUSTOM: OPENCE, the port's own gametypes (`game/game_modes.c`).
| Gametype | Rules |
| --- | --- |
| SWAT | Team Slayer with no shields, in which a shot to the head of any weapon kills (a bullet's, a plasma bolt's, a needle's or a shotgun pellet's, not a melee's or an explosion's). Everyone starts with a pistol and an assault rifle; no weapons are on the map, no one has grenades, and there is no motion sensor. |
| Infection | Team Slayer. Humans are red and keep the map's weapons; zombies are blue, carry the Oddball skull and nothing else, move faster, hit harder with the skull, and cannot drive, pick up grenades or powerups. Once two players are alive the round counts down, then the host chooses the first zombies (a human is always left). A human killed by a zombie, by themselves or by a fall becomes a zombie, one killed by a teammate does not; a zombie respawns a zombie, and a player who joins late is one. The zombies win when no human is left, the humans when the round's time runs out (5 minutes). Each player scores a kill of the other side. The rules follow pull request #420's (`game/infection.c`). |
| Gun Game | Free for all Slayer. Everyone starts with the first weapon of a list (the rocket launcher, the shotgun, the sniper rifle, the plasma rifle, the assault rifle, the needler, the plasma pistol, the pistol, of those the map has); each kill gives the killer the next, and a kill with the last wins. No one picks up a weapon, a weapon emptied is refilled, and a melee kill takes the victim back a weapon (`game/gun_game.c`). |
| Hardcore Slayer, Hardcore CTF, Hardcore Oddball, Hardcore King | The team gametypes with Hardcore's rules: no motion sensor (the flag, the ball and the hill keep their nav points), no aim assist (no autoaim nor magnetism, for controllers and the mouse alike), friendly fire on, and a kill restores the killer's health, and their shields unless an overshield has them past full. |
Edit Gametypes edits them as any gametype, and its OPENCE OPTIONS screen
(after TEAMPLAY OPTIONS) gives any gametype these rules: its MODE (NONE,
SWAT, INFECTION or GUN GAME: Slayer only; Infection is played on teams and
Gun Game free for all, which the screen's OK sets), HARDCORE (any game
type), and the mode's own options: Infection's first zombies, zombie speed,
skull damage, zombie respawn time, countdown and zombie shields, and Gun
Game's weapon order (strongest first, weakest first, or random, drawn by
the host for each game) and whether a melee kill demotes. A saved gametype
keeps them with its PC options (`saved games/playlist_profile.c`, version 2
of their block; a gametype saved before them has none), and the network
game carries them to every machine (network version 35, `NETCODE.md`).
Only the host decides each mode's events (Infection's zombies, Gun Game's
weapons, Hardcore's restores); the clients take them from it as they take
the rest of the game. The lobby and Server Setup name the gametype's mode.
`debug.network_test` hosts them by name: `swat`, `infection`, `gun_game`,
`hardcore`, `hardcore_ctf`, `hardcore_oddball` and `hardcore_king`
(`host:bloodgulch:infection`).
## Settings
@@ -435,9 +467,9 @@ the setting for one start of the game. It has priority over the file.
| `display.latency_meter` | `false` | `HALO_LATENCY_METER` | `true`: in a network game, your round trip to the host in milliseconds at the top right of the screen, "Ping 45 ms" with four bars: green below 80 ms, yellow below 150, red from 150. The host shows "Max ping", its slowest player's. A player's machine that has heard nothing from the host for two seconds shows "Connection problem". The round trip includes each machine's wait for its next tick, so a LAN reads 15 to 35 ms. Not shown in the menus, after the game, in a co-op cutscene or when the host plays alone. The scoreboard's pings take the same colours, and show the round trips this machine times itself (the host: each player's; a player: their own), so they agree with the meter. Nothing more is sent. Only in config.toml, not in the menus. |
| `display.per_pixel_lighting` | `false` | `HALO_PER_PIXEL_LIGHTING` | `false`: the models (characters, weapons, vehicles, scenery) are lit at each vertex and the light is blended between them, as on the Xbox. The light across a curved surface then shows facets, and a point light that passes close lights only the vertices it reaches. `true`: the models are lit at each pixel by the same lights (the ambient light, two distant lights and two point lights), which changes their look. |
| `display.structure_culling` | `31` | `HALO_STRUCTURE_CULLING` | Which tests skip the triangles of the level (its walls, floors and terrain) that the camera cannot see before they are drawn, as bits added together: `1`, triangles outside the view; `2`, groups of triangles that all face away from the camera; `4`, single triangles that face away; `8`, smaller groups, so that more of them are skipped whole; `16`, the rooms nearest the camera first. Each test is conservative: the picture is the same, with fewer triangles drawn. `0`: the original walk, which draws every triangle of each visible room. The console's `structure_culling <bits>` changes it until the game quits, and `debug_structure_culling true` shows what was skipped (red: outside the view, blue: facing away). |
| `display.shield_glow` | `false` | `HALO_SHIELD_GLOW` | `true`: as a unit's energy shield flares (hit, charging, falling), it lights what is around it and itself, as a plasma bolt does, in the shield shader's own color (a Spartan's gold, an Elite's blue), rising and falling with the flare seen on the body. An ordinary dynamic light of the game's, drawn with a light definition the map has (`shield_glow.c`). Up to 8 units near the camera. Video Setup's Extra Effects screen sets it. |
| `display.shield_glow_intensity` | `default` | `HALO_SHIELD_GLOW_INTENSITY` | The shield glow's reach and brightness: `default`, or `light_show` (three times as far, and at full strength from a third of the flare: a light is no brighter than full). The units glowing are those near any local player's camera, so each of a split screen's views has the same. Video Setup's Extra Effects screen sets it. |
| `display.overshield_effect` | `false` | `HALO_OVERSHIELD_EFFECT` | `true`: the overshield's flare rises up the body from the feet as it charges, with a soft edge (2 seconds, the charge's time from a full shield; 3 from a shield that was down; 2 from any other), then stays lit, whole, for as long as the overshield lasts, its energy moving at 30% of its speed, in its own color (the powerup's, 253, 78, 116), whatever shield color its player chose; the shield's own flares are not drawn over it, and its glow (`display.shield_glow`) rises and stays with it. With `display.viewmodel_shield` it comes up on the first-person arms as the rise reaches them. A hit on it plays what the projectile plays on an Elite's shield (its sound, sparks and light), when the map has that effect and it only shows and sounds. `false`: the overshield as the stock game draws it. Only this machine's drawing and sounds change (`overshield_effect.c`; the rise is a fade in the vertex shader, `d3d8_gl_set_height_fade`). Video Setup's Extra Effects screen sets it. |
| `display.shield_glow` | `false` | `HALO_SHIELD_GLOW` | `true`: as a unit's energy shield flares (hit, charging, falling), it lights what is around it and itself, as a plasma bolt does, in the shield shader's own color (a Spartan's gold, an Elite's blue), rising and falling with the flare seen on the body. An ordinary dynamic light of the game's, drawn with a light definition the map has (`shield_glow.c`). Up to 8 units near the camera. Video Setup's Extra Effects screen sets it. Offline only: in a network game, the host's `network.shield_effects` decides. |
| `display.shield_glow_intensity` | `default` | `HALO_SHIELD_GLOW_INTENSITY` | The shield glow's reach and brightness: `default`, or `light_show` (three times as far, and at full strength from a third of the flare: a light is no brighter than full). The units glowing are those near any local player's camera, so each of a split screen's views has the same. Video Setup's Extra Effects screen sets it. Offline only: in a network game, the host's `network.shield_effects` decides. |
| `display.overshield_effect` | `false` | `HALO_OVERSHIELD_EFFECT` | `true`: the overshield's flare rises up the body from the feet as it charges, with a soft edge (2 seconds, the charge's time from a full shield; 3 from a shield that was down; 2 from any other), then stays lit, whole, for as long as the overshield lasts, its energy moving at 30% of its speed, in its own color (the powerup's, 253, 78, 116), whatever shield color its player chose; the shield's own flares are not drawn over it, and its glow (`display.shield_glow`) rises and stays with it. With `display.viewmodel_shield` it comes up on the first-person arms as the rise reaches them. A hit on it plays what the projectile plays on an Elite's shield (its sound, sparks and light), when the map has that effect and it only shows and sounds. `false`: the overshield as the stock game draws it. Only this machine's drawing and sounds change (`overshield_effect.c`; the rise is a fade in the vertex shader, `d3d8_gl_set_height_fade`). Video Setup's Extra Effects screen sets it. Offline only: in a network game, the host's `network.shield_effects` decides. |
| `display.model_detail` | `"stock"` | `HALO_MODEL_DETAIL` | Which level of detail (of up to five) each model is drawn at. The game measures a model by its size in the lines of its 480-line screen, at any resolution, so at 1440 lines a model three times larger than the levels were made for is drawn as the Xbox drew it. `"stock"`: as on the Xbox. `"native"`: measured in the lines of the display (not supersampling's), so more detail is kept at a distance at high resolutions, and small far models that the Xbox left out are drawn. `"highest"`: measured as `"native"` for which models are drawn, and those drawn at their most detailed level. With either, a part that has no geometry at the level chosen draws its most detailed level below that has some, and a level made for a model's inside (one for a size over 1000 pixels, as the top level of a10's cryotubes) is drawn only while the camera is inside the model. Models whose map gives one level (the trees and rocks of b30) do not change. On Android, which draws 480 lines, `"native"` is `"stock"`. |
| `display.hdr` | `false` | `HALO_HDR` | `true`: the back buffer that the 3D view is drawn into holds half floats (`GL_RGBA16F`) in place of 8 bits a channel, so that the light the game adds up (blended lights, glows, fog, particles) is kept past white in place of being clipped. Before the HUD and the menus, a tone mapping pass brings it back into the display's range (`display.hdr_tone_mapping`). The HUD and the menus do not change. On Android, only with a GPU that draws into half floats (OpenGL ES 3.2, `GL_EXT_color_buffer_half_float` or `GL_EXT_color_buffer_float`); otherwise off, with a line in the log. A change applies from the next frame. Video Setup's GRAPHICS screen sets it (HDR) and `display.hdr_output` (HDR DISPLAY). Refer to "HDR" in "What operates". |
| `display.hdr_exposure` | `1.0` | `HALO_HDR_EXPOSURE` | With `display.hdr`, the light of the 3D view is multiplied by this before the tone mapping, from `0.25` to `4.0`. |
@@ -478,7 +510,8 @@ the setting for one start of the game. It has priority over the file.
| `network.allow_upnp` | `true` | `HALO_NET_ALLOW_UPNP` | `true`: internet play can ask the router to forward its port (UPnP). `false`: the game does not ask. Refer to "Internet play". |
| `network.public_lobby` | `true` | `HALO_NET_PUBLIC_LOBBY` | `true`: the server browser. Public games are listed, and Join Game > Server Browser shows them. `false`: no games are listed or shown. Refer to "Server browser". |
| `network.host_public` | `true` | `HALO_NET_HOST_PUBLIC` | `true`: a new game of Create Game > Internet starts as PUBLIC. `false`: it starts as PRIVATE. LISTING in Server Setup changes it for each game. Refer to "Server browser". |
| `network.coop_friendly_fire` | `"on"` | `HALO_NET_COOP_FRIENDLY_FIRE` | Whether the players of an online co-op game hurt each other: `"off"`, `"on"`, `"shields_only"` or `"explosives_only"`. FRIENDLY FIRE in co-op's Server Setup > Co-op Options writes its choice here. Their AI allies they always can, as in the campaign. |
| `network.coop_friendly_fire` | `"on"` | `HALO_NET_COOP_FRIENDLY_FIRE` | Whether the players of an online co-op game hurt each other: `"off"`, `"on"`, `"shields_only"` or `"explosives_only"`. FRIENDLY FIRE in co-op's Server Setup > Co-op Options writes its choice here. Their AI allies they hurt as `network.coop_ally_friendly_fire` says. |
| `network.coop_ally_friendly_fire` | `true` | `HALO_NET_COOP_ALLY_FRIENDLY_FIRE` | Whether the players of an online co-op game hurt their AI allies (the Marines, Captain Keyes, the Sentinels while they are allies), as in the campaign. `false`: the players' weapons, grenades, melee and vehicles do them no harm, so that no player can kill the allies a level needs. The allies' and enemies' own damage is unchanged. ALLY FRIENDLY FIRE in co-op's Server Setup > Co-op Options writes its choice here; the host sends it with the game's settings. |
| `network.coop_own_friendly_fire` | `true` | `HALO_NET_COOP_OWN_FRIENDLY_FIRE` | Whether this machine's players hurt, and are hurt by, the other players of an online co-op game. Two players hurt each other only if both have it `true`, and then as the host's `network.coop_friendly_fire` says. FRIENDLY FIRE in that game's pause menu writes its choice here. A player away from the controls for over 70 seconds is hurt by every player, whatever either chose. |
| `network.coop_player_collisions` | `true` | `HALO_NET_COOP_PLAYER_COLLISIONS` | Whether the players of an online co-op game bump into each other. `false`: they walk through each other, so that one cannot block a doorway or stand on another; they still bump into the AI's characters. PLAYER COLLISIONS in co-op's Server Setup > Co-op Options writes its choice here. |
| `network.coop_enemies_mode` | `"per_player"` | `HALO_NET_COOP_ENEMIES_MODE` | Online co-op's extra enemies: `"none"`; `"per_player"`, each squad of enemies that a level places grows by `network.coop_enemies` for each player past the first; or `"multiplier"`, each squad is `network.coop_enemies_multiplier` times as large, for any number of players. The extra enemies stand around the squad's places, and those that a dropship has no seats for drop out of it after its passengers. EXTRA ENEMIES in co-op's Server Setup > Co-op Options writes its choice here. |
@@ -494,6 +527,7 @@ the setting for one start of the game. It has priority over the file.
| `network.votekick` | `true` | `HALO_NET_VOTEKICK` | When you host: `true`, the players can vote to kick a player. Refer to "Security". `false`: no votes. VOTE KICK in Server Setup > Teamplay Options (in co-op, Voice and Voting) writes its choice here. |
| `network.votekick_minutes` | `5` | `HALO_NET_VOTEKICK_MINUTES` | When you host: the minutes that a player must play on the server before the player can start a vote to kick (`0` to `60`). To vote, a player must play for 2 minutes, or for this time if it is less. |
| `network.votekick_ban_minutes` | `30` | `HALO_NET_VOTEKICK_BAN_MINUTES` | When you host: the minutes that a player who is kicked by a vote cannot join again (`1` to `1440`). |
| `network.shield_effects` | `stock` | `HALO_NET_SHIELD_EFFECTS` | Host: the shield effects every player of a network game sees, whatever their own settings, so that none sees what another does not: `stock`, `glow` (`display.shield_glow`), `light_show` (its Light Show intensity), `overshield` (`display.overshield_effect`), `glow_overshield` or `light_show_overshield`. Sent to each client when it is ready and when it changes (`network_shield_effects.c`); a client draws stock until it has it. SHIELD EFFECTS in Server Setup > Player Options writes its choice here. |
| `network.block_mouse_aim_assist` | `false` | `HALO_NET_BLOCK_MOUSE_AIM_ASSIST` | Host: Player Options > Aim Assist, Allowed or Block M+KB. Block overrides optional mouse magnetism while mouse/keyboard aims, including on the host, without changing the saved preference. Controllers and touch retain their existing behavior; bullet autoaim is unchanged. |
| `network.map_share` | `true` | `HALO_NET_MAP_SHARE` | When you host: send a player who joins without the game's Custom Edition map the map, and the resource maps that it needs and that the player does not have. SHARE MAPS in Server Setup > Map Sharing writes its choice here. Refer to "Map sharing". |
| `network.map_share_upload` | `1024` | `HALO_NET_MAP_SHARE_UPLOAD` | When you host: the most kilobytes per second that the game sends of maps (`16` to `20480`, 20 MB/s). UPLOAD LIMIT in Server Setup > Map Sharing writes its choice here. |
@@ -1428,6 +1462,7 @@ Other changes:
| `hs/hs.c` | The console's `mods_reload`, `mods_enable` and `mods_list`, which a client may run too. |
| `interface/ui_widget.c`, `interface/ui_widget_event_handler_functions.c`, `interface/ui_widget_game_data_input_functions.c` | The main menu is the PC version's from `port/assets/menus` (`display.menus`); the menus' widgets can call the port's functions (`game/menu_functions.c`) and send the PC version's custom activation event; the widgets' memory is 256 KB, not 16 KB; the main menu and Multiplayer clear co-op's controllers, so that a gamepad going back to controller 1 is not a controller unplugged; the lobby's split screen players leave alone, and one who quits in game is not joined to the next game (`interface/player_ui.c`). |
| `interface/player_ui.c` | Fast setup opens the pregame screen through the port's menus (the lobby), as `interface/ui_widget.c` does. |
| `game/game_engine.c`, `game/game_engine.h`, `game/game_engine_slayer.c`, `game/game.c`, `game/aim_assist.c`, `game/players.c`, `objects/damage.c`, `objects/objects.c`, `units/units.c`, `items/weapons.c`, `saved games/playlist_profile.c`, `saved games/saved_game_files.c` | OpenCE's gametypes (`game/game_modes.c`, "OpenCE gametypes"): the gametype's PC options carry a mode and Hardcore with their options; the built-in ones are written after the Xbox's default gametypes; Infection's and Gun Game's game engines are Slayer's with their rules; SWAT's headshots, Hardcore's motion sensor, aim assist and restore of the killer; Infection's zombies' skulls, grenades, powerups, seats and melee. |
| `game/game_time.c`, `main/main.c` | With `debug.fixed_step`, a game of one machine runs a tick a frame, each frame taking a tick's time, so that it plays the same every time (`tools/stagekit`). |
| `input/input_abstraction.c`, `game/player_control.c`, `game/players.c`, `game/player_queues_new.c`, `units/units.h` | The keyboard and mouse's actions (`src/xinput_sdl.c`, `include/halo_keyboard.h`) join controller 1's game controls; their reload key reloads on its own, and their action key only acts (a control flag of the port's, sent with the player's action, stops the reload the controller's X falls back to). |
| `saved games/player_profile.h`, `interface/player_ui.c` | A sixth button layout, the Master Chief Collection's Bumper Jumper (`profile.button_preset` 5). A layout the build does not know (a later build's) gets the standard buttons, not none, which moved start and back and stopped the game. |
+243
View File
@@ -0,0 +1,243 @@
/* CE textures can exceed the Android Xbox window's current-frame capacity.
* Keep individual allocations stable rather than repeatedly moving/reloading
* a packed arena. This cache owns only synchronous, cached CE map pixels;
* dynamic textures and other map storage keep their established paths. */
#ifdef HALO_ANDROID
#include "cseries.h"
#include "bitmaps/bitmaps.h"
#include "bitmaps/bitmap_group.h"
#include "android_ce_texture_cache.h"
#include <stdlib.h>
#include <string.h>
/* cseries redirects free to debug_free, but calloc is the runtime allocator.
* These cache-owned allocations must return to the matching runtime heap. */
#undef free
#define ANDROID_CE_TEXTURE_BYTES (128UL * 1024UL * 1024UL)
#define ANDROID_CE_TEXTURE_ENTRIES 8192
#define ANDROID_CE_TEXTURE_BUCKETS 1024
struct android_ce_texture
{
struct android_ce_texture *bitmap_next, *resource_next;
struct android_ce_texture *older, *newer;
struct bitmap_data *bitmap;
unsigned long header[5];
void *pixels;
unsigned long bytes, frame;
};
static struct android_ce_texture *bitmap_buckets[ANDROID_CE_TEXTURE_BUCKETS];
static struct android_ce_texture *resource_buckets[ANDROID_CE_TEXTURE_BUCKETS];
static struct android_ce_texture *oldest, *newest;
static unsigned long cache_bytes, cache_count, cache_frame;
static unsigned long cache_loads, cache_evictions, cache_failed;
static unsigned long cache_peak;
extern void platform_log(const char *format, ...);
extern void halo_custom_edition_texels_channels(const void *pixels, unsigned char order);
static unsigned long android_ce_texture_bucket(const void *pointer)
{
return (((unsigned long)pointer >> 4) * 2654435761UL) % ANDROID_CE_TEXTURE_BUCKETS;
}
static void android_ce_texture_report(void)
{
/* One summary per unload/flush; no per-frame logging or pixel readback. */
platform_log("textures: Android CE cache peak=%lu limit=%lu loads=%lu evictions=%lu failures=%lu",
cache_peak, ANDROID_CE_TEXTURE_BYTES, cache_loads, cache_evictions, cache_failed);
}
static void android_ce_texture_failed(void)
{
if (!cache_failed++)
platform_log("textures: Android CE cache allocation failed (used=%lu limit=%lu entries=%lu)",
cache_bytes, ANDROID_CE_TEXTURE_BYTES, cache_count);
}
static void android_ce_texture_unlink(struct android_ce_texture *entry)
{
if (entry->older)
entry->older->newer = entry->newer;
else
oldest = entry->newer;
if (entry->newer)
entry->newer->older = entry->older;
else
newest = entry->older;
}
static void android_ce_texture_touch(struct android_ce_texture *entry)
{
if (entry != newest)
{
android_ce_texture_unlink(entry);
entry->older = newest;
entry->newer = NULL;
if (newest)
newest->newer = entry;
else
oldest = entry;
newest = entry;
}
entry->frame = cache_frame;
}
static void android_ce_texture_release(struct android_ce_texture *entry)
{
struct android_ce_texture **link;
/* Remove bindings and GPU copies before either address can be reused. */
android_ce_texture_unbind(entry->header);
android_ce_texture_gpu_forget(entry->header);
halo_custom_edition_texels_channels(entry->pixels, 0);
link = &bitmap_buckets[android_ce_texture_bucket(entry->bitmap)];
while (*link != entry)
link = &(*link)->bitmap_next;
*link = entry->bitmap_next;
link = &resource_buckets[android_ce_texture_bucket(entry->header)];
while (*link != entry)
link = &(*link)->resource_next;
*link = entry->resource_next;
android_ce_texture_unlink(entry);
if (entry->bitmap->base_address == entry->pixels)
entry->bitmap->base_address = NULL;
cache_bytes -= entry->bytes;
cache_count--;
free(entry->pixels);
free(entry);
}
void android_ce_texture_delete(struct bitmap_data *bitmap)
{
struct android_ce_texture *entry;
for (entry = bitmap_buckets[android_ce_texture_bucket(bitmap)]; entry; entry = entry->bitmap_next)
if (entry->bitmap == bitmap)
{
android_ce_texture_release(entry);
return;
}
}
int android_ce_texture_resident(const struct bitmap_data *bitmap)
{
struct android_ce_texture *entry;
for (entry = bitmap_buckets[android_ce_texture_bucket(bitmap)]; entry; entry = entry->bitmap_next)
if (entry->bitmap == bitmap)
return 1;
return 0;
}
void android_ce_texture_reset(void)
{
if (cache_count || cache_failed)
android_ce_texture_report();
while (oldest)
android_ce_texture_release(oldest);
cache_frame = cache_loads = cache_evictions = cache_failed = 0;
cache_peak = 0;
}
void android_ce_texture_idle(void)
{
/* Equality alone defines current-frame ownership. Avoid wrap aliasing. */
if (++cache_frame == 0)
{
struct android_ce_texture *entry;
for (entry = oldest; entry; entry = entry->newer)
entry->frame = 0;
cache_frame = 1;
}
}
const void *android_ce_texture_pixels(const void *resource, unsigned long *bytes)
{
struct android_ce_texture *entry;
for (entry = resource_buckets[android_ce_texture_bucket(resource)]; entry; entry = entry->resource_next)
if (entry->header == resource)
{
*bytes = entry->bytes;
return entry->pixels;
}
*bytes = 0;
return NULL;
}
void *android_ce_texture_get(struct bitmap_data *bitmap, unsigned long bytes,
int load, android_ce_texture_load_proc read)
{
struct android_ce_texture *entry;
unsigned long bucket;
if (!bitmap)
return NULL;
bucket = android_ce_texture_bucket(bitmap);
for (entry = bitmap_buckets[bucket]; entry; entry = entry->bitmap_next)
if (entry->bitmap == bitmap)
{
android_ce_texture_touch(entry);
return entry->header;
}
if (!load)
return NULL;
if (!bytes || bytes > ANDROID_CE_TEXTURE_BYTES || !read)
{
android_ce_texture_failed();
return NULL;
}
/* LRU order makes room without moving survivors. Preserve every entry
* touched this frame, including headers already bound by earlier stages. */
while (oldest && oldest->frame != cache_frame &&
(cache_bytes > ANDROID_CE_TEXTURE_BYTES - bytes || cache_count == ANDROID_CE_TEXTURE_ENTRIES))
{
android_ce_texture_release(oldest);
cache_evictions++;
}
if (cache_bytes > ANDROID_CE_TEXTURE_BYTES - bytes || cache_count == ANDROID_CE_TEXTURE_ENTRIES)
{
android_ce_texture_failed();
return NULL;
}
entry = calloc(1, sizeof(*entry));
if (!entry)
{
android_ce_texture_failed();
return NULL;
}
entry->pixels = calloc(1, bytes);
if (!entry->pixels)
{
free(entry);
android_ce_texture_failed();
return NULL;
}
entry->bitmap = bitmap;
entry->bytes = bytes;
bitmap->base_address = entry->pixels;
read(bitmap, entry->header);
/* A heap pointer is not an Xbox physical address. The renderer resolves
* this header through the registry, with an allocation-length check. */
entry->header[1] = (unsigned long)entry->pixels;
entry->bitmap_next = bitmap_buckets[bucket];
bitmap_buckets[bucket] = entry;
bucket = android_ce_texture_bucket(entry->header);
entry->resource_next = resource_buckets[bucket];
resource_buckets[bucket] = entry;
entry->older = newest;
if (newest)
newest->newer = entry;
else
oldest = entry;
newest = entry;
entry->frame = cache_frame;
cache_bytes += bytes;
cache_count++;
cache_loads++;
if (cache_bytes > cache_peak)
cache_peak = cache_bytes;
return entry->header;
}
#endif
@@ -0,0 +1,20 @@
/* Android CE's bounded, stable pixel storage, outside the Xbox window. */
#ifndef ANDROID_CE_TEXTURE_CACHE_H
#define ANDROID_CE_TEXTURE_CACHE_H
struct bitmap_data;
typedef void (*android_ce_texture_load_proc)(struct bitmap_data *, void *);
void *android_ce_texture_get(struct bitmap_data *bitmap, unsigned long bytes,
int load, android_ce_texture_load_proc read);
void android_ce_texture_delete(struct bitmap_data *bitmap);
void android_ce_texture_reset(void);
void android_ce_texture_idle(void);
int android_ce_texture_resident(const struct bitmap_data *bitmap);
/* Only an exact registered header grants the renderer access to heap pixels.
* Cached map pixels are filled synchronously before this header is published. */
const void *android_ce_texture_pixels(const void *resource, unsigned long *bytes);
void android_ce_texture_gpu_forget(const void *resource);
void android_ce_texture_unbind(const void *resource);
#endif
+3
View File
@@ -3572,6 +3572,8 @@ static struct custom_edition_behaviour_map
} const custom_edition_behaviour_maps[] =
{
#include "custom_edition_behaviours.inc"
/* Locally verified HUD data; not part of Chimera's generated list. */
{ "bigass_open_v1.1", 0xD2BC19F7, BEHAVIOUR(hud_number_scale) | BEHAVIOUR(xbox_ammo_meter_channels) },
};
#undef BEHAVIOUR
@@ -3590,6 +3592,7 @@ static char const *const custom_edition_behaviour_names[NUMBER_OF_CUSTOM_EDITION
"old_widescreen_fix",
"gearbox_shader_environment_types",
"block_multitexture_overlays",
"xbox_ammo_meter_channels",
};
/* the behaviours the map named `map_name` relies on, found as Chimera finds
+4
View File
@@ -252,6 +252,8 @@ enum custom_edition_channel_order
where this build's meters take the fill order from color and discard
what has no alpha */
_custom_edition_channels_hud_meter,
/* Authored Xbox-order meters, including sheets also used as artwork. */
_custom_edition_channels_hud_meter_xbox,
NUMBER_OF_CUSTOM_EDITION_CHANNEL_ORDERS
};
@@ -281,6 +283,8 @@ enum custom_edition_behaviour
_custom_edition_behaviour_gearbox_shader_environment_types,
/* HUD multitexture overlays are not drawn (hud_draw.c) */
_custom_edition_behaviour_block_multitexture_overlays,
/* Bigass Open's ammo sheet has fill in color and shape in alpha. */
_custom_edition_behaviour_xbox_ammo_meter_channels,
NUMBER_OF_CUSTOM_EDITION_BEHAVIOURS
};
+83 -34
View File
@@ -103,33 +103,11 @@ boolean coop_scripts_any_player_will_do(
return any;
}
void coop_scripts_gather_in_volume(
short trigger_volume_index,
boolean coop_scripts_empty_player_list(
long object_list_index)
{
long reference_index;
long object_index;
long inside_index = NONE;
for (object_index = object_list_get_first(object_list_index, &reference_index);
object_index != NONE && inside_index == NONE;
object_index = object_list_get_next(object_list_index, &reference_index))
{
if (scenario_trigger_volume_test_object(trigger_volume_index, object_index))
inside_index = object_index;
}
if (inside_index == NONE)
return;
for (object_index = object_list_get_first(object_list_index, &reference_index);
object_index != NONE;
object_index = object_list_get_next(object_list_index, &reference_index))
{
if (!scenario_trigger_volume_test_object(trigger_volume_index, object_index))
{
player_teleport(player_index_from_unit_index(object_index), inside_index,
&object_get(inside_index)->object.bounding_sphere_center);
}
}
return coop_scripts_host() && (object_list_index == NONE ||
(object_list_is_players(object_list_index) && object_list_count(object_list_index) == 0));
}
/* the units of the players following player0, if `unit_index` is
@@ -141,22 +119,29 @@ static short players_following(
{
struct data_iterator iterator;
struct player_datum *player;
short position = 0;
long players[HALO_PORT_MAXIMUM_NETWORK_PLAYERS];
short player_count = 0;
short position;
short count = 0;
if (unit_index == NONE || !coop_scripts_host())
return 0;
/* (in the order (players) lists them: player0 is the first with a unit) */
/* hs_players adds each unit to the head of a reference list. Its
player0 is the LAST live unit in datum order, not the first. Keep that
same order here, including gaps left by dead or disconnected players. */
data_iterator_new(&iterator, player_data);
while ((player = data_iterator_next(&iterator)) != NULL)
{
if (player->unit_index == NONE)
continue;
if (position == 0 && player->unit_index != unit_index)
return 0;
if (position >= NAMED_PLAYERS && count < maximum_count)
unit_indices[count++] = player->unit_index;
position++;
if (player->unit_index != NONE && player_count < NUMBEROF(players))
players[player_count++] = player->unit_index;
}
if (player_count == 0 || players[player_count - 1] != unit_index)
return 0;
for (position = player_count - NAMED_PLAYERS - 1;
position >= 0 && count < maximum_count;
position--)
{
unit_indices[count++] = players[position];
}
return count;
}
@@ -221,6 +206,70 @@ static boolean teleport_to(
return arrived;
}
/* A placement may fail after moving the unit, or find free ground outside
this volume. Restore that unit before retrying; never move the loaded BSP.
The second attempt uses the same crowd fallback as scripted teleports. */
static void gather_player_in_volume(
short trigger_volume_index,
long unit_index,
long anchor_index,
real_point3d const *destination)
{
long player_index = player_index_from_unit_index(unit_index);
real_point3d original;
real_point3d placed;
short attempt;
if (player_index == NONE)
return;
object_get_origin(unit_index, &original);
for (attempt = 0; attempt < 2; attempt++)
{
boolean arrived = teleport_to(player_index, anchor_index, destination, attempt != 0);
if (arrived && scenario_trigger_volume_test_object(trigger_volume_index, unit_index) &&
!player_position_switches_bsp(object_get_origin(unit_index, &placed)))
{
return;
}
/* This was the unit's valid position at entry, on the same tick. */
object_set_position(unit_index, &original, NULL, NULL);
}
}
void coop_scripts_gather_in_volume(
short trigger_volume_index,
long object_list_index)
{
long reference_index;
long object_index;
long inside_index = NONE;
real_point3d destination;
if (!coop_scripts_host())
return;
for (object_index = object_list_get_first(object_list_index, &reference_index);
object_index != NONE;
object_index = object_list_get_next(object_list_index, &reference_index))
{
if (scenario_trigger_volume_test_object(trigger_volume_index, object_index) &&
!player_position_switches_bsp(object_get_origin(object_index, &destination)))
{
inside_index = object_index;
break;
}
}
if (inside_index == NONE)
return;
for (object_index = object_list_get_first(object_list_index, &reference_index);
object_index != NONE;
object_index = object_list_get_next(object_list_index, &reference_index))
{
if (!scenario_trigger_volume_test_object(trigger_volume_index, object_index))
gather_player_in_volume(trigger_volume_index, object_index, inside_index, &destination);
}
}
boolean coop_scripts_unit_near(
long unit_index,
real_point3d const *destination)
+6 -1
View File
@@ -16,9 +16,14 @@ Campaign scripts made to work for every player in network co-op
list as inside once any of it is, because every object in it is a player */
boolean coop_scripts_any_player_will_do(
long object_list_index);
/* An empty (players) result or failed list allocation cannot advance a
co-op gate. Does not change valid empty AI lists or non-host behavior. */
boolean coop_scripts_empty_player_list(
long object_list_index);
/* and when a script waits on it and one player is inside, the players of
the list outside come beside that one, so a gate (the Maw's lift, the run
to its bridge, a30's Pelicans) leaves no one behind */
to its bridge, a30's Pelicans) leaves no one behind. The caller must test
the volume again: a failed placement leaves the script waiting. */
void coop_scripts_gather_in_volume(
short trigger_volume_index,
long object_list_index);
+17 -3
View File
@@ -197,6 +197,7 @@ struct reordered_bitmap
struct custom_edition_bitmaps_globals
{
struct reordered_bitmap *reordered_bitmaps;
unsigned long behaviours;
long reordered_bitmap_count;
long reordered_bitmap_capacity;
};
@@ -394,7 +395,9 @@ static boolean reordered_bitmap_mark(
if (index != NONE)
{
if (globals->reordered_bitmaps[index].channel_order != channel_order)
if (globals->reordered_bitmaps[index].channel_order != channel_order &&
!(globals->reordered_bitmaps[index].channel_order == _custom_edition_channels_hud_meter_xbox &&
channel_order == NONE))
{
globals->reordered_bitmaps[index].drawn_otherwise = TRUE;
}
@@ -477,8 +480,16 @@ static boolean meter_bitmaps_mark(
struct tag_view const *view,
struct meter_hud_element_definition const *meter)
{
short order = _custom_edition_channels_hud_meter;
/* Open v1.1 changed this shared weapon sheet to Xbox channel order.
Keep the explicit identity even when static elements use it too. */
if ((custom_edition_bitmaps_globals.behaviours & (1UL << _custom_edition_behaviour_xbox_ammo_meter_channels)) &&
!strcmp(view_tag_name(view, DATUM_INDEX_TO_ABSOLUTE_INDEX(meter->meter_bitmap.index)),
"bourrin\\hud\\v3\\bitmaps\\all icons wips"))
order = _custom_edition_channels_hud_meter_xbox;
return reordered_bitmaps_mark(view, meter->meter_bitmap.index, meter->sequence_index,
_custom_edition_channels_hud_meter);
order);
}
/* the bitmaps a HUD static element draws as they are */
@@ -776,10 +787,12 @@ boolean custom_edition_bitmaps_verify(
boolean custom_edition_reordered_bitmaps_find(
byte *tag_cache,
unsigned long loaded_bytes)
unsigned long loaded_bytes,
unsigned long behaviours)
{
struct tag_view view;
custom_edition_bitmaps_globals.behaviours = behaviours;
view.tag_cache = tag_cache;
view.loaded_bytes = loaded_bytes;
@@ -824,6 +837,7 @@ void custom_edition_bitmaps_dispose(
globals->reordered_bitmaps = NULL;
globals->reordered_bitmap_count = 0;
globals->reordered_bitmap_capacity = 0;
globals->behaviours = 0;
/* the pixels it was told of are the texture cache's to reuse */
halo_custom_edition_texels_forget();
+15 -1
View File
@@ -596,6 +596,14 @@ static void custom_edition_behaviours_log(
{
if (!((behaviours >> behaviour) & 1))
continue;
if (behaviour == _custom_edition_behaviour_gearbox_meters ||
behaviour == _custom_edition_behaviour_old_widescreen_fix)
{
error(_error_silent,
"custom edition: relies on Halo PC's %s (Chimera's map list), partially supported (HUD tint/warning placement)",
custom_edition_behaviour_name(behaviour));
continue;
}
error(
_error_silent,
(FOLLOWED_BEHAVIOURS >> behaviour) & 1 ?
@@ -742,7 +750,7 @@ static boolean custom_edition_cache_tags_convert(
return custom_edition_cache_tags_validate(tag_cache, report) &&
custom_edition_bitmaps_verify(tag_cache, loaded_bytes) &&
custom_edition_reordered_bitmaps_find(tag_cache, loaded_bytes) &&
custom_edition_reordered_bitmaps_find(tag_cache, loaded_bytes, custom_edition_cache_globals.behaviours) &&
custom_edition_scripts_convert(tag_cache, loaded_bytes) &&
custom_edition_cache_models_convert(tag_cache, report);
}
@@ -1273,6 +1281,12 @@ void custom_edition_cache_tags_unload(
return;
}
struct resource_map const *custom_edition_cache_bitmap_resources(void)
{
return custom_edition_cache_tags_loaded() ?
custom_edition_cache_globals.resource_maps[_resource_map_bitmaps] : NULL;
}
void custom_edition_cache_read(
long tag_index,
long offset,
+5 -1
View File
@@ -57,6 +57,9 @@ Custom Edition map is loaded. */
boolean custom_edition_cache_stock_tag(
long tag_index);
/* Borrowed until map unload; reads remain bounds checked by the source. */
struct resource_map const *custom_edition_cache_bitmap_resources(void);
/* When `header` (CACHE_FILE_HEADER_BYTES bytes, with `build` its build
string field) is a Custom Edition cache header that reached the Xbox loader,
logs why the file at `path` cannot run and returns TRUE: the map is refused,
@@ -221,7 +224,8 @@ FALSE after logging why it cannot. custom_edition_bitmaps_dispose forgets
them either way. */
boolean custom_edition_reordered_bitmaps_find(
byte *tag_cache,
unsigned long loaded_bytes);
unsigned long loaded_bytes,
unsigned long behaviours);
/* As custom_edition_reordered_bitmaps_find, in the loaded map's tags, which
the validator has checked: for the bitmaps of mods (mod_bitmaps.c), Halo
PC's on any map. FALSE after logging why it cannot. */
+36
View File
@@ -0,0 +1,36 @@
/* CE warning graphics use crosshair states but are not aiming reticles. */
#ifndef CUSTOM_EDITION_HUD_H
#define CUSTOM_EDITION_HUD_H
#include "cache_file_formats.h"
#include "custom_edition_cache.h"
static boolean custom_edition_hud_warning(short state)
{
return custom_edition_cache_tags_loaded() &&
((state >= 3 && state <= 15) || state == 18);
}
/* Legacy HUDs placed warnings beside corner panels using offsets from a
* 640x480 canvas center with PC's 8-pixel HUD margins (Chimera's
* hud_bitmap_scale.hpp). Translate to the current title-safe frame, just
* as the corner panels do. Centered warnings remain centered. */
static void custom_edition_hud_warning_placement(short state, short width, short height,
struct hud_placement_definition *placement)
{
long extra;
if (!custom_edition_hud_warning(state) ||
!custom_edition_cache_relies_on(_custom_edition_behaviour_old_widescreen_fix))
return;
extra = (width - 624) / 2;
if (placement->offset.x > 0)
placement->offset.x = (short)PIN(placement->offset.x + extra, SHORT_MIN, SHORT_MAX);
else if (placement->offset.x < 0)
placement->offset.x = (short)PIN(placement->offset.x - extra, SHORT_MIN, SHORT_MAX);
extra = (height - 464) / 2;
if (placement->offset.y > 0)
placement->offset.y = (short)PIN(placement->offset.y + extra, SHORT_MIN, SHORT_MAX);
else if (placement->offset.y < 0)
placement->offset.y = (short)PIN(placement->offset.y - extra, SHORT_MIN, SHORT_MAX);
}
#endif
@@ -0,0 +1,118 @@
/* Original controller sprites for CE maps whose messaging sheet holds weapons.
* Resource tag addresses are offsets into that item, not engine pointers. */
#ifndef CUSTOM_EDITION_HUD_BUTTONS_H
#define CUSTOM_EDITION_HUD_BUTTONS_H
#include "cache_file_formats.h"
#include "custom_edition_cache.h"
#include "interface/hud_draw.h"
static struct
{
byte tag[8192];
unsigned long size;
struct bitmap_data *bitmaps[2];
boolean attempted;
} ce_hud_buttons;
static unsigned long ce_hud_button_u32(byte const *p)
{
return (unsigned long)p[0] | ((unsigned long)p[1] << 8) |
((unsigned long)p[2] << 16) | ((unsigned long)p[3] << 24);
}
static byte const *ce_hud_button_range(unsigned long offset, unsigned long count, unsigned long stride)
{
if (offset > ce_hud_buttons.size || count > (ce_hud_buttons.size - offset) / stride)
return NULL;
return ce_hud_buttons.tag + offset;
}
static void ce_hud_buttons_forget(void)
{
short i;
for (i = 0; i < 2; i++)
if (ce_hud_buttons.bitmaps[i]) bitmap_delete(ce_hud_buttons.bitmaps[i]);
csmemset(&ce_hud_buttons, 0, sizeof(ce_hud_buttons));
}
static boolean ce_hud_button_draw(struct icon_hud_element_definition const *icon,
rectangle2d *cursor, pixel32 color)
{
struct resource_map const *resources = custom_edition_cache_bitmap_resources();
byte const *sequences, *sequence, *sprites, *data;
struct bitmap_group_sprite sprite;
struct bitmap_data *bitmap;
unsigned long count, frame, bitmap_index, offset, bytes;
long i;
real viewport, scale, width, height;
point2d point;
if (!resources) return FALSE;
if (!ce_hud_buttons.attempted)
{
ce_hud_buttons.attempted = TRUE;
for (i = 0; i < resources->item_count; i++)
{
struct resource_map_item const *item = &resources->items[i];
if (strcmp(item->name, "ui\\hud\\bitmaps\\hud_msg_icons_sm")) continue;
if (item->size >= 108 && item->size <= sizeof(ce_hud_buttons.tag) &&
resources->source->read(resources->source->context, item->data_offset,
item->size, ce_hud_buttons.tag)) ce_hud_buttons.size = item->size;
break;
}
}
if (!ce_hud_buttons.size || icon->sequence_index < 0) return FALSE;
count = ce_hud_button_u32(ce_hud_buttons.tag + 84);
sequences = ce_hud_button_range(ce_hud_button_u32(ce_hud_buttons.tag + 88), count, 64);
if (!sequences || (unsigned long)icon->sequence_index >= count) return FALSE;
sequence = sequences + icon->sequence_index * 64;
count = ce_hud_button_u32(sequence + 52);
sprites = ce_hud_button_range(ce_hud_button_u32(sequence + 56), count, 32);
if (!sprites || !count) return FALSE;
frame = icon->frame_rate > 0 ? (unsigned long)(game_time_get() / icon->frame_rate) % count : 0;
csmemcpy(&sprite, sprites + frame * 32, sizeof(sprite));
if (!(sprite.bounds.x0 >= 0 && sprite.bounds.x1 <= 1 && sprite.bounds.x1 > sprite.bounds.x0 &&
sprite.bounds.y0 >= 0 && sprite.bounds.y1 <= 1 && sprite.bounds.y1 > sprite.bounds.y0)) return FALSE;
bitmap_index = (unsigned long)sprite.bitmap_index;
count = ce_hud_button_u32(ce_hud_buttons.tag + 96);
data = ce_hud_button_range(ce_hud_button_u32(ce_hud_buttons.tag + 100), count, 48);
if (!data || bitmap_index >= count || bitmap_index >= 2) return FALSE;
data += bitmap_index * 48;
/* The stock controller sheet is two 128-square, linear ARGB images.
* Refuse other layouts rather than interpreting custom resource data. */
if (ce_hud_button_u32(data + 4) != 0x00800080 ||
ce_hud_button_u32(data + 8) != 1 || (data[12] != 11 || data[13]) ||
(data[14] & (2 | 4 | 8 | 16))) return FALSE;
bitmap = ce_hud_buttons.bitmaps[bitmap_index];
if (!bitmap)
{
offset = ce_hud_button_u32(data + 24);
bytes = ce_hud_button_u32(data + 28);
if (bytes < 65536 || offset > resources->source->size ||
65536 > resources->source->size - offset) return FALSE;
bitmap = bitmap_2d_new(128, 128, 0, 11);
if (!bitmap) return FALSE;
if (!bitmap->base_address || !resources->source->read(resources->source->context,
offset, 65536, bitmap->base_address) || !rasterizer_bitmap_new(bitmap))
{
bitmap_delete(bitmap);
return FALSE;
}
rasterizer_bitmap_changed(bitmap);
ce_hud_buttons.bitmaps[bitmap_index] = bitmap;
}
/* Match the native gameplay face's 26-pixel height: the CE resource
* uses 20-pixel faces. Align to the active font's capitals, not the
* stock font's baseline offsets. Keep all sprite proportions/frames. */
viewport = local_player_count() > 1 ? 0.75f : 1.0f;
scale = viewport * (26.0f / 20.0f);
width = (sprite.bounds.x1 - sprite.bounds.x0) * bitmap->width * scale;
height = (sprite.bounds.y1 - sprite.bounds.y0) * bitmap->height * scale;
point.x = (short)(cursor->x0 + 4.0f * viewport);
point.y = (short)(draw_unicode_string_capital_middle(cursor, L"") + height * 0.5f);
hud_draw_bitmap_direct(bitmap, _hud_anchor_bottom_left, &point, &sprite.bounds,
scale, 0.0f, icon->flags & 2 ? icon->color : color, FALSE);
/* The following text run supplies its own three-pixel leading inset. */
cursor->x0 = (short)(point.x + width - 3.0f * viewport);
return TRUE;
}
#endif
+431
View File
@@ -0,0 +1,431 @@
/*
GAME_MODES.C
OpenCE's gametypes: SWAT, Infection and Gun Game, modes of Slayer, and
Hardcore, rules over any game engine's. Which a gametype plays is in its PC
options (game_engine.h's struct game_variant_options, from mode on), which a
saved gametype keeps (playlist_profile.c), the network game carries to every
machine (network_game_manager.h) and the game plays by
(game_variant_options_get).
- SWAT: no shields, and a shot to the head of any weapon kills (damage.c).
Its built-in gametype starts everyone with a pistol and an assault rifle,
with no weapons on the map, no grenades and no motion sensor.
- Infection (infection.c): on teams. Humans are red, zombies blue; the host
chooses the first zombies after a countdown, a human killed joins them, and
the zombies win when no human is left, the humans when the time runs out.
- Gun Game (gun_game.c): free for all. Each kill gives the killer the next
weapon of a list; a kill with the last wins.
- Hardcore: no motion sensor, no aim assist, and a kill restores the
killer's health and shields.
The built-in gametypes (game_modes_gametype) are written with the Xbox's
default ones, after them, and the Select Gametype screen lists them in a bank
of their own (menu_functions.c's OPENCE).
*/
#include "cseries.h"
#include "game/game.h"
#include "game/game_engine.h"
#include "game/game_engine_playlist.h"
#include "game/players.h"
#include "networking/network_game_globals.h"
#include "objects/objects.h"
#include "units/units.h"
#include "game_modes.h"
#include "gun_game.h"
#include "infection.h"
#include <string.h>
/* game_engine.c's values of the variant's (its enums goal_radar,
game_engine_weapons and game_engine_vehicles) */
enum
{
GOAL_RADAR_NAV_POINT = 1,
WEAPON_SET_NO_GRENADES = 10,
VEHICLE_SET_NONE = 1
};
/* Infection's options when a gametype has none (game_modes_options_sanitize) */
enum
{
INFECTION_DEFAULT_INITIAL_ZOMBIES = 1,
INFECTION_DEFAULT_ZOMBIE_SPEED = 150,
INFECTION_DEFAULT_SKULL_DAMAGE = 200,
INFECTION_DEFAULT_RESPAWN_TIME = 5,
INFECTION_DEFAULT_COUNTDOWN = 10
};
enum
{
_gametype_swat = 0,
_gametype_infection,
_gametype_gun_game,
_gametype_hardcore_slayer,
_gametype_hardcore_ctf,
_gametype_hardcore_oddball,
_gametype_hardcore_king,
NUMBER_OF_GAMETYPES
};
static struct
{
/* debug.network_test's */
char const *name;
/* the gametype lists' */
wchar_t const *display_name;
/* the variant's own (11 characters at most: the lobby's and the server
browser's) */
wchar_t const *variant_name;
} const game_modes_gametypes[NUMBER_OF_GAMETYPES] =
{
{ "swat", L"SWAT", L"SWAT" },
{ "infection", L"Infection", L"Infection" },
{ "gun_game", L"Gun Game", L"Gun Game" },
{ "hardcore", L"Hardcore Slayer", L"Hardcore" },
{ "hardcore_ctf", L"Hardcore CTF", L"HC CTF" },
{ "hardcore_oddball", L"Hardcore Oddball", L"HC Oddball" },
{ "hardcore_king", L"Hardcore King", L"HC King" },
};
/* the kill being recorded is a melee's (game_modes_kill_by_melee) */
static boolean game_modes_melee_kill;
/* ---- the built-in gametypes */
short game_modes_gametype_count(
void)
{
return NUMBER_OF_GAMETYPES;
}
wchar_t const *game_modes_gametype_name(
short index)
{
return VALID_INDEX(index, NUMBER_OF_GAMETYPES) ? game_modes_gametypes[index].display_name : L"";
}
/* a variant without a motion sensor: no players on it, and a goal (a flag,
the ball, the hill) shown by its nav point instead */
static void game_modes_no_motion_sensor(
struct game_variant *variant,
struct game_variant_options *options)
{
SET_FLAG(variant->universal_variant.flags, _game_variant_draw_object_in_motion_sensor_bit, FALSE);
variant->universal_variant.goal_radar = GOAL_RADAR_NAV_POINT;
options->radar_players = _radar_players_none;
}
void game_modes_gametype(
short index,
struct game_variant *variant,
struct game_variant_options *options)
{
struct game_variant temporary;
switch (index)
{
case _gametype_hardcore_ctf:
*variant = *build_game_variant_ctf(&temporary);
break;
case _gametype_hardcore_oddball:
*variant = *build_game_variant_team_oddball(&temporary);
break;
case _gametype_hardcore_king:
*variant = *build_game_variant_team_king(&temporary);
break;
case _gametype_gun_game:
*variant = *build_game_variant_slayer(&temporary);
break;
default:
*variant = *build_game_variant_team_slayer(&temporary);
break;
}
game_variant_options_default(variant, options);
switch (index)
{
case _gametype_swat:
options->mode = _game_mode_swat;
SET_FLAG(variant->universal_variant.flags, _game_variant_no_shields_bit, TRUE);
variant->universal_variant.weapon_set = WEAPON_SET_NO_GRENADES;
variant->universal_variant.vehicle_set = VEHICLE_SET_NONE;
variant->universal_variant.respawn_time = 150;
game_modes_no_motion_sensor(variant, options);
options->loadout = _loadout_custom;
options->primary_weapon = _loadout_weapon_pistol;
options->secondary_weapon = _loadout_weapon_assault_rifle;
options->no_map_weapons = TRUE;
break;
case _gametype_infection:
options->mode = _game_mode_infection;
variant->universal_variant.vehicle_set = VEHICLE_SET_NONE;
variant->universal_variant.respawn_time = INFECTION_DEFAULT_RESPAWN_TIME * TICKS_PER_SECOND;
variant->universal_variant.suicide_penalty = 0;
options->time_limit = 5;
options->friendly_fire = _friendly_fire_off;
break;
case _gametype_gun_game:
options->mode = _game_mode_gun_game;
variant->universal_variant.weapon_set = WEAPON_SET_NO_GRENADES;
variant->universal_variant.vehicle_set = VEHICLE_SET_NONE;
variant->universal_variant.respawn_time = 90;
variant->universal_variant.suicide_penalty = 0;
options->no_map_weapons = TRUE;
break;
default:
options->hardcore = TRUE;
options->friendly_fire = _friendly_fire_on;
game_modes_no_motion_sensor(variant, options);
break;
}
/* (each team's vehicles the variant's, as game_variant_options_default
gives them) */
options->vehicle_set[0] = options->vehicle_set[1] = (byte)variant->universal_variant.vehicle_set;
game_modes_options_sanitize(options);
csmemset(variant->human_readable_game_description, 0, sizeof(variant->human_readable_game_description));
if (VALID_INDEX(index, NUMBER_OF_GAMETYPES))
{
ustrncpy(variant->human_readable_game_description, game_modes_gametypes[index].variant_name,
NUMBEROF(variant->human_readable_game_description) - 1);
}
}
boolean game_modes_gametype_by_name(
char const *name,
struct game_variant *variant,
struct game_variant_options *options)
{
short index;
for (index = 0; index < NUMBER_OF_GAMETYPES; index++)
{
if (!strcmp(name, game_modes_gametypes[index].name))
{
game_modes_gametype(index, variant, options);
return TRUE;
}
}
return FALSE;
}
/* ---- a gametype's options */
void game_modes_options_default(
struct game_variant_options *options)
{
options->mode = _game_mode_none;
options->hardcore = FALSE;
options->infection_initial_zombies = INFECTION_DEFAULT_INITIAL_ZOMBIES;
options->infection_zombie_speed = INFECTION_DEFAULT_ZOMBIE_SPEED;
options->infection_skull_damage = INFECTION_DEFAULT_SKULL_DAMAGE;
options->infection_respawn_time = INFECTION_DEFAULT_RESPAWN_TIME;
options->infection_countdown = INFECTION_DEFAULT_COUNTDOWN;
options->infection_zombie_shields = TRUE;
options->gun_game_order = _gun_game_order_strongest_first;
options->gun_game_melee_demotes = TRUE;
csmemset(options->reserved, 0, sizeof(options->reserved));
}
/* a byte option within its range, else its default */
static byte game_modes_option(
byte value,
byte minimum,
byte maximum,
byte default_value)
{
return value >= minimum && value <= maximum ? value : default_value;
}
void game_modes_options_sanitize(
struct game_variant_options *options)
{
if (options->mode >= NUMBER_OF_GAME_MODES)
options->mode = _game_mode_none;
options->hardcore = options->hardcore != FALSE;
options->infection_initial_zombies = game_modes_option(options->infection_initial_zombies, 1, 16,
INFECTION_DEFAULT_INITIAL_ZOMBIES);
options->infection_zombie_speed = game_modes_option(options->infection_zombie_speed, 100, 200,
INFECTION_DEFAULT_ZOMBIE_SPEED);
options->infection_skull_damage = game_modes_option(options->infection_skull_damage, 100, 250,
INFECTION_DEFAULT_SKULL_DAMAGE);
options->infection_respawn_time = game_modes_option(options->infection_respawn_time, 1, 30,
INFECTION_DEFAULT_RESPAWN_TIME);
options->infection_countdown = game_modes_option(options->infection_countdown, 0, 30,
INFECTION_DEFAULT_COUNTDOWN);
options->infection_zombie_shields = options->infection_zombie_shields != FALSE;
if (options->gun_game_order >= NUMBER_OF_GUN_GAME_ORDERS)
options->gun_game_order = _gun_game_order_strongest_first;
options->gun_game_melee_demotes = options->gun_game_melee_demotes != FALSE;
csmemset(options->reserved, 0, sizeof(options->reserved));
}
short game_modes_variant_mode(
struct game_variant const *variant,
struct game_variant_options const *options)
{
if (!variant || !options || variant->game_engine_index != game_engine_slayer)
return _game_mode_none;
switch (options->mode)
{
case _game_mode_swat:
return _game_mode_swat;
case _game_mode_infection:
return variant->universal_variant.teams ? _game_mode_infection : _game_mode_none;
case _game_mode_gun_game:
return !variant->universal_variant.teams ? _game_mode_gun_game : _game_mode_none;
}
return _game_mode_none;
}
wchar_t const *game_modes_variant_kind_name(
struct game_variant const *variant,
struct game_variant_options const *options)
{
switch (game_modes_variant_mode(variant, options))
{
case _game_mode_swat:
return options->hardcore ? L"HARDCORE SWAT" : L"SWAT";
case _game_mode_infection:
return options->hardcore ? L"HARDCORE INFECTION" : L"INFECTION";
case _game_mode_gun_game:
return options->hardcore ? L"HARDCORE GUN GAME" : L"GUN GAME";
}
if (!options || !options->hardcore || !variant)
return NULL;
switch (variant->game_engine_index)
{
case game_engine_ctf:
return L"HARDCORE CTF";
case game_engine_slayer:
return L"HARDCORE SLAYER";
case game_engine_oddball:
return L"HARDCORE ODDBALL";
case game_engine_king:
return L"HARDCORE KING";
case game_engine_race:
return L"HARDCORE RACE";
}
return NULL;
}
boolean game_modes_variant_is_opence(
struct game_variant const *variant,
struct game_variant_options const *options)
{
return options && (options->hardcore || game_modes_variant_mode(variant, options) != _game_mode_none);
}
/* ---- the game being played */
short game_modes_mode(
void)
{
if (!game_engine_running())
return _game_mode_none;
return game_modes_variant_mode(game_engine_get_variant(), game_variant_options_get());
}
boolean game_modes_hardcore(
void)
{
return game_engine_running() && game_variant_options_get()->hardcore;
}
struct game_engine *game_modes_engine(
struct game_engine *engine)
{
switch (game_modes_mode())
{
case _game_mode_swat:
/* (SWAT is played without shields, whatever its variant's) */
SET_FLAG(game_engine_get_variant()->universal_variant.flags, _game_variant_no_shields_bit, TRUE);
break;
case _game_mode_infection:
return infection_engine_get(engine);
case _game_mode_gun_game:
return gun_game_engine_get(engine);
}
return engine;
}
void game_modes_postspawn(
long player_index)
{
switch (game_modes_mode())
{
case _game_mode_infection:
infection_postspawn(player_index);
break;
case _game_mode_gun_game:
gun_game_postspawn(player_index);
break;
}
}
void game_modes_player_killed(
long killing_player_index,
long dead_player_index,
boolean friendly_fire)
{
struct player_datum *killer;
struct unit_datum *unit;
/* Hardcore: the host restores the killer's health, and their shields
unless an overshield has them past full */
if (!game_modes_hardcore() || network_game_distributed_client() || friendly_fire ||
killing_player_index == NONE || killing_player_index == dead_player_index)
{
return;
}
killer = player_try_and_get(killing_player_index);
if (!killer || killer->unit_index == NONE)
return;
unit = unit_try_and_get(killer->unit_index);
if (!unit || TEST_FLAG(unit->object.damage_flags, _object_dead_bit))
return;
unit->object.body_vitality = 1.0f;
if (unit->object.maximum_shield_vitality > 0.0f && unit->object.shield_vitality < 1.0f)
{
unit->object.shield_vitality = 1.0f;
SET_FLAG(unit->object.damage_flags, _object_shield_depleted_bit, FALSE);
SET_FLAG(unit->object.damage_flags, _object_shield_charging_bit, FALSE);
}
}
void game_modes_kill_by_melee(
boolean melee)
{
game_modes_melee_kill = melee;
}
boolean game_modes_killed_by_melee(
void)
{
return game_modes_melee_kill;
}
boolean game_modes_headshot_kills(
long object_index,
boolean shot)
{
struct unit_datum *unit;
if (!shot || game_modes_mode() != _game_mode_swat)
return FALSE;
unit = (struct unit_datum *)object_try_and_get_and_verify_type(object_index, _object_mask_biped);
return unit && unit->unit.player_index != NONE;
}
boolean game_modes_motion_sensor_hidden(
void)
{
return game_modes_hardcore();
}
boolean game_modes_aim_assist_off(
void)
{
return game_modes_hardcore();
}
+78
View File
@@ -0,0 +1,78 @@
/* game_modes.h: OpenCE's gametypes (port/linux/game/game_modes.c)
SWAT, Infection and Gun Game are modes of Slayer, and Hardcore is a set of
rules over any game engine's: a gametype's PC options (game_engine.h's struct
game_variant_options, from mode on) say which, so a saved gametype, the
network game and the game all carry them. The built-in ones are written with
the Xbox's default gametypes (playlist_profile.c), after them, and the
Select Gametype screen lists them in a bank of their own, OPENCE. */
#ifndef HALO_GAME_MODES_H
#define HALO_GAME_MODES_H
struct game_engine;
struct game_variant;
struct game_variant_options;
/* the built-in gametypes' place among the default ones (the Xbox's 26 come
first: playlist_profile.c checks it) */
#define GAME_MODES_FIRST_DEFAULT_PLAYLIST_PROFILE 26
/* ---- the built-in gametypes */
short game_modes_gametype_count(void);
/* its name in the gametype lists */
wchar_t const *game_modes_gametype_name(short index);
/* its variant and options */
void game_modes_gametype(short index, struct game_variant *variant, struct game_variant_options *options);
/* the one of that name (debug.network_test's: "swat", "infection",
"gun_game", "hardcore", "hardcore_ctf" ...), FALSE if none is */
boolean game_modes_gametype_by_name(char const *name, struct game_variant *variant,
struct game_variant_options *options);
/* ---- a gametype's options */
/* OpenCE's options at their defaults, with no mode (a gametype's that has
none of its own: game_variant_options_default, and one saved before them) */
void game_modes_options_default(struct game_variant_options *options);
/* each of OpenCE's options in range (a file's or another machine's), its
mode's own set to their defaults where none were given */
void game_modes_options_sanitize(struct game_variant_options *options);
/* the mode a gametype plays: its options' if its game engine and teams
allow it (SWAT and Infection on teams, Gun Game free for all, all of them
Slayer), else none */
short game_modes_variant_mode(struct game_variant const *variant, struct game_variant_options const *options);
/* the name the menus show for its kind of game ("INFECTION", "HARDCORE
CTF"), NULL for a game engine's own ("SLAYER") */
wchar_t const *game_modes_variant_kind_name(struct game_variant const *variant,
struct game_variant_options const *options);
/* whether a gametype is one of OpenCE's (a mode, or Hardcore) */
boolean game_modes_variant_is_opence(struct game_variant const *variant, struct game_variant_options const *options);
/* ---- the game being played */
/* its mode (_game_mode_none with no game engine) */
short game_modes_mode(void);
/* whether it plays by Hardcore's rules */
boolean game_modes_hardcore(void);
/* the game engine a mode plays with: Infection's and Gun Game's are
Slayer's with their own rules; SWAT's variant has no shields
(game_engine_initialize) */
struct game_engine *game_modes_engine(struct game_engine *engine);
/* a player's spawn, after its starting equipment (game_engine_postspawn_player_update) */
void game_modes_postspawn(long player_index);
/* a player killed (game_engine_player_killed, after the game engine's):
Hardcore's restore of the killer */
void game_modes_player_killed(long killing_player_index, long dead_player_index, boolean friendly_fire);
/* the kill being recorded is a melee's (damage.c, around
game_statistics_record_kill) */
void game_modes_kill_by_melee(boolean melee);
boolean game_modes_killed_by_melee(void);
/* a shot's hit on a player's head (a bullet's, a plasma bolt's, a needle's,
not a melee's or an explosion's) kills at once (SWAT) */
boolean game_modes_headshot_kills(long object_index, boolean shot);
/* the motion sensor is not drawn (Hardcore) */
boolean game_modes_motion_sensor_hidden(void);
/* no aim assist: neither autoaim nor magnetism (Hardcore) */
boolean game_modes_aim_assist_off(void);
#endif
+300
View File
@@ -0,0 +1,300 @@
/*
GUN_GAME.C
Gun Game, a mode of free for all Slayer (game_modes.c). Everyone starts with
the first weapon of a list and nothing else; each kill gives the killer the
next, and a kill with the last wins. A player's level is their Slayer score
(the kills less the suicides), so the scores the host sends its clients
(game_engine_slayer_write_network_state) carry it, and the game ends as
Slayer's does, at the score to win, which is the list's length.
The list is those of the loadout weapons (game_engine.h's _loadout_weapon_*)
the map has, the strongest first (the rocket launcher, the shotgun, the
sniper rifle, the plasma rifle, the assault rifle, the needler, the plasma
pistol, the pistol), the weakest first, or in an order the host draws for
each game. Only the host gives weapons: a player's weapons go to every
machine with their inventory (network_objects.c). No one picks up a
weapon; a weapon emptied is replaced with a full one; and a melee kill can
take the victim back a weapon (gun_game_melee_demotes).
*/
#include "cseries.h"
#include "game/game.h"
#include "game/game_engine.h"
#include "game/game_engine_slayer.h"
#include "game/players.h"
#include "items/weapons.h"
#include "items/weapon_definitions.h"
#include "networking/network_game_globals.h"
#include "objects/objects.h"
#include "units/units.h"
#include "game_modes.h"
#include "gun_game.h"
static byte const gun_game_strongest_first[] =
{
_loadout_weapon_rocket_launcher,
_loadout_weapon_shotgun,
_loadout_weapon_sniper_rifle,
_loadout_weapon_plasma_rifle,
_loadout_weapon_assault_rifle,
_loadout_weapon_needler,
_loadout_weapon_plasma_pistol,
_loadout_weapon_pistol,
};
#define GUN_GAME_MAXIMUM_LEVELS NUMBEROF(gun_game_strongest_first)
static struct
{
struct game_engine engine;
struct game_engine slayer;
/* the map's list, its weapons as _loadout_weapon_* */
byte levels[GUN_GAME_MAXIMUM_LEVELS];
short level_count;
/* the host's: each player's unit given a level's weapon, and that level
(by absolute player index) */
long equipped_unit[HALO_PORT_MAXIMUM_NETWORK_PLAYERS];
short equipped_level[HALO_PORT_MAXIMUM_NETWORK_PLAYERS];
/* a weapon being given (gun_game_allow_pick_up allows it) */
boolean equipping;
} gun_game;
short gun_game_level_count(
void)
{
return gun_game.level_count;
}
byte gun_game_level_weapon(
short level)
{
return VALID_INDEX(level, gun_game.level_count) ? gun_game.levels[level] : _loadout_weapon_none;
}
/* a player's level: their score, within the list */
static short gun_game_player_level(
long player_index)
{
long score = gun_game.slayer.get_player_score(player_index, _get_score_individual);
return (short)PIN(score, 0, MAX(gun_game.level_count - 1, 0));
}
/* a weapon with no rounds left (none loaded nor carried), or a battery
spent */
static boolean gun_game_weapon_empty(
long weapon_index)
{
struct weapon_datum *weapon = weapon_try_and_get(weapon_index);
struct weapon_definition *definition;
short magazine;
if (!weapon)
return FALSE;
definition = weapon_definition_get(weapon->definition_index);
if (definition->weapon.magazines.count <= 0)
return weapon->weapon.age >= 1.0f;
for (magazine = 0; magazine < MIN(definition->weapon.magazines.count, NUMBEROF(weapon->weapon.magazines));
magazine++)
{
if (weapon->weapon.magazines[magazine].rounds_loaded > 0 || weapon->weapon.magazines[magazine].rounds_total > 0)
return FALSE;
}
return TRUE;
}
/* every weapon of a unit gone, the one in its hand too (which
unit_delete_all_weapons keeps) */
static void gun_game_delete_weapons(
long unit_index)
{
struct unit_datum *unit = unit_get(unit_index);
short slot;
short other;
for (slot = 0; slot < MAXIMUM_WEAPONS_PER_UNIT; slot++)
{
long weapon_index = unit->unit.weapon_object_indices[slot];
if (weapon_index == NONE)
continue;
/* (each deleted once, should two slots hold it) */
for (other = slot; other < MAXIMUM_WEAPONS_PER_UNIT; other++)
{
if (unit->unit.weapon_object_indices[other] == weapon_index)
{
unit->unit.weapon_object_indices[other] = NONE;
if (unit->unit.current_weapon_index == other)
unit->unit.current_weapon_index = NONE;
if (unit->unit.desired_weapon_index == other)
unit->unit.desired_weapon_index = NONE;
}
}
if (object_try_and_get(weapon_index))
object_delete(weapon_index);
}
}
/* the host gives a living player their level's weapon (their others gone),
again when it is spent */
static void gun_game_equip(
long player_index)
{
struct player_datum *player = player_get(player_index);
long slot = DATUM_INDEX_TO_ABSOLUTE_INDEX(player_index);
struct unit_datum *unit;
short level;
long definition_index;
long weapon_index;
struct object_placement_data placement;
if (network_game_distributed_client() || !VALID_INDEX(slot, HALO_PORT_MAXIMUM_NETWORK_PLAYERS) ||
player->quit_out_of_game || player->unit_index == NONE || !gun_game.level_count)
{
return;
}
unit = unit_try_and_get(player->unit_index);
if (!unit || TEST_FLAG(unit->object.damage_flags, _object_dead_bit))
return;
level = gun_game_player_level(player_index);
if (gun_game.equipped_unit[slot] == player->unit_index && gun_game.equipped_level[slot] == level)
{
long current = VALID_INDEX(unit->unit.current_weapon_index, MAXIMUM_WEAPONS_PER_UNIT) ?
unit->unit.weapon_object_indices[unit->unit.current_weapon_index] : NONE;
if (current != NONE && !gun_game_weapon_empty(current))
return;
}
/* (no weapon in the hand: a grenade being thrown has it, so wait) */
if (unit->unit.grenade_throw_state != _unit_grenade_throw_idle)
return;
definition_index = game_engine_loadout_weapon_definition(gun_game.levels[level]);
if (definition_index == NONE)
return;
gun_game.equipping = TRUE;
gun_game_delete_weapons(player->unit_index);
object_placement_data_new(&placement, definition_index, NONE);
weapon_index = object_new(&placement);
if (weapon_index != NONE && !unit_add_weapon_to_inventory(player->unit_index, weapon_index, 2))
{
object_delete(weapon_index);
weapon_index = NONE;
}
gun_game.equipping = FALSE;
gun_game.equipped_unit[slot] = player->unit_index;
gun_game.equipped_level[slot] = level;
}
void gun_game_postspawn(
long player_index)
{
long slot = DATUM_INDEX_TO_ABSOLUTE_INDEX(player_index);
if (VALID_INDEX(slot, HALO_PORT_MAXIMUM_NETWORK_PLAYERS))
gun_game.equipped_unit[slot] = NONE;
gun_game_equip(player_index);
}
/* the map's list, in the gametype's order */
static void gun_game_levels_build(
void)
{
short order = game_variant_options_get()->gun_game_order;
short index;
gun_game.level_count = 0;
for (index = 0; index < (short)GUN_GAME_MAXIMUM_LEVELS; index++)
{
byte weapon = gun_game_strongest_first[order == _gun_game_order_weakest_first ?
GUN_GAME_MAXIMUM_LEVELS - 1 - index : index];
if (game_engine_loadout_weapon_definition(weapon) != NONE)
gun_game.levels[gun_game.level_count++] = weapon;
}
/* (the host's draw: only the host gives weapons) */
if (order == _gun_game_order_random && !network_game_distributed_client())
{
for (index = gun_game.level_count - 1; index > 0; index--)
{
short other = (short)local_random_range(0, index + 1);
byte weapon = gun_game.levels[index];
gun_game.levels[index] = gun_game.levels[other];
gun_game.levels[other] = weapon;
}
}
}
static boolean gun_game_initialize_for_new_map(
void)
{
gun_game_levels_build();
csmemset(gun_game.equipped_unit, 0xFF, sizeof(gun_game.equipped_unit));
csmemset(gun_game.equipped_level, 0xFF, sizeof(gun_game.equipped_level));
gun_game.equipping = FALSE;
/* (the game is won with a kill with the last weapon: every machine's
list is as long) */
if (gun_game.level_count)
game_engine_get_variant()->universal_variant.score_to_win = gun_game.level_count;
return gun_game.slayer.initialize_for_new_map ? gun_game.slayer.initialize_for_new_map() : TRUE;
}
static void gun_game_player_update_each_tick(
long player_index)
{
if (gun_game.slayer.player_update_each_tick)
gun_game.slayer.player_update_each_tick(player_index);
gun_game_equip(player_index);
}
/* only the weapons given (and a weapon held, which readying it asks of) */
static boolean gun_game_allow_pick_up(
long unit_index,
long weapon_index)
{
struct unit_datum *unit = unit_try_and_get(unit_index);
short slot;
if (gun_game.equipping)
return TRUE;
for (slot = 0; unit && slot < MAXIMUM_WEAPONS_PER_UNIT; slot++)
{
if (unit->unit.weapon_object_indices[slot] == weapon_index)
return TRUE;
}
return FALSE;
}
static void gun_game_player_killed_player(
long killing_player_index,
long killing_object_index,
long dead_player_index,
boolean friendly_fire)
{
gun_game.slayer.player_killed_player(killing_player_index, killing_object_index, dead_player_index, friendly_fire);
if (network_game_distributed_client() || player_get(dead_player_index)->quit_out_of_game)
return;
/* a melee kill takes the victim back a weapon */
if (game_variant_options_get()->gun_game_melee_demotes && game_modes_killed_by_melee() && !friendly_fire &&
killing_player_index != NONE && killing_player_index != dead_player_index &&
gun_game.slayer.get_player_score(dead_player_index, _get_score_individual) > 0)
{
game_engine_slayer_adjust_score(dead_player_index, -1);
}
/* (a suicide at the first weapon leaves the score at 0) */
if (gun_game.slayer.get_player_score(dead_player_index, _get_score_individual) < 0)
game_engine_slayer_adjust_score(dead_player_index, 1);
}
struct game_engine *gun_game_engine_get(
struct game_engine const *slayer)
{
gun_game.slayer = *slayer;
gun_game.engine = *slayer;
gun_game.engine.initialize_for_new_map = gun_game_initialize_for_new_map;
gun_game.engine.player_update_each_tick = gun_game_player_update_each_tick;
gun_game.engine.allow_pick_up = gun_game_allow_pick_up;
gun_game.engine.player_killed_player = gun_game_player_killed_player;
return &gun_game.engine;
}
+16
View File
@@ -0,0 +1,16 @@
/* gun_game.h: Gun Game, a mode of free for all Slayer (port/linux/game/gun_game.c) */
#ifndef HALO_GUN_GAME_H
#define HALO_GUN_GAME_H
struct game_engine;
/* Slayer's engine with Gun Game's rules (game_modes_engine) */
struct game_engine *gun_game_engine_get(struct game_engine const *slayer);
/* a player spawned: their weapon (game_modes_postspawn) */
void gun_game_postspawn(long player_index);
/* the weapons of the map's list (each machine's alike), and a level's (a
_loadout_weapon_*) */
short gun_game_level_count(void);
byte gun_game_level_weapon(short level);
#endif
+102 -9
View File
@@ -34,6 +34,20 @@ When the texture cannot be drawn, the sprites are drawn from their bitmap.
#include "text/draw_string.h"
#include "hud_button_layout.h"
#include "scenario/scenario_definitions.h"
#include "cache/texture_cache.h"
#ifdef HALO_ANDROID
#include "android_ce_texture_cache.h"
#endif
static boolean hud_hires_bitmap_resident(struct bitmap_data const *bitmap)
{
#ifdef HALO_ANDROID
/* CE heap pixels have no Xbox LRU block. Query without touching their age. */
if (android_ce_texture_resident(bitmap))
return TRUE;
#endif
return bitmap->cache_block_index != NONE;
}
/* the platform layer's (port/linux/src) */
void platform_log(char const *format, ...);
@@ -48,8 +62,15 @@ unsigned long hud_hires_asset_sprites(long asset);
int hud_hires_sprites_drawable(long asset, unsigned long address, unsigned long level0_size);
void hud_hires_register_placeholder(long asset, unsigned long const *texture);
int hud_hires_asset_custom_edition(long asset);
int hud_hires_asset_ce_only(long asset);
long hud_hires_ce_stock_count_get(void);
long hud_hires_ce_stock_find(char const *tag, long bitmap);
char const *hud_hires_ce_stock_tag(long index);
long hud_hires_ce_stock_bitmap(long index);
int hud_hires_ce_stock_matches(long index, unsigned long address, long width, long height, unsigned long size);
/* (custom_edition_cache.c) */
boolean custom_edition_cache_stock_tag(long tag_index);
boolean custom_edition_cache_tags_loaded(void);
void hud_hires_map_loaded(const long *assets, long count);
void hud_hires_map_unloaded(void);
@@ -58,6 +79,8 @@ void hud_hires_tags_unloaded(void);
long hud_hires_asset_at(unsigned long address, long width, long height);
struct bitmap_data const *hud_hires_sprite_bitmap(struct bitmap_data const *bitmap, short sequence_index);
#include "custom_edition_hud_buttons.h"
/* ---------- constants */
enum
@@ -72,8 +95,8 @@ static struct
{
struct bitmap_data *bitmap;
long asset;
/* a Custom Edition map's stock bitmap of a layout the texture was made
for, whose pixels are its own: drawn without the pixels' check */
/* A compatible CE resource sheet: checked against CE's pixel signature
in the platform layer, rather than the Xbox signature. */
boolean stock_custom_edition;
} hires_bitmaps[MAXIMUM_HIRES_BITMAPS];
static long hires_bitmap_count = 0;
@@ -81,6 +104,8 @@ static long hires_bitmap_count = 0;
/* Sheets without redraws: retain their original lettering and sprite layout. */
static struct { struct bitmap_data *bitmap; long kind; } upscale_bitmaps[16];
static long upscale_bitmap_count;
static struct { struct bitmap_data *bitmap; long signature; } ce_stock_bitmaps[128];
static long ce_stock_bitmap_count;
/* the bitmaps some of whose sprites have a texture, with their placeholder,
and whether the texture can be drawn for the pixels at checked_address
@@ -110,6 +135,7 @@ static short hud_buttons_style;
static void hud_buttons_forget(void)
{
long index;
ce_hud_buttons_forget();
for (index = 0; index < 14; index++)
{
if (hud_buttons[index].bitmap)
@@ -154,6 +180,22 @@ void hud_hires_tags_loaded(
hires_bitmap_count = 0;
hud_hires_sprite_bitmaps_forget();
upscale_bitmap_count = 0;
ce_stock_bitmap_count = 0;
if (custom_edition_cache_tags_loaded())
{
long index;
for (index = 0; index < hud_hires_ce_stock_count_get() && ce_stock_bitmap_count < NUMBEROF(ce_stock_bitmaps); index++)
{
long group = tag_loaded(BITMAP_GROUP_TAG, hud_hires_ce_stock_tag(index));
struct bitmap_data *bitmap = group == NONE ? NULL :
bitmap_group_try_and_get_bitmap(group, (short)hud_hires_ce_stock_bitmap(index));
if (bitmap && custom_edition_cache_stock_tag(group))
{
ce_stock_bitmaps[ce_stock_bitmap_count].bitmap = bitmap;
ce_stock_bitmaps[ce_stock_bitmap_count++].signature = index;
}
}
}
{
static struct { char const *tag; short first, last; } const sheets[] = {
{ "ui\\hud\\bitmaps\\combined\\hud_unit_backgrounds", 8, 12 },
@@ -168,7 +210,8 @@ void hud_hires_tags_loaded(
{
long group = tag_loaded(BITMAP_GROUP_TAG, sheets[sheet].tag);
if (group == NONE)
/* CE's custom sheets must not enter the Xbox-only upscaler. */
if (group == NONE || custom_edition_cache_tags_loaded())
continue;
for (index = sheets[sheet].first; index <= sheets[sheet].last; index++)
{
@@ -189,6 +232,14 @@ void hud_hires_tags_loaded(
struct bitmap_data *bitmap = group_index == NONE ? NULL :
bitmap_group_try_and_get_bitmap(group_index, (short)hud_hires_asset_bitmap(asset));
/* Only the verified compatible resource sheets have CE redraws.
Embedded custom art keeps its own pixels, even under a stock name. */
if (custom_edition_cache_tags_loaded() &&
(!hud_hires_asset_custom_edition(asset) || !custom_edition_cache_stock_tag(group_index)))
continue;
if (!custom_edition_cache_tags_loaded() && hud_hires_asset_ce_only(asset))
continue;
if (!bitmap)
{
/* (the main menu's map has only some of the HUD) */
@@ -243,6 +294,7 @@ void hud_hires_tags_unloaded(
{
hires_bitmap_count = 0;
upscale_bitmap_count = 0;
ce_stock_bitmap_count = 0;
hud_hires_sprite_bitmaps_forget();
hud_hires_map_unloaded();
@@ -267,7 +319,7 @@ struct bitmap_data const *hud_hires_sprite_bitmap(
continue;
}
/* (checked on its pixels in the texture cache, once they are loaded) */
if (sprite_bitmap->cache_block_index == NONE || !sprite_bitmap->base_address)
if (!hud_hires_bitmap_resident(sprite_bitmap) || !sprite_bitmap->base_address)
break;
if (hires_sprite_bitmaps[index].checked_address != sprite_bitmap->base_address ||
hires_sprite_bitmaps[index].checked_at != config_changes())
@@ -330,7 +382,7 @@ long hud_hires_asset_stock_custom_edition(
{
struct bitmap_data *bitmap = hires_bitmaps[index].bitmap;
if (hires_bitmaps[index].asset == asset && bitmap->cache_block_index != NONE &&
if (hires_bitmaps[index].asset == asset && hud_hires_bitmap_resident(bitmap) &&
(unsigned long)bitmap->base_address == address && bitmap->width == width && bitmap->height == height)
{
return hires_bitmaps[index].stock_custom_edition;
@@ -351,7 +403,7 @@ long hud_hires_asset_at(
{
struct bitmap_data *bitmap = hires_bitmaps[index].bitmap;
if (bitmap->cache_block_index != NONE &&
if (hud_hires_bitmap_resident(bitmap) &&
(unsigned long)bitmap->base_address == address &&
bitmap->width == width &&
bitmap->height == height)
@@ -367,20 +419,56 @@ long hud_hires_upscale_at(unsigned long address, long width, long height)
{
long index;
for (index = 0; index < ce_stock_bitmap_count; index++)
{
struct bitmap_data const *bitmap = ce_stock_bitmaps[index].bitmap;
if (hud_hires_bitmap_resident(bitmap) && (unsigned long)bitmap->base_address == address &&
bitmap->width == width && bitmap->height == height &&
hud_hires_ce_stock_matches(ce_stock_bitmaps[index].signature, address, width, height,
(unsigned long)bitmap_mipmap_get_pixel_data_size(bitmap, 0)))
return 4;
}
for (index = 0; index < upscale_bitmap_count; index++)
{
struct bitmap_data const *bitmap = upscale_bitmaps[index].bitmap;
if (bitmap->cache_block_index != NONE && (unsigned long)bitmap->base_address == address &&
if (hud_hires_bitmap_resident(bitmap) && (unsigned long)bitmap->base_address == address &&
bitmap->width == width && bitmap->height == height)
return upscale_bitmaps[index].kind;
}
return FALSE;
}
static boolean ce_hud_buttons_stock(struct icon_hud_element_definition const *icon, long button)
{
/* CE keeps these Xbox controller definitions even when its messaging
sheet contains only weapon pictures. Identify the controller entry, not
the sheet: weapon icons are separate records and keep their own art. */
static const short stock[18][7] = {
{0,-6,-2,-5,0,2,0}, {1,-6,-2,-5,0,2,0},
{2,-6,-2,-5,0,2,0}, {3,-6,-2,-5,0,2,0},
{13,-6,-2,-5,0,2,1}, {13,-6,-2,-5,0,2,2},
{21,-6,-2,-5,0,0,3}, {22,-6,-2,-5,0,0,4},
{0,0,0,0,0,1,5}, {0,0,0,0,0,1,6},
{0,0,0,0,0,1,7}, {0,0,0,0,0,1,8},
{18,-6,-2,-5,0,0,9}, {17,-6,-2,-5,0,0,10},
{19,28,-2,-5,10,4,11}, {20,28,-2,-5,10,4,12},
{15,-6,-2,-5,0,0,11}, {16,-6,-2,-5,0,0,12}
};
if (!custom_edition_cache_tags_loaded()) return TRUE;
if (button < 0 || button >= NUMBEROF(stock) ||
icon->sequence_index != stock[button][0] || icon->width_offset != stock[button][1] ||
icon->offset.x != stock[button][2] || icon->offset.y != stock[button][3] ||
icon->frame_rate != stock[button][4] || icon->flags != stock[button][5] ||
icon->text_index != stock[button][6]) return FALSE;
return TRUE;
}
/* Match the controller entry itself: weapon icons may reuse its sequence.
* Draw the existing Xbox menu faces with straight alpha, independently of
* the messaging sheet and its tint. Disabling the HUD keeps the map's art. */
* the messaging sheet and its tint. CE custom sheets also need this fallback
* with High-Res HUD off: their stock button entries can name weapon art. */
boolean hud_hires_button_draw(struct icon_hud_element_definition const *icon,
rectangle2d *cursor, pixel32 color)
{
@@ -406,7 +494,9 @@ boolean hud_hires_button_draw(struct icon_hud_element_definition const *icon,
short i;
short style, slot;
if (!config_boolean("display.high_res_hud") || !hud_globals)
if (!hud_globals || (!config_boolean("display.high_res_hud") &&
(!custom_edition_cache_tags_loaded() ||
custom_edition_cache_stock_tag(hud_globals->messaging.messaging_icons.index))))
return FALSE;
buttons = hud_globals->messaging.button_icons.address;
if (!buttons) return FALSE;
@@ -414,6 +504,9 @@ boolean hud_hires_button_draw(struct icon_hud_element_definition const *icon,
if (icon == buttons + index) break;
if (index >= 18 || index >= hud_globals->messaging.button_icons.count)
return FALSE;
if (!ce_hud_buttons_stock(icon, index)) return FALSE;
if (!config_boolean("display.high_res_hud"))
return ce_hud_button_draw(icon, cursor, color);
slot = index < 6 ? (short)index : hud_button_control_slot((short)index,
icon->frame_rate > 0 ? game_time_get() / icon->frame_rate : 0);
if (slot < 0) return FALSE;
+972
View File
@@ -0,0 +1,972 @@
/*
INFECTION.C
Infection, a mode of team Slayer (game_modes.c). Humans are red and keep the
gametype's equipment; zombies are blue, carry the Oddball skull and nothing
else, and fight on foot, faster than humans, their skull's melee stronger.
The round waits for two living players, counts down, and then the host
chooses the first zombies (leaving at least one human). A human killed by a
zombie, by themselves or by the world becomes a zombie (one killed by a
teammate does not); a zombie respawns a zombie, and a player who joins late
joins the zombies. The zombies win when no human is left, the humans when the
round's time runs out. Each player scores a kill of the other side.
Only the host decides: it chooses the zombies, turns the dead, gives the
skulls and ends the round, and sends every client its state
(struct distributed_infection_state, with the game type's:
game_engine_write_network_state), which a client checks whole before taking.
Each machine then sets each player's team, speed and shields by their role.
Its options are the gametype's (game_engine.h's struct game_variant_options,
infection_*). The rules and much of the code follow the Infection of pull
request #420 by arisson2001rojas-design.
*/
#include "cseries.h"
#include "game/game.h"
#include "game/game_engine.h"
#include "game/players.h"
#include "math/real_math.h"
#include "memory/data.h"
#include "networking/network_game_globals.h"
#include "networking/network_game_manager.h"
#include "networking/network_server_manager.h"
#include "objects/objects.h"
#include "objects/object_definitions.h"
#include "physics/collisions.h"
#include "text/unicode.h"
#include "units/units.h"
#include "units/unit_definitions.h"
#include "game_modes.h"
#include "infection.h"
#include "network_infection.h"
void platform_log(char const *format, ...);
/* a score past this is not a client's to take */
#define INFECTION_MAXIMUM_SCORE 1000000
static struct
{
struct game_engine engine;
struct game_engine slayer;
struct distributed_infection_state state;
/* the host's, by absolute player index: the player of the slot, the unit
given its role's equipment, the unit counted dead, the skull given, and
the unit whose shields a zombie's role took (and their maximum) */
long participant[HALO_PORT_MAXIMUM_NETWORK_PLAYERS];
long equipped_unit[HALO_PORT_MAXIMUM_NETWORK_PLAYERS];
long killed_unit[HALO_PORT_MAXIMUM_NETWORK_PLAYERS];
long skull[HALO_PORT_MAXIMUM_NETWORK_PLAYERS];
long shield_unit[HALO_PORT_MAXIMUM_NETWORK_PLAYERS];
real shield_maximum[HALO_PORT_MAXIMUM_NETWORK_PLAYERS];
/* a skull being given (the pickup checks allow it) */
boolean equipping;
/* the map has no skull, or one could not be given: the round ends */
boolean missing_skull;
} infection;
/* ---- the players' roles */
boolean infection_enabled(
void)
{
return game_modes_mode() == _game_mode_infection;
}
/* a player's identity on every machine: their name and place in the game */
static unsigned long infection_player_identity(
long player_index)
{
struct network_player const *network_player = &player_get(player_index)->network_player_data;
unsigned long hash = 2166136261UL;
short index;
for (index = 0; index < NUMBEROF(network_player->name); index++)
hash = (hash ^ (word)network_player->name[index]) * 16777619UL;
hash = (hash ^ (byte)network_player->machine_index) * 16777619UL;
hash = (hash ^ (byte)network_player->controller_index) * 16777619UL;
hash = (hash ^ (byte)network_player->player_list_index) * 16777619UL;
return hash ? hash : 1;
}
/* a player's role, if the state has it for them (not one who left, whose
slot another took) */
static struct distributed_infection_player *infection_player(
long player_index)
{
long slot = DATUM_INDEX_TO_ABSOLUTE_INDEX(player_index);
if (player_index == NONE || !VALID_INDEX(slot, HALO_PORT_MAXIMUM_NETWORK_PLAYERS) ||
!player_try_and_get(player_index) ||
infection.state.players[slot].identity != infection_player_identity(player_index))
{
return NULL;
}
return &infection.state.players[slot];
}
static boolean infection_weapon_is_skull(
long weapon_index)
{
struct object_datum *object = object_try_and_get_and_verify_type(weapon_index, _object_mask_weapon);
return object && object->definition_index == get_ball_definition_index();
}
boolean infection_can_delete_skull(
long object_index)
{
return infection_enabled() && infection_weapon_is_skull(object_index);
}
boolean infection_unit_is_zombie(
long unit_index)
{
struct unit_datum *unit;
struct distributed_infection_player *role;
if (unit_index == NONE || !infection_enabled() || (unit = unit_try_and_get(unit_index)) == NULL)
return FALSE;
role = infection_player(unit->unit.player_index);
return role && role->role == _distributed_infection_role_zombie;
}
/* asked of a player's own drops only: a death, and the inventories the host
sends, still take a skull away */
boolean infection_allow_weapon_drop(
long unit_index,
long weapon_index)
{
struct unit_datum *unit;
struct player_datum *player;
if (!infection_enabled() || infection.state.phase != _distributed_infection_active || infection.equipping ||
!infection_unit_is_zombie(unit_index))
{
return TRUE;
}
unit = unit_get(unit_index);
player = player_try_and_get(unit->unit.player_index);
if (!player || player->quit_out_of_game || player->unit_index != unit_index ||
TEST_FLAG(unit->object.damage_flags, _object_dead_bit))
{
return TRUE;
}
return !infection_weapon_is_skull(weapon_index);
}
/* a zombie's skull in the hand */
static boolean infection_unit_holds_skull(
long unit_index)
{
struct unit_datum *unit = unit_get(unit_index);
return VALID_INDEX(unit->unit.current_weapon_index, MAXIMUM_WEAPONS_PER_UNIT) &&
infection_weapon_is_skull(unit->unit.weapon_object_indices[unit->unit.current_weapon_index]);
}
real infection_melee_multiplier(
long unit_index)
{
if (!infection_unit_is_zombie(unit_index) || infection.state.phase != _distributed_infection_active ||
!infection_unit_holds_skull(unit_index))
{
return 1.0f;
}
return game_variant_options_get()->infection_skull_damage / 100.0f;
}
/* a living human in a seat of a vehicle that is not hidden, whom a zombie
holding its skull struck itself (not the vehicle: Slayer's melee hits the
vehicle a rider is in) */
boolean infection_melee_rider_target(
long attacker_index,
long target_index)
{
struct unit_datum *target;
struct unit_datum *vehicle;
struct distributed_infection_player *role;
struct unit_definition *definition;
short seat;
if (!infection_unit_is_zombie(attacker_index) || infection.state.phase != _distributed_infection_active ||
!infection_unit_holds_skull(attacker_index))
{
return FALSE;
}
target = unit_try_and_get(target_index);
if (!target || target->object.type != _object_type_biped || TEST_FLAG(target->object.damage_flags, _object_dead_bit))
return FALSE;
role = infection_player(target->unit.player_index);
if (!role || role->role != _distributed_infection_role_human)
return FALSE;
vehicle = (struct unit_datum *)object_try_and_get_and_verify_type(target->object.parent_object_index,
_object_mask_vehicle);
if (!vehicle)
return FALSE;
definition = unit_definition_get(vehicle->definition_index);
seat = target->unit.parent_seat_index;
return VALID_INDEX(seat, definition->unit.seats.count) &&
!TEST_FLAG(TAG_BLOCK_GET_ELEMENT(&definition->unit.seats, seat, struct unit_seat)->flags,
_unit_seat_invisible_bit);
}
/* the host's check of a client's melee report on a rider: one of its own
lines through the melee's cone (0.8 world units from the attacker's head,
as the game's melee) reaches the rider, through the host's own world, not
from a place the client says */
boolean infection_melee_rider_visible(
long attacker_index,
long target_index,
real_vector3d const *direction)
{
struct object_marker head;
real_vector3d facing = *direction;
real_vector3d perpendicular;
real_vector3d cross;
real_vector3d ray;
struct collision_result hit;
long outer;
long inner;
if (!infection_melee_rider_target(attacker_index, target_index) || normalize3d(&facing) <= 0.0f)
return FALSE;
object_get_marker_by_name(attacker_index, "head", &head, 1);
normalize3d(perpendicular3d(&facing, &perpendicular));
cross_product3d(&facing, &perpendicular, &cross);
for (outer = -2; outer <= 2; outer++)
{
for (inner = -2; inner <= 2; inner++)
{
ray.i = facing.i * 0.8f + (cross.i * inner + perpendicular.i * outer) * 0.1f;
ray.j = facing.j * 0.8f + (cross.j * inner + perpendicular.j * outer) * 0.1f;
ray.k = facing.k * 0.8f + (cross.k * inner + perpendicular.k * outer) * 0.1f;
if (collision_test_vector(_collision_test_for_projectiles_flags, &head.matrix.position, &ray,
attacker_index, &hit) && hit.type == _collision_result_object && hit.object_index == target_index)
{
return TRUE;
}
}
}
return FALSE;
}
/* ---- the host's round */
static void infection_finish(
long winner)
{
if (infection.state.phase == _distributed_infection_finished)
return;
infection.state.winner = winner;
infection.state.phase = _distributed_infection_finished;
infection.state.revision++;
platform_log("infection: finished, winner %ld", winner);
game_engine_end_game();
}
/* a unit's armour in its team's colour (a human turned while alive), as a
spawn colours it; the colour channels a function drives (the shield's glow)
are left to it */
static void infection_color_unit(
struct unit_datum *unit,
long player_index)
{
struct object_definition *definition = object_definition_get(unit->definition_index);
real_rgb_color color;
short channel;
game_engine_player_get_change_color(&color, player_index);
for (channel = 0; channel < NUMBER_OF_OBJECT_CHANGE_COLORS; channel++)
{
unit->object.base_change_colors[channel] = color;
if (channel < definition->object.change_colors.count)
{
struct object_change_color_definition *change_color = TAG_BLOCK_GET_ELEMENT(
&definition->object.change_colors, channel, struct object_change_color_definition);
if (change_color->scaled_by || change_color->darken_by)
continue;
}
unit->object.outgoing_change_colors[channel] = color;
}
}
/* a zombie without shields (the gametype's infection_zombie_shields): a
shield capacity of 0, the game's own unshielded unit, which neither takes
shield damage nor recharges; a human again (or the option on) gets the
unit's capacity back, without healing its body */
static void infection_apply_shields(
long slot,
long unit_index,
struct unit_datum *unit,
boolean disabled)
{
if (infection.shield_unit[slot] != unit_index)
infection.shield_unit[slot] = NONE;
if (disabled)
{
if (infection.shield_unit[slot] == NONE)
{
infection.shield_unit[slot] = unit_index;
infection.shield_maximum[slot] = unit->object.maximum_shield_vitality;
}
unit->object.maximum_shield_vitality = 0.0f;
unit->object.shield_vitality = 0.0f;
SET_FLAG(unit->object.damage_flags, _object_shield_charging_bit, FALSE);
SET_FLAG(unit->object.damage_flags, _object_shield_over_charging_bit, FALSE);
SET_FLAG(unit->object.damage_flags, _object_shield_depleted_bit, TRUE);
}
else if (infection.shield_unit[slot] == unit_index)
{
unit->object.maximum_shield_vitality = infection.shield_maximum[slot];
infection.shield_unit[slot] = NONE;
}
}
void infection_reconcile_player(
long player_index)
{
struct game_variant_options const *options = game_variant_options_get();
struct distributed_infection_player *role;
struct player_datum *player;
struct unit_datum *unit;
long team;
if (!infection_enabled() || (role = infection_player(player_index)) == NULL ||
role->role == _distributed_infection_role_none)
{
return;
}
player = player_get(player_index);
team = role->role == _distributed_infection_role_zombie ? 1 : 0;
player->team_index = team;
player->network_player_data.team_index = (char)team;
player->speed_multiplier = team ? options->infection_zombie_speed / 100.0f : 1.0f;
if (player->unit_index != NONE && (unit = unit_try_and_get(player->unit_index)) != NULL)
{
infection_apply_shields(DATUM_INDEX_TO_ABSOLUTE_INDEX(player_index), player->unit_index, unit,
team && !options->infection_zombie_shields);
unit->object.owner_team_index = (short)team;
infection_color_unit(unit, player_index);
/* (a living zombie's grenades and powerups gone; a dead one's are its
body's, which drops them) */
if (team && !TEST_FLAG(unit->object.damage_flags, _object_dead_bit))
{
/* (a grenade being wound up when its thrower turned is not thrown:
the throw would find no grenade left) */
if (unit->unit.grenade_throw_state == _unit_grenade_throw_wind_up)
unit->unit.grenade_throw_state = _unit_grenade_throw_ending;
csmemset(unit->unit.grenade_counts, 0, sizeof(unit->unit.grenade_counts));
csmemset(player->powerup_durations, 0, sizeof(player->powerup_durations));
}
}
/* (and the host's game record, which the lobby and late joins read) */
if (!network_game_distributed_client())
{
struct network_game_server *server = global_network_game_server_get();
struct network_game *game = server ? network_game_server_get_game(server) : NULL;
long list_index = player->network_player_data.player_list_index;
if (game && VALID_INDEX(list_index, HALO_PORT_MAXIMUM_NETWORK_PLAYERS))
game->players[list_index].team_index = (char)team;
}
}
static void infection_delete_weapon(
long weapon_index)
{
long slot;
for (slot = 0; slot < HALO_PORT_MAXIMUM_NETWORK_PLAYERS; slot++)
{
if (infection.skull[slot] == weapon_index)
infection.skull[slot] = NONE;
}
if (weapon_index != NONE && object_try_and_get(weapon_index))
object_delete(weapon_index);
}
static void infection_delete_skull(
long slot)
{
infection_delete_weapon(infection.skull[slot]);
infection.skull[slot] = NONE;
}
/* a unit's weapons gone but the one kept (skulls only: a human's skull
picked up), each deleted once */
static void infection_strip_weapons(
long unit_index,
long keep,
boolean skulls_only)
{
struct unit_datum *unit = unit_get(unit_index);
long removed[MAXIMUM_WEAPONS_PER_UNIT];
long count = 0;
long slot;
long previous;
long kept = NONE;
for (slot = 0; slot < MAXIMUM_WEAPONS_PER_UNIT; slot++)
{
long weapon_index = unit->unit.weapon_object_indices[slot];
if (weapon_index == NONE)
continue;
if (weapon_index == keep && kept == NONE)
{
kept = slot;
continue;
}
if (skulls_only && !infection_weapon_is_skull(weapon_index))
continue;
unit->unit.weapon_object_indices[slot] = NONE;
if (unit->unit.current_weapon_index == slot)
unit->unit.current_weapon_index = NONE;
if (unit->unit.desired_weapon_index == slot)
unit->unit.desired_weapon_index = NONE;
if (weapon_index == keep)
continue;
for (previous = 0; previous < count && removed[previous] != weapon_index; previous++)
{
}
if (previous == count)
removed[count++] = weapon_index;
}
for (slot = 0; slot < count; slot++)
infection_delete_weapon(removed[slot]);
if (kept != NONE)
unit->unit.desired_weapon_index = (short)kept;
else if (unit->unit.desired_weapon_index == NONE)
unit->unit.desired_weapon_index = unit_inventory_next_weapon(unit_index, NONE, 0);
}
/* the host gives a living player their role's equipment: a zombie its skull
alone (out of any vehicle, without grenades or powerups), a human what they
spawned with, without a skull */
static void infection_equip(
long player_index)
{
struct player_datum *player = player_get(player_index);
long slot = DATUM_INDEX_TO_ABSOLUTE_INDEX(player_index);
struct distributed_infection_player *role = infection_player(player_index);
struct unit_datum *unit;
long weapon_index;
short inventory_slot;
if (network_game_distributed_client() || !role || player->quit_out_of_game || player->unit_index == NONE ||
infection.missing_skull)
{
return;
}
unit = unit_get(player->unit_index);
if (TEST_FLAG(unit->object.damage_flags, _object_dead_bit))
return;
if (infection.equipped_unit[slot] == player->unit_index)
{
if (role->role == _distributed_infection_role_human)
{
infection_strip_weapons(player->unit_index, NONE, TRUE);
return;
}
/* (a zombie still holding its skull keeps it; any other weapon goes) */
for (inventory_slot = 0; inventory_slot < MAXIMUM_WEAPONS_PER_UNIT; inventory_slot++)
{
weapon_index = unit->unit.weapon_object_indices[inventory_slot];
if (infection_weapon_is_skull(weapon_index))
{
if (infection.skull[slot] != weapon_index)
infection_delete_skull(slot);
infection.skull[slot] = weapon_index;
infection_strip_weapons(player->unit_index, weapon_index, FALSE);
return;
}
}
}
infection.equipping = TRUE;
infection_strip_weapons(player->unit_index, NONE, role->role == _distributed_infection_role_human);
infection_delete_skull(slot);
if (role->role == _distributed_infection_role_zombie)
{
if (unit->object.parent_object_index != NONE)
unit_exit_seat_end(player->unit_index);
csmemset(unit->unit.grenade_counts, 0, sizeof(unit->unit.grenade_counts));
if (unit->unit.equipment_object_index != NONE)
{
object_delete(unit->unit.equipment_object_index);
unit->unit.equipment_object_index = NONE;
}
weapon_index = NONE;
if (get_ball_definition_index() != NONE)
{
struct object_placement_data placement;
object_placement_data_new(&placement, get_ball_definition_index(), NONE);
placement.owner_team_index = 1;
weapon_index = object_new(&placement);
}
if (weapon_index == NONE || !unit_add_weapon_to_inventory(player->unit_index, weapon_index, 2))
{
if (weapon_index != NONE)
object_delete(weapon_index);
infection.missing_skull = TRUE;
}
else
{
infection.skull[slot] = weapon_index;
}
}
infection.equipping = FALSE;
infection.equipped_unit[slot] = player->unit_index;
infection.killed_unit[slot] = NONE;
}
/* a player new to the round: a human before the zombies are chosen, a
zombie after */
static void infection_player_added(
long player_index)
{
long slot = DATUM_INDEX_TO_ABSOLUTE_INDEX(player_index);
struct distributed_infection_player *role;
if (infection.slayer.player_added)
infection.slayer.player_added(player_index);
if (!VALID_INDEX(slot, HALO_PORT_MAXIMUM_NETWORK_PLAYERS))
return;
role = &infection.state.players[slot];
if (!network_game_distributed_client())
{
infection_delete_skull(slot);
csmemset(role, 0, sizeof(*role));
role->identity = infection_player_identity(player_index);
role->role = infection.state.phase >= _distributed_infection_active ? _distributed_infection_role_zombie :
_distributed_infection_role_human;
infection.participant[slot] = player_index;
infection.equipped_unit[slot] = NONE;
infection.killed_unit[slot] = NONE;
infection.state.revision++;
}
infection_reconcile_player(player_index);
}
void infection_postspawn(
long player_index)
{
long slot = DATUM_INDEX_TO_ABSOLUTE_INDEX(player_index);
if (!VALID_INDEX(slot, HALO_PORT_MAXIMUM_NETWORK_PLAYERS))
return;
if (!network_game_distributed_client() && infection.participant[slot] != player_index)
infection_player_added(player_index);
infection_reconcile_player(player_index);
infection.equipped_unit[slot] = NONE;
infection_equip(player_index);
}
static void infection_player_killed_player(
long killing_player_index,
long killing_object_index,
long dead_player_index,
boolean friendly_fire)
{
struct distributed_infection_player *dead = infection_player(dead_player_index);
struct distributed_infection_player *killer = infection_player(killing_player_index);
struct player_datum *player = player_get(dead_player_index);
long slot = DATUM_INDEX_TO_ABSOLUTE_INDEX(dead_player_index);
long unit_index = player->unit_index != NONE ? player->unit_index : player->dead_unit_index;
(void)killing_object_index;
if (network_game_distributed_client() || infection.state.phase != _distributed_infection_active || !dead ||
player->quit_out_of_game || infection.killed_unit[slot] != NONE)
{
return;
}
infection.killed_unit[slot] = unit_index == NONE ? 0 : unit_index;
if (killer && killer != dead && killer->role != dead->role && killer->score < INFECTION_MAXIMUM_SCORE)
killer->score++;
/* (a human killed by a zombie, themselves or the world turns; one killed
by a human teammate does not) */
if (dead->role == _distributed_infection_role_human &&
!(friendly_fire && killer && killer != dead && killer->role == dead->role))
{
dead->role = _distributed_infection_role_zombie;
platform_log("infection: player %ld infected", slot);
}
infection_reconcile_player(dead_player_index);
/* (the body's skull is deleted on the player's next tick, once the
unit's death has dropped what it held) */
infection.equipped_unit[slot] = NONE;
infection.state.revision++;
}
/* the round's result: 0 the humans won, 1 the zombies, 2 no one (everyone
left), NONE still on. Turning the last human wins over the time running
out on the same tick. */
static long infection_round_result(
long humans,
long zombies,
long elapsed,
long limit)
{
if (!humans && !zombies)
return 2;
if (!humans)
return 1;
if (!zombies || (limit > 0 && elapsed >= limit))
return 0;
return NONE;
}
static long infection_time_limit_ticks(
void)
{
return game_variant_options_get()->time_limit * 60L * TICKS_PER_SECOND;
}
static void infection_update(
void)
{
struct game_variant_options const *options = game_variant_options_get();
struct data_iterator iterator;
struct player_datum *player;
boolean present[HALO_PORT_MAXIMUM_NETWORK_PLAYERS];
long candidates[HALO_PORT_MAXIMUM_NETWORK_PLAYERS];
long humans = 0;
long zombies = 0;
long count = 0;
long index;
long now = game_time_get();
if (infection.slayer.update)
infection.slayer.update();
if (network_game_distributed_client() || infection.state.phase == _distributed_infection_finished)
return;
csmemset(present, 0, sizeof(present));
data_iterator_new(&iterator, player_data);
while ((player = (struct player_datum *)data_iterator_next(&iterator)) != NULL)
{
long slot = DATUM_INDEX_TO_ABSOLUTE_INDEX(iterator.datum_index);
struct unit_datum *unit;
if (player->quit_out_of_game || !VALID_INDEX(slot, HALO_PORT_MAXIMUM_NETWORK_PLAYERS))
continue;
present[slot] = TRUE;
if (infection.participant[slot] != iterator.datum_index)
infection_player_added(iterator.datum_index);
infection_reconcile_player(iterator.datum_index);
if (infection.state.players[slot].role == _distributed_infection_role_human)
humans++;
else
zombies++;
/* (the first zombies are chosen of the living: a full map can leave
players waiting to spawn) */
unit = player->unit_index != NONE ? unit_try_and_get(player->unit_index) : NULL;
if (unit && !TEST_FLAG(unit->object.damage_flags, _object_dead_bit))
candidates[count++] = iterator.datum_index;
}
for (index = 0; index < HALO_PORT_MAXIMUM_NETWORK_PLAYERS; index++)
{
if (!present[index] && infection.participant[index] != NONE)
{
infection_delete_skull(index);
infection.participant[index] = NONE;
infection.equipped_unit[index] = NONE;
infection.killed_unit[index] = NONE;
csmemset(&infection.state.players[index], 0, sizeof(infection.state.players[index]));
infection.state.revision++;
}
}
if (infection.missing_skull)
{
platform_log("infection: no skull to give (the map has no Oddball ball), the round ends");
infection_finish(NONE);
return;
}
if (infection.state.phase == _distributed_infection_active)
{
long result = infection_round_result(humans, zombies, now - infection.state.phase_tick,
infection_time_limit_ticks());
if (result != NONE)
{
platform_log("infection: result %ld, %ld humans, %ld zombies", result, humans, zombies);
infection_finish(result == 2 ? NONE : result);
}
return;
}
if (count < 2)
{
if (infection.state.phase != _distributed_infection_waiting)
infection.state.revision++;
infection.state.phase = _distributed_infection_waiting;
infection.state.phase_tick = now;
return;
}
if (infection.state.phase == _distributed_infection_waiting)
{
infection.state.phase = _distributed_infection_countdown;
infection.state.phase_tick = now;
infection.state.revision++;
platform_log("infection: countdown, %ld players", count);
}
if (now - infection.state.phase_tick < options->infection_countdown * TICKS_PER_SECOND)
return;
infection.state.phase = _distributed_infection_active;
infection.state.phase_tick = now;
/* the first zombies, drawn without repeats, leaving a human */
for (index = 0; index < MIN(count - 1, options->infection_initial_zombies); index++)
{
long pick = index + local_random_range(0, (short)(count - index));
long chosen = candidates[pick];
long slot = DATUM_INDEX_TO_ABSOLUTE_INDEX(chosen);
candidates[pick] = candidates[index];
candidates[index] = chosen;
infection.state.players[slot].role = _distributed_infection_role_zombie;
infection.equipped_unit[slot] = NONE;
infection_reconcile_player(chosen);
infection_equip(chosen);
}
infection.state.revision++;
platform_log("infection: active, %ld players, %ld zombies", count,
MIN(count - 1, (long)options->infection_initial_zombies));
}
long infection_remaining_ticks(
void)
{
long limit = infection_time_limit_ticks();
return infection.state.phase == _distributed_infection_active ?
MAX(0, limit - (game_time_get() - infection.state.phase_tick)) : limit;
}
static boolean infection_initialize_for_new_map(
void)
{
struct game_variant *variant = game_engine_get_variant();
csmemset(&infection.state, 0, sizeof(infection.state));
csmemset(infection.participant, 0xFF, sizeof(infection.participant));
csmemset(infection.equipped_unit, 0xFF, sizeof(infection.equipped_unit));
csmemset(infection.killed_unit, 0xFF, sizeof(infection.killed_unit));
csmemset(infection.skull, 0xFF, sizeof(infection.skull));
csmemset(infection.shield_unit, 0xFF, sizeof(infection.shield_unit));
infection.state.winner = NONE;
infection.state.game_number = network_game_get_game() ? network_game_get_number_of_games_played() : 0;
infection.missing_skull = get_ball_definition_index() == NONE;
infection.equipping = FALSE;
/* (everyone respawns; the variant's traits give zombies no infinite
grenades nor camouflage) */
variant->universal_variant.lives = 0;
variant->universal_variant.odd_man_out = FALSE;
SET_FLAG(variant->universal_variant.flags, _game_variant_infinite_grenades_bit, FALSE);
SET_FLAG(variant->universal_variant.flags, _game_variant_always_invisible_bit, FALSE);
return infection.slayer.initialize_for_new_map ? infection.slayer.initialize_for_new_map() : TRUE;
}
/* a skull is picked up only as it is given; a zombie picks up nothing else
(and readying the skull it holds asks this too) */
static boolean infection_allow_pick_up(
long unit_index,
long weapon_index)
{
short slot;
if (infection.equipping)
return TRUE;
if (infection_weapon_is_skull(weapon_index))
{
if (infection_unit_is_zombie(unit_index))
{
for (slot = 0; slot < MAXIMUM_WEAPONS_PER_UNIT; slot++)
{
if (unit_get(unit_index)->unit.weapon_object_indices[slot] == weapon_index)
return TRUE;
}
}
return FALSE;
}
return !infection_unit_is_zombie(unit_index);
}
static boolean infection_picking_up(
long weapon_index,
long player_index)
{
(void)weapon_index;
(void)player_index;
return infection.equipping;
}
/* a skull dropped (its zombie killed, or forced out of a hand): given again
on the next tick, if its zombie lives */
static void infection_weapon_dropped(
long weapon_index)
{
long slot;
if (network_game_distributed_client() || infection.equipping)
return;
for (slot = 0; slot < HALO_PORT_MAXIMUM_NETWORK_PLAYERS; slot++)
{
if (infection.skull[slot] == weapon_index)
{
infection.equipped_unit[slot] = NONE;
break;
}
}
}
static void infection_player_update_each_tick(
long player_index)
{
struct player_datum *player = player_get(player_index);
infection_reconcile_player(player_index);
if (network_game_distributed_client())
return;
/* (a dead zombie's skull deleted once its unit's death has dropped it) */
if (player->quit_out_of_game || player->unit_index == NONE ||
TEST_FLAG(unit_get(player->unit_index)->object.damage_flags, _object_dead_bit))
{
infection_delete_skull(DATUM_INDEX_TO_ABSOLUTE_INDEX(player_index));
}
else
{
infection_equip(player_index);
}
}
static long infection_get_player_score(
long player_index,
enum get_score_type score_type)
{
struct distributed_infection_player *role = infection_player(player_index);
long slot;
long score = 0;
if (!role)
return 0;
if (score_type != _get_score_team)
return role->score;
for (slot = 0; slot < HALO_PORT_MAXIMUM_NETWORK_PLAYERS; slot++)
{
if (infection.state.players[slot].role == role->role)
score += infection.state.players[slot].score;
}
return score;
}
static wchar_t *infection_format_player_score(
long player_index,
wchar_t *text)
{
usprintf(text, L"%ld", infection_get_player_score(player_index, _get_score_individual));
return text;
}
/* (a team's score, whatever its name says) */
static wchar_t *infection_format_team_score(
long team_index,
wchar_t *text)
{
usprintf(text, L"%ld", game_engine_get_team_score(team_index));
return text;
}
static long infection_did_player_win(
long player_index)
{
struct distributed_infection_player *role = infection_player(player_index);
if (infection.state.winner == NONE || !role)
return NONE;
return (role->role == _distributed_infection_role_zombie ? 1 : 0) == infection.state.winner;
}
struct game_engine *infection_engine_get(
struct game_engine const *slayer)
{
infection.slayer = *slayer;
infection.engine = *slayer;
infection.engine.initialize_for_new_map = infection_initialize_for_new_map;
infection.engine.player_added = infection_player_added;
infection.engine.player_update_each_tick = infection_player_update_each_tick;
infection.engine.prespawn_player_update = infection_reconcile_player;
infection.engine.update = infection_update;
infection.engine.allow_pick_up = infection_allow_pick_up;
infection.engine.picking_up = infection_picking_up;
infection.engine.weapon_dropped = infection_weapon_dropped;
infection.engine.player_killed_player = infection_player_killed_player;
infection.engine.get_player_score = infection_get_player_score;
infection.engine.format_player_score = infection_format_player_score;
infection.engine.format_team_name = infection_format_team_score;
infection.engine.format_message = NULL;
infection.engine.did_player_win = infection_did_player_win;
return &infection.engine;
}
/* ---- the state the host sends */
/* a state a client may take: of this game, no older than its own, every
value in range */
static boolean infection_state_valid(
struct distributed_infection_state const *state,
long game_number,
long revision)
{
short index;
if (state->game_number != game_number || state->revision < revision || state->revision < 0 ||
state->phase < _distributed_infection_waiting || state->phase > _distributed_infection_finished ||
state->phase_tick < 0 || state->winner < NONE || state->winner > 1 ||
(state->phase != _distributed_infection_finished && state->winner != NONE))
{
return FALSE;
}
for (index = 0; index < HALO_PORT_MAXIMUM_NETWORK_PLAYERS; index++)
{
struct distributed_infection_player const *player = &state->players[index];
if (player->role > _distributed_infection_role_zombie || player->score < 0 ||
player->score > INFECTION_MAXIMUM_SCORE || (player->role && !player->identity) ||
player->reserved[0] || player->reserved[1] || player->reserved[2])
{
return FALSE;
}
}
return TRUE;
}
long infection_write_network_state(
byte *buffer,
long size)
{
if (size < (long)sizeof(infection.state))
return 0;
csmemcpy(buffer, &infection.state, sizeof(infection.state));
return sizeof(infection.state);
}
boolean infection_read_network_state(
byte const *buffer,
long size,
boolean first)
{
struct distributed_infection_state state;
struct data_iterator iterator;
if (!network_game_distributed_client() || size != (long)sizeof(state))
return FALSE;
csmemcpy(&state, buffer, sizeof(state));
if (!infection_state_valid(&state, network_game_get_number_of_games_played(), first ? 0 : infection.state.revision))
return FALSE;
infection.state = state;
data_iterator_new(&iterator, player_data);
while (data_iterator_next(&iterator))
infection_reconcile_player(iterator.datum_index);
return TRUE;
}
+39
View File
@@ -0,0 +1,39 @@
/* infection.h: Infection, a mode of team Slayer (port/linux/game/infection.c) */
#ifndef HALO_INFECTION_H
#define HALO_INFECTION_H
struct game_engine;
union real_vector3d;
/* the game being played is Infection (game_modes_mode's) */
boolean infection_enabled(void);
/* Slayer's engine with Infection's rules (game_modes_engine) */
struct game_engine *infection_engine_get(struct game_engine const *slayer);
/* a player spawned: a zombie's skull (game_modes_postspawn) */
void infection_postspawn(long player_index);
/* a living zombie's unit */
boolean infection_unit_is_zombie(long unit_index);
/* a player may drop the weapon (a zombie keeps its skull: players.c, units.c) */
boolean infection_allow_weapon_drop(long unit_index, long weapon_index);
/* the skull may be deleted (weapons.c's and objects.c's checks that a
game's objective is not) */
boolean infection_can_delete_skull(long object_index);
/* a unit's melee damage multiplier: a zombie's skull's */
real infection_melee_multiplier(long unit_index);
/* a zombie's melee hits a human riding in an open seat, not the vehicle
(unit_cause_player_melee_damage) */
boolean infection_melee_rider_target(long attacker_index, long target_index);
/* ... which the host checks of a client's report: its own line from the
attacker's head to the rider (network_damage.c) */
boolean infection_melee_rider_visible(long attacker_index, long target_index, union real_vector3d const *direction);
/* a player's team, speed and shields as their role has them (a unit
attached: network_player_attach_unit) */
void infection_reconcile_player(long player_index);
/* the round's time left (the score's title) */
long infection_remaining_ticks(void);
/* the state the host sends its clients (game_engine_write_network_state) */
long infection_write_network_state(byte *buffer, long size);
boolean infection_read_network_state(byte const *buffer, long size, boolean first);
#endif
+154 -19
View File
@@ -81,6 +81,7 @@ their handlers open opens.
#include "halo_menus.h"
#include "custom_edition_cache.h"
#include "custom_edition_maps.h"
#include "game_modes.h"
#include "network_voice.h"
#include "text/draw_string.h"
/* (internet play's server browser: the platform layer's) */
@@ -2757,6 +2758,7 @@ boolean ui_widget_port_unjoin_player(struct widget_instance *widget, struct even
void network_game_server_port_set_settings(wchar_t const *name, long maximum_players);
void network_game_server_port_set_cooperative_friendly_fire(short friendly_fire);
void network_game_server_port_set_cooperative_player_collisions(boolean player_collisions);
void network_game_server_port_set_cooperative_ally_friendly_fire(boolean ally_friendly_fire);
void *global_network_game_client_get(void);
void *global_network_game_server_get(void);
boolean network_game_is_splitscreen_local(void);
@@ -2770,6 +2772,7 @@ short network_game_client_get_seconds_to_game_start(void *client);
boolean network_player_is_valid(struct network_player *player);
boolean playlist_profile_get(long index, struct game_variant *variant);
boolean playlist_profile_get_display_name(long index, wchar_t *name);
boolean playlist_profile_get_options(long index, struct game_variant_options *options);
boolean input_get_key(struct key_stroke *key);
boolean game_engine_running(void);
void game_engine_end_game(void);
@@ -2802,7 +2805,7 @@ static struct
/* Create Game's gametype list */
long gametypes[MAXIMUM_GAMETYPES];
short gametype_count;
/* (those of the bank the list's spinner shows: STANDARD, CUSTOM) */
/* (those of the bank the list's spinner shows: STANDARD, OPENCE, CUSTOM) */
short bank[MAXIMUM_GAMETYPES], bank_count, bank_shown;
short gametype_first, gametype_chosen;
/* the server settings */
@@ -3233,8 +3236,33 @@ static void gametype_setup_end(void);
static boolean gametype_setup_apply(void);
static void gametype_setup_type(wchar_t *text);
/* ---- the gametype list: its spinner's bank (STANDARD: the built-in ones,
CUSTOM: those saved) in its first row, then the bank's gametypes */
/* ---- the gametype list: its spinner's bank (STANDARD: the Xbox's built-in
ones, OPENCE: OpenCE's built-in ones, game_modes.c, CUSTOM: those saved) in
its first row, then the bank's gametypes */
enum
{
GAMETYPE_BANK_STANDARD = 0,
GAMETYPE_BANK_OPENCE,
GAMETYPE_BANK_CUSTOM,
NUMBER_OF_GAMETYPE_BANKS
};
/* a gametype's bank */
static short gametype_bank(long profile_index)
{
struct game_variant variant;
struct game_variant_options options;
if (!((unsigned long)profile_index & PLAYLIST_READ_ONLY_BIT))
return GAMETYPE_BANK_CUSTOM;
if (playlist_profile_get(profile_index, &variant) && playlist_profile_get_options(profile_index, &options) &&
game_modes_variant_is_opence(&variant, &options))
{
return GAMETYPE_BANK_OPENCE;
}
return GAMETYPE_BANK_STANDARD;
}
static void gametype_bank_read(short bank)
{
@@ -3244,15 +3272,48 @@ static void gametype_bank_read(short bank)
multiplayer.bank_count = 0;
for (index = 0; index < multiplayer.gametype_count; index++)
{
boolean standard = ((unsigned long)multiplayer.gametypes[index] & PLAYLIST_READ_ONLY_BIT) != 0;
if (standard == (bank == 0))
if (gametype_bank(multiplayer.gametypes[index]) == bank)
multiplayer.bank[multiplayer.bank_count++] = index;
}
multiplayer.gametype_first = 0;
multiplayer.gametype_chosen = 0;
}
/* a gametype's kind and rules, for the description beside a list: its game
engine's name (or its OpenCE gametype's), teams, and what wins */
static void gametype_rules_text(long profile_index, wchar_t *text, short size)
{
struct game_variant variant;
struct game_variant_options options;
wchar_t const *kind;
long engine;
text[0] = 0;
if (!playlist_profile_get(profile_index, &variant))
return;
if (!playlist_profile_get_options(profile_index, &options))
game_variant_options_default(&variant, &options);
engine = PIN(variant.game_engine_index, 0, 5);
kind = game_modes_variant_kind_name(&variant, &options);
switch (game_modes_variant_mode(&variant, &options))
{
case _game_mode_infection:
if (options.time_limit > 0)
usnprintf(text, size - 1, L"%s\r\nTeams\r\nRound time: %d min", kind, options.time_limit);
else
usnprintf(text, size - 1, L"%s\r\nTeams\r\nUntil no human is left", kind);
break;
case _game_mode_gun_game:
usnprintf(text, size - 1, L"%s\r\nFree for all\r\nA kill with each weapon", kind);
break;
default:
usnprintf(text, size - 1, L"%s\r\n%s\r\nScore to win: %ld", kind ? kind : engine_names[engine],
variant.universal_variant.teams ? L"Teams" : L"Free for all", variant.universal_variant.score_to_win);
break;
}
text[size - 1] = 0;
}
/* "mp profiles list initialize": on the gametype used last */
static boolean gametype_list_initialize(struct widget_instance *list)
{
@@ -3260,8 +3321,7 @@ static boolean gametype_list_initialize(struct widget_instance *list)
short last, index;
multiplayer.gametype_count = ui_widget_port_gametypes(multiplayer.gametypes, MAXIMUM_GAMETYPES, &last);
gametype_bank_read(multiplayer.gametype_count && !((unsigned long)multiplayer.gametypes[last] &
PLAYLIST_READ_ONLY_BIT) ? 1 : 0);
gametype_bank_read(multiplayer.gametype_count ? gametype_bank(multiplayer.gametypes[last]) : GAMETYPE_BANK_STANDARD);
for (index = 0; index < multiplayer.bank_count; index++)
{
if (multiplayer.bank[index] == last)
@@ -3307,7 +3367,7 @@ static void gametype_list_update(struct widget_instance *list)
short row_index = 0, focused = NONE, count;
if (spinner && spinner->parameters.list.selected_index != multiplayer.bank_shown)
gametype_bank_read(spinner->parameters.list.selected_index);
gametype_bank_read((short)PIN(spinner->parameters.list.selected_index, 0, NUMBER_OF_GAMETYPE_BANKS - 1));
count = (short)MIN(multiplayer.bank_count, GAMETYPE_ROWS);
/* (the rows after the spinner's: scrolled as list_scroll does) */
for (row = list->child; row; row = row->next, row_index++)
@@ -3360,9 +3420,8 @@ static void gametype_list_update(struct widget_instance *list)
if ((widget = named(description, "gametype_right_pic", 0)) != NULL)
widget->animation.current_frame_index = (short)engine;
usnprintf(text, NUMBEROF(text) - 1, L"%s\r\n%s\r\nScore to win: %ld", engine_names[engine],
variant.universal_variant.teams ? L"Teams" : L"Free for all", variant.universal_variant.score_to_win);
text[NUMBEROF(text) - 1] = 0;
gametype_rules_text(multiplayer.gametypes[multiplayer.bank[multiplayer.gametype_chosen]], text,
NUMBEROF(text));
text_set(named(description, "gametype_right_data", 0), text);
}
}
@@ -3662,8 +3721,8 @@ static boolean server_start(void)
if (hosting_cooperative())
{
/* (as CO-OP OPTIONS left them: network.coop_friendly_fire, in
cooperative_friendly_fire_modes' order, and
network.coop_player_collisions) */
cooperative_friendly_fire_modes' order, network.coop_player_collisions
and network.coop_ally_friendly_fire) */
static char const *const friendly_fire_names[] = { "off", "on", "shields_only", "explosives_only" };
char const *friendly_fire = config_string("network.coop_friendly_fire");
short index;
@@ -3678,6 +3737,7 @@ static boolean server_start(void)
multiplayer.cooperative_no_player_collisions = !config_boolean("network.coop_player_collisions");
network_game_server_port_set_cooperative_friendly_fire(multiplayer.cooperative_friendly_fire);
network_game_server_port_set_cooperative_player_collisions(!multiplayer.cooperative_no_player_collisions);
network_game_server_port_set_cooperative_ally_friendly_fire(config_boolean("network.coop_ally_friendly_fire"));
}
else if (!gametype_setup_apply())
return campaign_fail();
@@ -5100,11 +5160,14 @@ static void lobby_update(struct widget_instance *list)
short seconds = network_game_client_get_seconds_to_game_start(client);
char link[TEXT_FIELD_LENGTH];
wchar_t gametype[NUMBEROF(game->variant.human_readable_game_description) + 1];
/* (an OpenCE gametype's kind: game_modes.c) */
wchar_t const *kind = game_modes_variant_kind_name(&game->variant, &game->variant_options);
ustrncpy(gametype, game->variant.human_readable_game_description, NUMBEROF(gametype) - 1);
gametype[NUMBEROF(gametype) - 1] = 0;
usnprintf(text, NUMBEROF(text) - 1, L"%s\r\n%s\r\n%d of %d players\r\n\r\n%s", gametype,
engine_names[PIN(game->variant.game_engine_index, 0, 5)], lobby_player_count, game->maximum_players,
kind ? kind : engine_names[PIN(game->variant.game_engine_index, 0, 5)], lobby_player_count,
game->maximum_players,
seconds > 0 ? L"Starting in:" : game->machine_count < 2 ? L"Waiting for players" : L"");
text[NUMBEROF(text) - 1] = 0;
if (seconds > 0)
@@ -5342,6 +5405,20 @@ struct gametype_option
static struct gametype_option const gametype_options[] =
{
/* OPENCE OPTIONS (OpenCE's gametypes: game_modes.c) */
{ "oce_mode_spinner", _option_option_byte, OPTIONS_FIELD(mode), 0, 4,
{ _game_mode_none, _game_mode_swat, _game_mode_infection, _game_mode_gun_game } },
{ "oce_hardcore_spinner", _option_option_byte, OPTIONS_FIELD(hardcore), 0, 2, { FALSE, TRUE } },
{ "inf_zombies_spinner", _option_option_byte, OPTIONS_FIELD(infection_initial_zombies), 0, 6, { 1, 2, 3, 4, 8, 16 } },
{ "inf_speed_spinner", _option_option_byte, OPTIONS_FIELD(infection_zombie_speed), 0, 6,
{ 100, 110, 125, 150, 175, 200 } },
{ "inf_damage_spinner", _option_option_byte, OPTIONS_FIELD(infection_skull_damage), 0, 4, { 100, 150, 200, 250 } },
{ "inf_respawn_spinner", _option_option_byte, OPTIONS_FIELD(infection_respawn_time), 0, 6, { 1, 3, 5, 10, 15, 30 } },
{ "inf_countdown_spinner", _option_option_byte, OPTIONS_FIELD(infection_countdown), 0, 5, { 0, 5, 10, 15, 30 } },
{ "inf_shields_spinner", _option_option_byte, OPTIONS_FIELD(infection_zombie_shields), 0, 2, { FALSE, TRUE } },
{ "gg_order_spinner", _option_option_byte, OPTIONS_FIELD(gun_game_order), 0, 3,
{ _gun_game_order_strongest_first, _gun_game_order_weakest_first, _gun_game_order_random } },
{ "gg_melee_spinner", _option_option_byte, OPTIONS_FIELD(gun_game_melee_demotes), 0, 2, { FALSE, TRUE } },
/* player options */
{ "number_of_lives_spinner", _option_long, VARIANT_FIELD(universal_variant.lives), 0, 4, { 0, 1, 3, 5 } },
{ "maximum_health_spinner", _option_health, 0, 0, 6, { 5, 10, 15, 20, 30, 40 } },
@@ -5439,6 +5516,9 @@ static struct gametype_option const gametype_options[] =
/* (and the text chat: port/linux/game/network_chat.c) */
{ "text_chat_spinner", _option_setting, 0, 0, 3, { 0 }, "network.text_chat", { "on", "links", "off" } },
{ "aim_assist_spinner", _option_setting, 0, 0, 2, { 0 }, "network.block_mouse_aim_assist", { "false", "true" } },
/* (the shield effects every machine draws: network_shield_effects.c) */
{ "shield_effects_spinner", _option_setting, 0, 0, 6, { 0 }, "network.shield_effects",
{ "stock", "glow", "light_show", "overshield", "glow_overshield", "light_show_overshield" } },
/* co-op's options (Server Setup's CO-OP OPTIONS: tools/port_settings.py's
COOP_SETUP_SCREENS; coop_enemies.c) */
{ "coop_friendly_fire_spinner", _option_setting, 0, 0, 4, { 0 }, "network.coop_friendly_fire",
@@ -5455,6 +5535,8 @@ static struct gametype_option const gametype_options[] =
{ "2", "4", "8", "16", "32" } },
{ "coop_player_collisions_spinner", _option_setting, 0, 0, 2, { 0 }, "network.coop_player_collisions",
{ "true", "false" } },
{ "coop_ally_friendly_fire_spinner", _option_setting, 0, 0, 2, { 0 }, "network.coop_ally_friendly_fire",
{ "true", "false" } },
/* map sharing's (Server Setup's MAP SHARING: tools/port_settings.py's
MAP_SHARE_SETUP; map_share.c) */
{ "map_share_spinner", _option_setting, 0, 0, 2, { 0 }, "network.map_share", { "true", "false" } },
@@ -5810,6 +5892,15 @@ static boolean gametype_options_save(struct widget_instance *widget)
if (named(list, "op_team", 0))
vehicles_keep(list);
gametype_options_each(list, TRUE);
/* (OPENCE OPTIONS: Infection is played on teams, Gun Game free for all:
game_modes_variant_mode) */
if (named(list, "oce_mode_spinner", 0) && edit_variant()->game_engine_index == game_engine_slayer)
{
if (edit_options()->mode == _game_mode_infection)
edit_variant()->universal_variant.teams = TRUE;
else if (edit_options()->mode == _game_mode_gun_game)
edit_variant()->universal_variant.teams = FALSE;
}
return TRUE;
}
@@ -5845,14 +5936,16 @@ static boolean gametype_setup_apply(void)
static void gametype_setup_type(wchar_t *text)
{
wchar_t name[NUMBEROF(gametype_edit.setup_variant.human_readable_game_description) + 1];
wchar_t const *kind;
text[0] = 0;
if (!gametype_edit.setup)
return;
ustrncpy(name, gametype_edit.setup_variant.human_readable_game_description, NUMBEROF(name) - 1);
name[NUMBEROF(name) - 1] = 0;
kind = game_modes_variant_kind_name(&gametype_edit.setup_variant, &gametype_edit.setup_options);
usnprintf(text, ROW_TEXT_LENGTH - 1, L"%s (%s%s)", name,
engine_names[PIN(gametype_edit.setup_variant.game_engine_index, 0, 5)],
kind ? kind : engine_names[PIN(gametype_edit.setup_variant.game_engine_index, 0, 5)],
gametype_edit.setup_variant.universal_variant.teams ? L", TEAMS" : L"");
text[ROW_TEXT_LENGTH - 1] = 0;
}
@@ -5925,15 +6018,34 @@ static void gametype_edit_list_update(struct widget_instance *list)
if ((widget = named(description, "gametype_right_pic", 0)) != NULL)
widget->animation.current_frame_index = (short)engine;
usnprintf(text, NUMBEROF(text) - 1, L"%s\r\n%s\r\nScore to win: %ld", engine_names[engine],
variant.universal_variant.teams ? L"Teams" : L"Free for all", variant.universal_variant.score_to_win);
text[NUMBEROF(text) - 1] = 0;
gametype_rules_text(profile_index, text, NUMBEROF(text));
text_set(named(description, "gametype_right_data", 0), text);
}
}
profile_name_show(description);
}
/* "port playlist edit desc" (after the PC version's "playlist settings menu
update desc"): the gametype editor's OPENCE OPTIONS, its eighth row, has its
own words (the list's ninth) over GAME OPTIONS' picture, and the buttons
after it SAVE CHANGES' */
#define PLAYLIST_EDIT_OPENCE_ROW 7
#define PLAYLIST_EDIT_OPENCE_WORDS 8
#define PLAYLIST_EDIT_GAME_OPTIONS_PICTURE 1
static void playlist_edit_description(struct widget_instance *list)
{
struct widget_instance *description = list->parameters.list.extended_description;
short index = list->focused_child ? ui_widget_port_list_index(list) : NONE;
if (!description || !description->child || !description->child->next || index < PLAYLIST_EDIT_OPENCE_ROW)
return;
description->child->parameters.text_box.string_list_index =
index == PLAYLIST_EDIT_OPENCE_ROW ? PLAYLIST_EDIT_OPENCE_WORDS : (short)(index - 1);
description->child->next->animation.current_frame_index =
index == PLAYLIST_EDIT_OPENCE_ROW ? PLAYLIST_EDIT_GAME_OPTIONS_PICTURE : (short)(index - 1);
}
/* "mp profile begin editing" (the list's custom activation: OK, a row's A) */
static boolean gametype_edit_begin(void)
{
@@ -6000,6 +6112,27 @@ static void gametype_option_help(struct widget_instance *list)
visible_set(named(list, "op_primary_weapon", 0), custom);
visible_set(named(list, "op_secondary_weapon", 0), custom);
}
/* (OPENCE OPTIONS: the mode's own rows, Infection's or Gun Game's, below
MODE and HARDCORE) */
if (named(list, "oce_mode_spinner", 0))
{
short mode = named(list, "oce_mode_spinner", 0)->parameters.list.selected_index;
short place = 73 + 2 * 30;
for (row = list->child; row; row = row->next)
{
boolean infection = !strncmp(row->name, "op_inf_", 7);
if (!infection && strncmp(row->name, "op_gg_", 6))
continue;
row->visible = infection ? mode == _game_mode_infection : mode == _game_mode_gun_game;
if (row->visible)
{
row->vertical_offset = place;
place += 30;
}
}
}
/* (TEXT CHAT held at OFF while the game is listed: text_chat_locked) */
if (named(list, TEXT_CHAT_SPINNER, 0) && p2p_hosting_listed())
named(list, TEXT_CHAT_SPINNER, 0)->parameters.list.selected_index = TEXT_CHAT_OFF;
@@ -6568,4 +6701,6 @@ void pc_menu_game_data_function_invoke(
profile_gamepad_layout(widget);
else if (!strcmp(name, "port coop friendly fire text"))
coop_friendly_fire_text(widget);
else if (!strcmp(name, "port playlist edit desc"))
playlist_edit_description(widget);
}
+4
View File
@@ -381,6 +381,8 @@ static char const *const port_function_names[] =
"mp profile init indicator opts", "mp profile set ctf rules", "mp profile set koth rules",
"mp profile set slayer rules", "mp profile set oddball rules", "mp profile set racing rules",
"mp profile set player options", "mp profile set item options", "mp profile set indicator opts",
/* (the gametype editor's OPENCE OPTIONS: OpenCE's gametypes, game_modes.c) */
"mp profile init opence options", "mp profile set opence options",
/* (Settings' OK: the Xbox's fails when the profile has no changes, the
settings' screens having written theirs to config.toml) */
"player profile save changes",
@@ -419,6 +421,8 @@ static char const *const port_game_data_input_names[] =
"port mods update",
/* (network co-op's pause menu's FRIENDLY FIRE: its text, ON or OFF) */
"port coop friendly fire text",
/* (the gametype editor's description, with OPENCE OPTIONS' row) */
"port playlist edit desc",
};
static struct
+10
View File
@@ -2071,6 +2071,16 @@ boolean network_coop_player_collisions(
return !TEST_FLAG(game->cooperative_flags, _network_game_cooperative_no_player_collisions_bit);
}
boolean network_coop_ally_friendly_fire(
void)
{
struct network_game *game;
if (!network_coop_active() || !(game = network_game_get_game()))
return TRUE;
return !TEST_FLAG(game->cooperative_flags, _network_game_cooperative_no_ally_friendly_fire_bit);
}
boolean network_coop_own_friendly_fire(
void)
{
+4
View File
@@ -48,6 +48,10 @@ boolean network_coop_active(void);
/* whether the players collide with each other: FALSE in a co-op game whose
host set Server Setup's PLAYER COLLISIONS off (bipeds.c, collisions.c) */
boolean network_coop_player_collisions(void);
/* whether the players hurt their AI allies: FALSE in a co-op game whose host
set Server Setup's ALLY FRIENDLY FIRE off (game_engine.c's
game_engine_friendly_damage) */
boolean network_coop_ally_friendly_fire(void);
/* whether this machine's players play with friendly fire between players
(network.coop_own_friendly_fire: the pause menu's FRIENDLY FIRE) */
boolean network_coop_own_friendly_fire(void);
+130 -14
View File
@@ -34,13 +34,23 @@ being hit looks and feels like on the clients).
- The damage to a unit goes to the machines of the players it concerns
(the unit's, its riders', the damage's owner's) and those sent the
unit's player this tick, which see it; a killing blow to all.
- Scenery and devices that can be destroyed (lights, panels) are the
map's, at the same index on every machine. A client reports its hits on
them like any other, and every client deals the host's damage to its own
copy, which breaks and plays its effects as the host's did.
- Scenery and devices that can be destroyed (lights, panels), or whose
shields can be broken (energy shields, a map's tripmines), are the map's,
at the same index on every machine. A client reports its hits on them like
any other, and every client deals the host's damage to its own copy, which
breaks and plays its effects as the host's did. Their shields' stun and
recharge each machine runs itself (damage.c's objects_update_shields), as
the host sends no state of them: the same damage, and the same recharge.
What one of them deals itself, its shield or body breaking (a tripmine
going off), the host deals whoever owns it, and no client reports: a
client's player's tripmine is set off where the host has it. One made in
the game (a tripmine a grenade's effect places) is at an index of its own
on each machine: a machine given another's index of one takes its own
nearest where the other had it (static_target_near).
*/
#include "cseries.h"
#include "infection.h"
#include "cseries/errors.h"
#include "game/game.h"
#include "game/game_globals.h"
@@ -216,6 +226,10 @@ from the target */
#define REPORT_TARGET_TOLERANCE 3.0f
#define REPORT_TARGET_LEAD_TICKS 15.0f
#define REPORT_IMPACT_TOLERANCE 2.0f
/* ... and how far beyond its size a static target made in the game may be
from where another machine had its own copy (a tripmine: the same grenade's
landing on each machine, static_target_near) */
#define STATIC_TARGET_MATCH_TOLERANCE 1.0f
/* ... and from where the host had a player's unit or vehicle then (with how
far it moves in a few ticks: a client's copy runs a little ahead of the
host's word on it), and further for a vehicle's (its size, and as far as a
@@ -499,12 +513,31 @@ static boolean distributed_damage_to_data(
return TRUE;
}
/* whether the object is scenery or a device that damage can destroy */
/* whether the object is scenery or a device that damage can destroy, or
whose shield it can break (a shield that is all the object is: Rat Race's
energy shields, a map's tripmines) */
static boolean static_target(
long object_index)
{
return object_try_and_get_and_verify_type(object_index, STATIC_TARGET_TYPES) &&
object_get_maximum_body_vitality(object_index, TRUE) > 0.0f;
(object_get_maximum_body_vitality(object_index, TRUE) > 0.0f ||
object_get_maximum_shield_vitality(object_index, TRUE) > 0.0f);
}
boolean network_damage_static_target(
long object_index)
{
return static_target(object_index);
}
/* whether the damage is a static target's own (an effect of its shield or
body breaking: a map's tripmine going off), which the host deals whoever its
owner is: a client's player's tripmine is set off where the host has it (a
vehicle running over it), so their machine has no hit of it to report */
static boolean static_target_damage(
struct damage_data const *damage)
{
return damage->owner_object_index != NONE && static_target(damage->owner_object_index);
}
/* ---------- object_cause_damage (damage.c) */
@@ -652,8 +685,9 @@ boolean network_damage_deals(
damage_replay_player_effect(unit->unit.player_index, &effect, 0.0f);
}
/* a hit of this machine's own player's, on the host's object */
if (distributed_player_is_local(damage->owner_player_index) &&
/* a hit of this machine's own player's, on the host's object (not a
static target's own damage, which the host deals: static_target_damage) */
if (distributed_player_is_local(damage->owner_player_index) && !static_target_damage(damage) &&
(network_objects_client_has(object_index) || static_target(object_index)) &&
damage_report_count < MAXIMUM_HIT_REPORTS_PER_TICK)
{
@@ -678,9 +712,11 @@ boolean network_damage_deals(
return FALSE;
}
/* (a client's player's, whose machine reports it; but one whose machine
has left deals it here: their grenades and rockets still in flight) */
has left deals it here: their grenades and rockets still in flight; and
a static target's own, which no machine reports: static_target_damage) */
if (game_connection() == _game_connection_network_server && !damage_dealing_report &&
damage->owner_player_index != NONE && !distributed_player_is_local(damage->owner_player_index))
damage->owner_player_index != NONE && !distributed_player_is_local(damage->owner_player_index) &&
!static_target_damage(damage))
{
struct player_datum *owner = player_try_and_get(damage->owner_player_index);
@@ -1301,6 +1337,41 @@ static real distributed_distance_squared(
return dx * dx + dy * dy + dz * dz;
}
/* this machine's static target nearest the point where another machine had
one, within its size and the reach of the point, else NONE. A static target
made in the game (a tripmine a grenade's effect places) is at an index of
its own on each machine, as the map's are not, so another machine's index of
it names no such object here */
static long static_target_near(
real_point3d const *point,
real reach)
{
struct object_iterator iterator;
long nearest = NONE;
real nearest_distance = 0.0f;
object_iterator_new(&iterator, STATIC_TARGET_TYPES, 0);
while (object_iterator_next(&iterator))
{
real_point3d origin;
real distance;
real limit;
if (!static_target(iterator.index))
continue;
object_get_origin(iterator.index, &origin);
distance = distributed_distance_squared(point, &origin);
limit = object_get(iterator.index)->object.bounding_sphere_radius + reach;
if (distance <= limit * limit && (nearest == NONE || distance < nearest_distance))
{
nearest = iterator.index;
nearest_distance = distance;
}
}
return nearest;
}
/* where each player's unit and vehicle are this tick (and whether they
drive it), noted; and every few ticks where their unit is */
static void distributed_note_targets(
@@ -1870,6 +1941,14 @@ static boolean distributed_report_valid(
{
return FALSE;
}
/* an Infection zombie's blow at a rider (not the vehicle, as the game's
melee has it) only past the host's own line to them (infection.c) */
if (melee && infection_unit_is_zombie(distributed_living_unit(player)) && target->object.type == _object_type_biped &&
target->object.parent_object_index != NONE &&
!infection_melee_rider_visible(distributed_living_unit(player), report->object_index, &report->damage.direction))
{
return FALSE;
}
if (collision && !distributed_player_drove_into(player_index, &report->damage.epicenter, &report->target_position,
target->object.bounding_sphere_radius, ticks))
{
@@ -1941,7 +2020,8 @@ static boolean distributed_report_valid(
{
normalize3d(&damage->direction);
}
damage->multiplier = 1.0f;
/* (an Infection zombie's skull's blow: its multiplier the host's own) */
damage->multiplier = melee ? infection_melee_multiplier(distributed_living_unit(player)) : 1.0f;
damage->owner_player_index = DATUM_INDEX_NEW(player_index, player->identifier);
damage->owner_team_index = (short)player->team_index;
/* (the players' traits' multipliers go by the object) */
@@ -1962,8 +2042,26 @@ void network_damage_handle_reports(
for (index = 0; index < count; index++)
{
struct distributed_hit_report const *report = &reports[index];
struct distributed_hit_report found;
struct damage_data damage;
/* (a hit on the client's copy of a static target made in the game,
at an index of its own there: the host's where the client had it) */
if (distributed_object_index_valid(report->object_index) &&
distributed_point_valid(&report->target_position, REPORT_WORLD_BOUND) &&
!object_try_and_get_and_verify_type(report->object_index,
_object_mask_biped | _object_mask_vehicle | _object_mask_weapon | _object_mask_equipment) &&
!static_target(report->object_index))
{
long object_index = static_target_near(&report->target_position, STATIC_TARGET_MATCH_TOLERANCE);
if (object_index != NONE)
{
found = *report;
found.object_index = object_index;
report = &found;
}
}
if (!distributed_report_valid(machine_index, report, &damage))
{
damage_rejected_reports++;
@@ -2255,15 +2353,33 @@ void network_damage_handle_events(
}
break;
case _damage_event_static:
if (distributed_object_index_valid(event->object_index) && static_target(event->object_index) &&
distributed_damage_indices_valid(event->object_index, event->node_index, event->region_index,
{
long object_index = event->object_index;
/* (one made in the game, at an index of its own here: this machine's
copy at the damage, within its reach, an explosion's its radius) */
if (distributed_object_index_valid(object_index) && !static_target(object_index) &&
!object_try_and_get_and_verify_type(object_index, _object_mask_all))
{
real reach = REPORT_IMPACT_TOLERANCE;
if (TEST_FLAG(damage.flags, _damage_area_of_effect_bit) &&
tag_index_is_group(damage.definition_index, DAMAGE_EFFECT_DEFINITION_TAG))
{
reach += damage_effect_definition_get(damage.definition_index)->cutoff_radius;
}
object_index = static_target_near(&damage.origin, reach);
}
if (distributed_object_index_valid(object_index) && static_target(object_index) &&
distributed_damage_indices_valid(object_index, event->node_index, event->region_index,
event->material_index))
{
damage_replay_static(event->object_index, &damage, event->node_index, event->region_index,
damage_replay_static(object_index, &damage, event->node_index, event->region_index,
event->material_index);
}
break;
}
}
}
}
+23 -4
View File
@@ -78,6 +78,7 @@ machine (their datum identifiers need not be).
#include "network_distributed.h"
#include "network_voice.h"
#include "network_aim_assist.h"
#include "network_shield_effects.h"
#include "map_share.h"
#include "latency_meter.h"
#include "profile_sections.h"
@@ -2013,11 +2014,22 @@ static void distributed_correct_own_unit(
/* (co-op: the host has its player in a BSP this machine hasn't loaded
yet, the switch still on its way. Moved there, it would fall with no
floor under it, so it stays on the floor it has until the BSP loads.) */
if (network_coop_active() && scenario_leaf_index_from_point(&state->position) == NONE &&
scenario_leaf_index_from_point(&object_get(unit_index)->object.position) != NONE)
floor under it, so it stays on the floor it has until the BSP loads.
Tested at the unit's middle, not its feet: a teleport can leave the feet
a hair below the floor's plane, which is outside the BSP.) */
if (network_coop_active())
{
return;
struct object_datum *object = object_get(unit_index);
real_point3d host_middle;
host_middle.x = state->position.x + object->object.bounding_sphere_center.x - object->object.position.x;
host_middle.y = state->position.y + object->object.bounding_sphere_center.y - object->object.position.y;
host_middle.z = state->position.z + object->object.bounding_sphere_center.z - object->object.position.z;
if (scenario_leaf_index_from_point(&host_middle) == NONE &&
scenario_leaf_index_from_point(&object->object.bounding_sphere_center) != NONE)
{
return;
}
}
if (TEST_FLAG(state->flags, _distributed_unit_predicted_bit) &&
local_player_index >= 0 && local_player_index < MAXIMUM_LOCAL_PLAYERS)
@@ -3802,6 +3814,7 @@ void network_distributed_new_game(
network_actors_new_game();
network_coop_new_game();
network_aim_assist_reset();
network_shield_effects_reset();
network_votekick_new_game();
}
@@ -4482,6 +4495,11 @@ void network_distributed_handle_message(
network_aim_assist_handle_message(machine_index, message, size);
return;
}
if (network_shield_effects_handles_message(message, size))
{
network_shield_effects_handle_message(machine_index, message, size);
return;
}
if (network_voice_handles_message(message, size))
{
network_voice_handle_message(machine_index, message, size);
@@ -4818,6 +4836,7 @@ void network_distributed_handle_message(
/* (its count 1: the client asks again, having failed to make one of
the host's objects) */
network_aim_assist_send_policy(machine_index);
network_shield_effects_send(machine_index);
network_objects_client_asked(machine_index, header.count != 0);
/* (a machine new at its index, which may have joined the game in
progress: every player's statistics and the game type's state, after
+3
View File
@@ -137,6 +137,9 @@ enum
/* the host's mouse aim assist policy (network_aim_assist.c), to every
client, reliably, when it is ready and when the policy changes */
_distributed_message_aim_assist_policy = 90,
/* the host's shield effects (network_shield_effects.c), to every client,
reliably, when it is ready and when they change */
_distributed_message_shield_effects = 91,
/* The VR port's own messages, numbered far past the game's (240 on),
so that messages upstream adds never take their numbers: a build
+52
View File
@@ -0,0 +1,52 @@
/* network_infection.h: Infection's state, which the host sends its clients
with the game type's (port/linux/game/infection.c) */
#ifndef HALO_NETWORK_INFECTION_H
#define HALO_NETWORK_INFECTION_H
enum
{
/* fewer than two players alive: no countdown yet */
_distributed_infection_waiting = 0,
_distributed_infection_countdown,
_distributed_infection_active,
_distributed_infection_finished
};
enum
{
_distributed_infection_role_none = 0,
_distributed_infection_role_human,
_distributed_infection_role_zombie
};
struct distributed_infection_player
{
/* the player it is (infection_player_identity: no machine's datum
index), 0 for none */
unsigned long identity;
/* the kills of the other side */
long score;
byte role;
byte reserved[3];
};
struct distributed_infection_state
{
/* the game it is of (network_game_get_number_of_games_played), and its
revision, raised with each change */
long game_number;
long revision;
long phase;
/* the game time the phase began at */
long phase_tick;
/* the side that won (0 the humans, 1 the zombies), NONE */
long winner;
/* by absolute player index */
struct distributed_infection_player players[HALO_PORT_MAXIMUM_NETWORK_PLAYERS];
};
/* (sent in the game type's state: game_engine.h) */
typedef char verify_distributed_infection_state_size[
sizeof(struct distributed_infection_state) <= GAME_ENGINE_MAXIMUM_NETWORK_STATE_SIZE ? 1 : -1];
#endif
+130
View File
@@ -0,0 +1,130 @@
/* The shield effects of a network game (network.shield_effects): the shield
glow, as far as it reaches, and the overshield effect are the host's choice,
for every machine, so that no player sees what another does not. Offline,
each player's own (display.shield_glow, display.shield_glow_intensity,
display.overshield_effect). The host sends its choice to each client
reliably when it is ready and when it changes; until it arrives, a client
draws the stock game's. */
#include "cseries.h"
#include "game/game.h"
#include "interface/ui_widget.h"
#include "main/main.h"
#include "networking/network_game_globals.h"
#include "network_distributed.h"
#include "network_shield_effects.h"
#include <string.h>
char const *config_string(char const *name);
unsigned long config_changes(void);
static char const *const shield_effects_names[NUMBER_OF_SHIELD_EFFECTS] =
{
"stock", "glow", "light_show", "overshield", "glow_overshield", "light_show_overshield"
};
static short client_effects = _shield_effects_stock;
static short sent_effects = NONE;
struct shield_effects_message
{
struct distributed_message_header header;
word effects;
word reserved;
};
/* the host's choice, read again when a setting changes (asked for each
unit drawn) */
static short host_effects(void)
{
static unsigned long read_at = (unsigned long)-1;
static short effects = _shield_effects_stock;
if (read_at != config_changes())
{
char const *name = config_string("network.shield_effects");
short index;
read_at = config_changes();
effects = _shield_effects_stock;
for (index = 0; name && index < NUMBER_OF_SHIELD_EFFECTS; index++)
{
if (!strcmp(name, shield_effects_names[index]))
effects = index;
}
}
return effects;
}
void network_shield_effects_reset(void)
{
client_effects = _shield_effects_stock;
sent_effects = NONE;
}
/* the effects drawn: the host's in a network game, NONE (each player's own
settings) otherwise */
short network_shield_effects(void)
{
if (game_connection() == _game_connection_network_server)
return host_effects();
if (game_connection() == _game_connection_network_client)
return client_effects;
return NONE;
}
static void shield_effects_message_make(struct shield_effects_message *message, short effects)
{
memset(message, 0, sizeof(*message));
message->effects = (word)effects;
}
void network_shield_effects_send(long machine_index)
{
struct shield_effects_message message;
if (game_connection() != _game_connection_network_server)
return;
shield_effects_message_make(&message, host_effects());
distributed_send_to_machine_reliably(machine_index, &message, _distributed_message_shield_effects, 1,
sizeof(message));
}
void network_shield_effects_update(void)
{
struct shield_effects_message message;
short effects;
if (!game_in_progress() || main_menu_is_active() || game_connection() != _game_connection_network_server)
return;
effects = host_effects();
if (sent_effects == effects)
return;
sent_effects = effects;
shield_effects_message_make(&message, effects);
distributed_send(&message, _distributed_message_shield_effects, 1, sizeof(message),
_distributed_to_clients_reliably);
}
boolean network_shield_effects_handles_message(word const *message, word size)
{
struct distributed_message_header header;
if (size < sizeof(header))
return FALSE;
memcpy(&header, message, sizeof(header));
return header.type == _distributed_message_shield_effects;
}
/* (the host's alone, over its stream, whole) */
void network_shield_effects_handle_message(long machine_index, word const *data, word size)
{
struct shield_effects_message message;
if (machine_index != NONE || game_connection() != _game_connection_network_client ||
network_connection_last_read_was_unreliable() || size != sizeof(message))
return;
memcpy(&message, data, sizeof(message));
if (GET_MESSAGE_TYPE(message.header.header) != 2 || message.header.type != _distributed_message_shield_effects ||
message.header.count != 1 || message.effects >= NUMBER_OF_SHIELD_EFFECTS || message.reserved != 0)
return;
client_effects = (short)message.effects;
}
+22
View File
@@ -0,0 +1,22 @@
#ifndef NETWORK_SHIELD_EFFECTS_H
#define NETWORK_SHIELD_EFFECTS_H
#include "cseries.h"
/* the shield effects a network game draws (network.shield_effects): the
host's, for every machine */
enum
{
_shield_effects_stock,
_shield_effects_glow,
_shield_effects_light_show,
_shield_effects_overshield,
_shield_effects_glow_overshield,
_shield_effects_light_show_overshield,
NUMBER_OF_SHIELD_EFFECTS
};
void network_shield_effects_reset(void);
void network_shield_effects_update(void);
void network_shield_effects_send(long machine_index);
short network_shield_effects(void);
boolean network_shield_effects_handles_message(word const *message, word size);
void network_shield_effects_handle_message(long machine_index, word const *message, word size);
#endif
+9 -1
View File
@@ -51,6 +51,7 @@ Called from the main loop every frame (main.c).
*/
#include "cseries.h"
#include "game_modes.h"
#include "main/main.h"
#include "bink/bink_playback.h"
#include "interface/player_ui.h"
@@ -1526,14 +1527,21 @@ void network_test_update(
}
else
{
struct game_variant_options options;
/* (one of OpenCE's gametypes by its name: game_modes.c) */
boolean opence = game_modes_gametype_by_name(variant_name, &variant, &options);
network_game_server_change_map_name(global_network_game_server_get(), path);
/* the variant, as picking the game settings does */
variant = *game_engine_get_variant_by_name(&variant, variant_name);
if (!opence)
variant = *game_engine_get_variant_by_name(&variant, variant_name);
platform_log("network test: game %d, %s", network_test.variant_index + 1, variant_name);
/* debug.network_test_score: a short game, to test the next */
if (network_test.score_to_win > 0)
variant.universal_variant.score_to_win = network_test.score_to_win;
player_ui_set_game_variant(&variant);
if (opence)
player_ui_set_game_variant_options(&options);
network_game_server_change_game_variant(global_network_game_server_get(), &variant);
}
network_test.map_set = TRUE;
+9
View File
@@ -45,6 +45,7 @@ from below its lowest node to above its highest.
#include "effects/particles.h"
#include "sound/sound_definitions.h"
#include "objects/light_definitions.h"
#include "network_shield_effects.h"
/* port/linux/game/view_fov.c */
boolean viewmodel_shield_is_visible(void);
@@ -117,12 +118,20 @@ static short overshield_effect_next_model = 0;
int config_boolean(const char *name);
unsigned long config_changes(void);
/* display.overshield_effect; in a network game, the host's
(network_shield_effects.c) */
static boolean overshield_effect_enabled(
void)
{
static unsigned long changes = (unsigned long)-1;
static boolean enabled = FALSE;
short effects = network_shield_effects();
if (effects != NONE)
{
changes = (unsigned long)-1;
return effects >= _shield_effects_overshield;
}
if (changes != config_changes())
{
changes = config_changes();
+11 -1
View File
@@ -35,6 +35,7 @@ machines.
#include "camera/observer.h"
#include "game/players.h"
#include "objects/object_lights.h"
#include "network_shield_effects.h"
#include <math.h>
#include <string.h>
@@ -97,13 +98,22 @@ static unsigned long shield_glow_frame = 0;
static real shield_glow_scale = 1.f;
/* display.shield_glow, and its intensity (display.shield_glow_intensity):
"default", or "light_show", three times as bright and as far */
"default", or "light_show", three times as bright and as far; in a network
game, the host's (network_shield_effects.c) */
static boolean shield_glow_enabled(
void)
{
static unsigned long changes = (unsigned long)-1;
static boolean enabled = FALSE;
short effects = network_shield_effects();
if (effects != NONE)
{
changes = (unsigned long)-1;
shield_glow_scale = effects == _shield_effects_light_show ||
effects == _shield_effects_light_show_overshield ? 3.f : 1.f;
return effects != _shield_effects_stock && effects != _shield_effects_overshield;
}
if (changes != config_changes())
{
char const *intensity = config_string("display.shield_glow_intensity");
@@ -51,6 +51,7 @@ this build's order; forgotten together when the map goes
(port/linux/src/xbox_textures.c) */
void halo_custom_edition_texels_channels(const void *texels, unsigned char channel_order);
void halo_custom_edition_texels_forget(void);
void halo_custom_edition_hud_meter(int active);
/* whether a Halo Custom Edition map's multiplayer vehicles are chosen by
their placements' spawn flags, as in retail Halo, and whether a vehicle
placement is placed in the running game
+5 -5
View File
@@ -46,10 +46,10 @@ machines, 16 players) are 0x226 and 0x434. */
#define HALO_PORT_NETWORK_GAME_PLAYERS_END \
(HALO_PORT_NETWORK_GAME_PLAYERS_OFFSET + HALO_PORT_MAXIMUM_NETWORK_PLAYERS * HALO_PORT_NETWORK_PLAYER_SIZE)
#define HALO_PORT_NETWORK_GAME_RANDOM_SEED_OFFSET (HALO_PORT_NETWORK_GAME_PLAYERS_END + 2)
/* (then the gametype's PC options, struct game_variant_options: 0x1C bytes) */
/* (then the gametype's PC options, struct game_variant_options: 0x2C bytes) */
#define HALO_PORT_NETWORK_GAME_VARIANT_OPTIONS_OFFSET (HALO_PORT_NETWORK_GAME_PLAYERS_END + 0xA)
#define HALO_PORT_NETWORK_GAME_LOCAL_DATA_OFFSET (HALO_PORT_NETWORK_GAME_PLAYERS_END + 0x26)
#define HALO_PORT_NETWORK_GAME_SIZE (HALO_PORT_NETWORK_GAME_PLAYERS_END + 0x2A)
#define HALO_PORT_NETWORK_GAME_LOCAL_DATA_OFFSET (HALO_PORT_NETWORK_GAME_PLAYERS_END + 0x36)
#define HALO_PORT_NETWORK_GAME_SIZE (HALO_PORT_NETWORK_GAME_PLAYERS_END + 0x3A)
/* ---------- system link protocol
@@ -66,7 +66,7 @@ is newer (network_client_manager.c). A host advertises it, with its netcode,
in its game's advertisement's reserved bytes (network_server_message_handler.c),
which hosts built before there was a version send as zeros: version 0.
Raise it with any change to what the machines send each other. */
#define HALO_PORT_NETWORK_VERSION 32
#define HALO_PORT_NETWORK_VERSION 36
/* ... the advertisement's reserved bytes: the version (a little-endian word),
then flags */
#define HALO_PORT_ADVERTISED_VERSION_OFFSET 0
@@ -86,7 +86,7 @@ header included; the per-tick update of 128 players is 3,857 */
update of 128 players decodes to 0x1010 bytes */
#define HALO_PORT_NETWORK_PACKET_SIZE 0x1100
/* the game settings record (HALO_PORT_NETWORK_GAME_SIZE, 13,120 bytes at 128
/* the game settings record (HALO_PORT_NETWORK_GAME_SIZE, 13,136 bytes at 128
machines and players) does not fit one message; it is sent in pieces of
this many bytes (4 pieces), each 3,594 bytes on the wire */
#define HALO_PORT_NETWORK_GAME_SETTINGS_FRAGMENT_SIZE 0xE00
+16 -1
View File
@@ -1,4 +1,4 @@
version 32
version 36
bound CHAT_TEXT_SIZE 64
bound DISCORD_ID_SIZE 24
bound DISCORD_NAME_SIZE 40
@@ -8,6 +8,7 @@ bound DISTRIBUTED_RELAYED_ACTION_MINIMUM_SIZE 14
bound DISTRIBUTED_UNIT_STATE_MAXIMUM_SIZE 3 + 4 + (4 + 2) + (12 + 3 * 6) + 2 + 2 * 2 + 4 * 2 + 2 * NUMBER_OF_PLAYER_POWERUPS + 2 + 1
bound DISTRIBUTED_UNIT_STATE_MINIMUM_SIZE 3
bound GAME_ALLEGIANCE_BITVECTOR_LONGS 4
bound HALO_PORT_MAXIMUM_NETWORK_PLAYERS 128
bound LEVEL_NAME_BYTES 64
bound MAP_SHARE_HASH_BYTES 32
bound MAXIMUM_DEVICE_GROUPS 1024
@@ -40,6 +41,13 @@ enum _distributed_actor_shield_charging_bit 2
enum _distributed_actor_shield_depleted_bit 1
enum _distributed_actor_shield_over_charging_bit 3
enum _distributed_actor_super_camouflaged_bit 5
enum _distributed_infection_active 2
enum _distributed_infection_countdown 1
enum _distributed_infection_finished 3
enum _distributed_infection_role_human 1
enum _distributed_infection_role_none 0
enum _distributed_infection_role_zombie 2
enum _distributed_infection_waiting 0
enum _distributed_message_actor_damage 73
enum _distributed_message_actor_states 64
enum _distributed_message_aim_assist_policy 90
@@ -78,6 +86,7 @@ enum _distributed_message_player_inputs 14
enum _distributed_message_player_prediction 1
enum _distributed_message_player_statistics 3
enum _distributed_message_relayed_actions 15
enum _distributed_message_shield_effects 91
enum _distributed_message_structure_bsp 65
enum _distributed_message_unit_states 2
enum _distributed_message_vehicle_prediction 12
@@ -185,6 +194,9 @@ fields server_pregame_countdown 758215ada4e1
fields server_pregame_keep_alive 678699dea271
fields server_remove_player_ingame 1718d4189972
fields server_switch_to_pregame 678699dea271
layout HALO_PORT_NETWORK_GAME_LOCAL_DATA_OFFSET (HALO_PORT_NETWORK_GAME_PLAYERS_END + 0x36)
layout HALO_PORT_NETWORK_GAME_SIZE (HALO_PORT_NETWORK_GAME_PLAYERS_END + 0x3A)
layout HALO_PORT_NETWORK_GAME_VARIANT_OPTIONS_OFFSET (HALO_PORT_NETWORK_GAME_PLAYERS_END + 0xA)
size message_client_add_player_request_ingame 0x20
size message_client_add_player_request_pregame 0x20
size message_client_broadcast_game_search 0x0C
@@ -251,6 +263,8 @@ struct distributed_damage_event 659e4d49733b
struct distributed_damage_event_message c954363dcf26
struct distributed_hit_report 9a44ca43a88b
struct distributed_hit_report_message 37279f2addca
struct distributed_infection_player d8b98eecf26b
struct distributed_infection_state 8a01c46945ad
struct distributed_inventory 05a279a76ba5
struct distributed_inventory_message 11825a84dc29
struct distributed_map_share_offer 4bea857123c2
@@ -277,3 +291,4 @@ struct distributed_voice_down e3751d692f16
struct distributed_voice_up 3d74ee44e4cb
struct distributed_votekick_request d5f913f22d81
struct distributed_votekick_status 966041386843
struct game_variant_options 04868b5f4064
+142 -57
View File
@@ -634,6 +634,9 @@ vertices. */
#ifndef HALO_GLES
#define VISIBILITY_BATCH_COUNT 3
/* what a test's place in the buffer holds until the GPU copies its count
there: more than any test covers (8K with 4x MSAA has 133 million samples) */
#define VISIBILITY_UNCOPIED 0xFFFFFFFFUL
/* a frame's tests: their queries (kept until every count is read), the slot
and area of each, and (once the frame is presented) the fence its copies
wait on */
@@ -2290,7 +2293,7 @@ static void hdr_read(void)
exposure = config_real("display.hdr_exposure");
wanted = config_boolean("display.hdr");
#ifdef HALO_ANDROID
/* (port, Ringfall: never in VR, whose eyes' pictures go to the headset
/* (port, Mjolnir VR: never in VR, whose eyes' pictures go to the headset
as they are, and whose GPU time is short already) */
if (halo_vr_active())
wanted = FALSE;
@@ -2401,10 +2404,11 @@ static void gl_initialize(void)
host_gl_has_extension("GL_ANGLE_texture_compression_dxt3") &&
host_gl_has_extension("GL_ANGLE_texture_compression_dxt5"));
xgpu_capabilities.multiview = host_gl_has_extension("GL_OVR_multiview2");
platform_log("OpenGL ES %d.%d: copy image %d, border clamp %d, anisotropy %d, S3TC %d, sample counting %d, "
"base vertex %d (%s), multiview %d, half float targets %d",
xgpu_capabilities.astc = host_gl_has_extension("GL_KHR_texture_compression_astc_ldr");
platform_log("OpenGL ES %d.%d: copy image %d, border clamp %d, anisotropy %d, S3TC %d, ASTC %d, "
"sample counting %d, base vertex %d (%s), multiview %d, half float targets %d",
(int)major, (int)minor, xgpu_capabilities.copy_image, xgpu_capabilities.border_clamp,
xgpu_capabilities.anisotropy, xgpu_capabilities.s3tc, xgpu_capabilities.atomic_counters,
xgpu_capabilities.anisotropy, xgpu_capabilities.s3tc, xgpu_capabilities.astc, xgpu_capabilities.atomic_counters,
xgpu_capabilities.base_vertex, base_vertex_source, xgpu_capabilities.multiview,
xgpu_capabilities.color_buffer_half_float);
#ifdef HALO_ANDROID
@@ -3082,7 +3086,7 @@ static void visibility_results_initialize(void)
{
const char *vendor = (const char *)glGetString(GL_VENDOR);
GLsizeiptr size = VISIBILITY_BATCH_COUNT * VISIBILITY_TEST_SLOTS * sizeof(GLuint);
GLbitfield flags = GL_MAP_READ_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT;
GLbitfield flags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT;
BOOL success;
device.visibility_logging = config_boolean("debug.gl_debug");
@@ -3436,6 +3440,18 @@ void WINAPI D3DDevice_SetTexture(DWORD stage, D3DBaseTexture *texture)
device.textures[stage] = texture;
}
#ifdef HALO_ANDROID
/* Remove CE headers before their owner frees or reuses them. */
void android_ce_texture_unbind(const void *resource)
{
unsigned long stage;
for (stage = 0; stage < D3DTSS_MAXSTAGES; stage++)
if ((const void *)device.textures[stage] == resource)
device.textures[stage] = NULL;
xgpu_gl_state_invalidate();
}
#endif
void WINAPI D3DDevice_SetPalette(DWORD stage, D3DPalette *palette)
{
if (stage < D3DTSS_MAXSTAGES)
@@ -4655,6 +4671,7 @@ static void bind_textures(struct nv2a_pixel_shader_key *key, float texture_scale
{
key->coverage_alpha = description.hires_coverage != FALSE;
key->point_threshold = description.hires_point_threshold != FALSE;
key->ce_meter_channels = description.ce_meter_channels != FALSE;
}
key->sampler_type[stage] = gl_target == GL_TEXTURE_CUBE_MAP ? _xgpu_sampler_cube :
gl_target == GL_TEXTURE_3D ? _xgpu_sampler_3d : _xgpu_sampler_2d;
@@ -5058,6 +5075,9 @@ static struct program_entry *prepare_draw(BOOL immediate)
skip++;
}
}
/* (Mjolnir VR: not upstream's Android refresh of the GL shadow state
before every draw, a workaround from Mali phones that would set the
whole state again at every draw of both eyes on the Quest) */
memset(&key, 0, sizeof(key));
memcpy(key.combiner_state, D3D__RenderState, sizeof(key.combiner_state));
/* constants are uniforms, not part of the program */
@@ -5674,6 +5694,10 @@ static BOOL mirror_range(unsigned long address, unsigned long size, GLuint *buff
unsigned long segment, first, last, page, oldest = ~0UL, newest = 0;
BOOL present = TRUE;
/* (Mjolnir VR: the cache is kept on Android, without upstream's bypass
for phones whose geometry it corrupted, cause unknown; the Quest and the
Steam Frame never showed that, and streaming every draw's geometry
would cost both eyes' draws) */
if (!size || address < PLATFORM_CONTIGUOUS_BASE || start + size > PLATFORM_CONTIGUOUS_SIZE)
return FALSE;
segment = start / MIRROR_SEGMENT_SIZE;
@@ -7389,20 +7413,90 @@ void d3d8_clear_back_buffer_region(float left, float top, float right, float bot
}
#ifndef HALO_GLES
/* the counts read from each query, as with AMD's driver, once a batch's
copies into the buffer have failed: a batch that fails is not used again,
and with the buffer the readback would stop once all of them had. The
batches still waiting keep their queries and are read from them. */
static void visibility_fall_back_to_queries(void)
{
unsigned long i;
for (i = 0; i < VISIBILITY_BATCH_COUNT; i++)
{
if (device.visibility_batches[i].fence)
glDeleteSync(device.visibility_batches[i].fence);
device.visibility_batches[i].fence = NULL;
}
device.visibility_mapped = NULL;
platform_log("GPU: visibility test counts read from each query from now on");
}
/* this frame's batch sent, before the swap. A copy into the buffer right
after each test stopped the GPU until that test's draws were through,
hundreds of times a frame in The Library; the GPU copies a batch's counts
when its frame is presented, over the CPU's VISIBILITY_UNCOPIED, with a
fence after the copies. Nothing here waits for an answer from the driver:
with a threaded driver (NVIDIA's) any such call waits until its thread has
carried out the whole frame queued before it, and here, before the swap,
that held the frame back every time. GL errors are asked for with
debug.gl_debug; the swap, next, sends the commands to the GPU. */
static void visibility_send_batch(void)
{
struct visibility_batch *batch;
unsigned long i;
if (device.visibility_unavailable || device.visibility_batch >= VISIBILITY_BATCH_COUNT)
return;
batch = &device.visibility_batches[device.visibility_batch];
if (!batch->count)
return;
if (device.visibility_mapped)
{
volatile GLuint *counts = device.visibility_mapped + device.visibility_batch * VISIBILITY_TEST_SLOTS;
if (device.visibility_logging)
visibility_readback_gl_ok("before query copies");
/* (the coherent mapping makes these writes visible to the copies
sent after them; a place that still holds VISIBILITY_UNCOPIED
once the fence has passed is a copy that failed) */
for (i = 0; i < batch->count; i++)
counts[i] = VISIBILITY_UNCOPIED;
for (i = 0; i < batch->count; i++)
glGetQueryBufferObjectuiv(batch->queries[i], device.visibility_buffer, GL_QUERY_RESULT,
(GLintptr)((device.visibility_batch * VISIBILITY_TEST_SLOTS + i) * sizeof(GLuint)));
batch->fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
if (!batch->fence || (device.visibility_logging && !visibility_readback_gl_ok("query copies")))
{
batch->failed = TRUE;
device.visibility_stats.failures++;
if (batch->fence)
glDeleteSync(batch->fence);
batch->fence = NULL;
platform_log("GPU: visibility test batch %lu dropped: its counts could not be copied",
device.visibility_batch);
visibility_fall_back_to_queries();
}
}
batch->sealed = TRUE;
batch->serial = ++device.visibility_serial;
batch->frame = device.frame;
device.visibility_batch = VISIBILITY_BATCH_COUNT;
device.visibility_stats.submitted++;
}
/* the counts of earlier frames' tests, read into their slots oldest batch
first, and this frame's batch sent. A copy into the buffer right after each
test stopped the GPU until that test's draws were through, hundreds of times
a frame in The Library; the GPU copies a batch's counts when its frame is
presented, and the CPU reads them once the fence after the copies has
passed, a frame or more later. With AMD's driver the CPU reads each query
once it says it is available. A batch is not reused until all its counts
have been read. */
first once the fence after their copies has passed, after the swap, when
the driver has the least queued before the question; with AMD's driver the
CPU reads each query once it says it is available. A batch is not reused
until all its counts have been read; one the GPU is late with is waited for
at the next presents, however long (its slots keep their earlier counts
meanwhile, and with every batch waiting, tests are dropped). */
static void visibility_read_batch(void)
{
struct visibility_batch *batch;
unsigned long i, oldest, pending = 0, oldest_age = 0;
GLint binding = 0;
BOOL bound = TRUE;
BOOL bound = TRUE, fall_back = FALSE;
if (device.visibility_unavailable)
return;
@@ -7430,17 +7524,21 @@ static void visibility_read_batch(void)
if (oldest == VISIBILITY_BATCH_COUNT)
break;
batch = &device.visibility_batches[oldest];
if (device.visibility_mapped)
/* (the batch this present sent: looked for from the next one) */
if (batch->frame == device.frame)
break;
if (device.visibility_mapped && batch->fence)
{
GLenum status = glClientWaitSync(batch->fence, 0, 0);
BOOL success = visibility_readback_gl_ok("copy completion");
/* (the flush makes sure the fence reaches the GPU without
counting on the swap's; after the swap it has nothing to send) */
GLenum status = glClientWaitSync(batch->fence, GL_SYNC_FLUSH_COMMANDS_BIT, 0);
if (success && status == GL_TIMEOUT_EXPIRED)
if (status == GL_TIMEOUT_EXPIRED)
{
device.visibility_stats.unavailable++;
break;
}
if (!success || (status != GL_ALREADY_SIGNALED && status != GL_CONDITION_SATISFIED))
if (status != GL_ALREADY_SIGNALED && status != GL_CONDITION_SATISFIED)
{
batch->failed = TRUE;
device.visibility_stats.failures++;
@@ -7449,7 +7547,10 @@ static void visibility_read_batch(void)
glDeleteSync(batch->fence);
batch->fence = NULL;
if (batch->failed)
continue;
{
fall_back = TRUE;
break;
}
}
while (batch->read < batch->count)
{
@@ -7458,7 +7559,15 @@ static void visibility_read_batch(void)
float area = batch->areas[test];
if (device.visibility_mapped)
{
samples = device.visibility_mapped[oldest * VISIBILITY_TEST_SLOTS + test];
if (samples == VISIBILITY_UNCOPIED)
{
batch->failed = TRUE;
device.visibility_stats.failures++;
break;
}
}
else
{
glGetQueryObjectuiv(batch->queries[test], GL_QUERY_RESULT_AVAILABLE, &available);
@@ -7491,7 +7600,12 @@ static void visibility_read_batch(void)
{
/* (its slots keep their earlier counts, and its queries, whose
state is unknown, are not used again) */
platform_log("GPU: visibility test batch %lu dropped: its queries could not be read", oldest);
platform_log("GPU: visibility test batch %lu dropped: its counts could not be read", oldest);
if (device.visibility_mapped)
{
fall_back = TRUE;
break;
}
continue;
}
if (batch->read < batch->count)
@@ -7505,42 +7619,10 @@ static void visibility_read_batch(void)
glBindBuffer(GL_QUERY_BUFFER, (GLuint)binding);
visibility_readback_gl_ok("restore query buffer");
}
if (device.visibility_batch < VISIBILITY_BATCH_COUNT)
{
batch = &device.visibility_batches[device.visibility_batch];
if (batch->count)
{
if (device.visibility_mapped)
{
BOOL success;
visibility_readback_gl_ok("before query copies");
for (i = 0; i < batch->count; i++)
glGetQueryBufferObjectuiv(batch->queries[i], device.visibility_buffer, GL_QUERY_RESULT,
(GLintptr)((device.visibility_batch * VISIBILITY_TEST_SLOTS + i) * sizeof(GLuint)));
batch->fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
success = visibility_readback_gl_ok("query copies");
if (!success || !batch->fence)
{
batch->failed = TRUE;
device.visibility_stats.failures++;
if (batch->fence)
glDeleteSync(batch->fence);
batch->fence = NULL;
platform_log("GPU: visibility test batch %lu dropped: its counts could not be copied",
device.visibility_batch);
}
}
batch->sealed = TRUE;
batch->serial = ++device.visibility_serial;
batch->frame = device.frame;
device.visibility_batch = VISIBILITY_BATCH_COUNT;
device.visibility_stats.submitted++;
/* (sent to the GPU now, whether or not presenting flushes: the
counts are first looked for at the next present) */
glFlush();
}
}
/* (after the reads from the buffer: those from each query unbind it
first, from the next present) */
if (fall_back)
visibility_fall_back_to_queries();
for (i = 0; i < VISIBILITY_BATCH_COUNT; i++)
{
batch = &device.visibility_batches[i];
@@ -7683,7 +7765,7 @@ void WINAPI D3DDevice_Present(CONST RECT *source_rectangle, CONST RECT *destinat
back_buffer->target.texture);
render_target_resolve(&back_buffer->target);
#ifndef HALO_GLES
visibility_read_batch();
visibility_send_batch();
#endif
if (screenshot_every > 0 && device.frame % (unsigned long)screenshot_every == 0)
write_screenshot(back_buffer);
@@ -7732,6 +7814,9 @@ void WINAPI D3DDevice_Present(CONST RECT *source_rectangle, CONST RECT *destinat
glBindVertexArray(device.vertex_array);
platform_video_swap();
}
#ifndef HALO_GLES
visibility_read_batch();
#endif
xgpu_gl_state_invalidate();
memory_watch_begin_frame();
xgpu_texture_cache_begin_frame();
+49 -5
View File
@@ -89,6 +89,35 @@ int hud_hires_asset_custom_edition(long asset)
return asset >= 0 && asset < hud_hires_asset_count() && hud_hires_embedded[asset].custom_edition;
}
int hud_hires_asset_ce_only(long asset)
{
return asset >= 0 && asset < hud_hires_asset_count() && hud_hires_embedded[asset].ce_only;
}
long hud_hires_ce_stock_find(char const *tag, long bitmap)
{
unsigned int index;
for (index = 0; index < hud_hires_ce_stock_count; index++)
if (hud_hires_ce_stock[index].bitmap == bitmap && !strcmp(tag, hud_hires_ce_stock[index].tag))
return (long)index;
return -1;
}
long hud_hires_ce_stock_count_get(void) { return hud_hires_ce_stock_count; }
char const *hud_hires_ce_stock_tag(long index) { return hud_hires_ce_stock[index].tag; }
long hud_hires_ce_stock_bitmap(long index) { return hud_hires_ce_stock[index].bitmap; }
int hud_hires_ce_stock_matches(long index, unsigned long address, long width, long height,
unsigned long size)
{
const struct hud_hires_ce_stock *stock;
if (index < 0 || (unsigned long)index >= hud_hires_ce_stock_count || !address)
return 0;
stock = &hud_hires_ce_stock[index];
return width == stock->width && height == stock->height && size == stock->size &&
crc32(0L, (const Bytef *)address, (uInt)size) == stock->crc;
}
char const *hud_hires_asset_tag(long asset)
{
return hud_hires_embedded[asset].tag;
@@ -157,7 +186,15 @@ long hud_hires_override_find(unsigned long address, unsigned long width, unsigne
/* (a Custom Edition map's stock HUD bitmap, laid out as this texture's,
has its own pixels) */
if (hud_hires_asset_stock_custom_edition(address, (long)width, (long)height, asset))
return asset;
{
const struct hud_hires_embedded *embedded = &hud_hires_embedded[asset];
/* Resource maps can be modified too. Match the stock pixels after
the CE loader has put them in hardware order, not just their name. */
return width == embedded->ce_width && height == embedded->ce_height &&
level0_size == embedded->ce_size &&
crc32(0L, (const Bytef *)address, (uInt)level0_size) == embedded->ce_crc ? asset : -1;
}
if (crc32(0L, (const Bytef *)address, (uInt)level0_size) != hud_hires_embedded[asset].crc)
{
if (!textures[asset].other_pixels_logged)
@@ -281,12 +318,13 @@ static void upscale_weights(float t, float *weights)
weights[3] = -0.5f * square + 0.5f * cube;
}
unsigned char *hud_hires_upscale_pixels(const unsigned char *bgra, unsigned long width, unsigned long height)
static unsigned char *upscale_pixels(const unsigned char *bgra, unsigned long width, unsigned long height,
unsigned long maximum)
{
unsigned char *out;
unsigned long x, y, channel;
if (!bgra || !width || !height || width > 256 || height > 256)
if (!bgra || !width || !height || width > maximum || height > maximum)
return NULL;
out = malloc(width * height * 16 * 4);
if (!out)
@@ -334,6 +372,11 @@ unsigned char *hud_hires_upscale_pixels(const unsigned char *bgra, unsigned long
return out;
}
unsigned char *hud_hires_upscale_pixels(const unsigned char *bgra, unsigned long width, unsigned long height)
{
return upscale_pixels(bgra, width, height, 256);
}
static unsigned char *png_decode(const unsigned char *data, unsigned long size,
unsigned long *png_width, unsigned long *png_height);
@@ -385,7 +428,8 @@ static void upscale_outline(unsigned char *pixels, const unsigned char *bgra,
unsigned int hud_hires_upscale_texture(const unsigned char *bgra, unsigned long width,
unsigned long height, long kind, unsigned long *levels)
{
unsigned char *pixels = hud_hires_upscale_pixels(bgra, width, height);
unsigned char *pixels = kind == 4 ? upscale_pixels(bgra, width, height, 512) :
hud_hires_upscale_pixels(bgra, width, height);
unsigned long largest;
GLuint texture;
@@ -564,7 +608,7 @@ unsigned int hud_hires_png_texture(const void *png, unsigned long size, unsigned
return png_pixels_texture(pixels, width, height, levels);
}
/* (port, Ringfall: the same in two steps, the decode on any thread:
/* (port, Mjolnir VR: the same in two steps, the decode on any thread:
menu_files.c's menu pictures) */
unsigned char *hud_hires_png_pixels(const void *png, unsigned long size, unsigned long *width, unsigned long *height)
{
+12
View File
@@ -47,6 +47,9 @@ struct hud_hires_embedded
/* drawn for a Custom Edition map's stock bitmap of its name too, whose
layout is its own (port/assets/hud/custom_edition.json) */
int custom_edition;
int ce_only;
/* Stock CE first mip after hardware conversion; resource maps may be modified. */
unsigned int ce_width, ce_height, ce_size, ce_crc;
const unsigned int *png;
unsigned int png_size;
};
@@ -54,6 +57,15 @@ struct hud_hires_embedded
extern const struct hud_hires_embedded hud_hires_embedded[];
extern const unsigned int hud_hires_embedded_count;
struct hud_hires_ce_stock
{
const char *tag;
int bitmap;
unsigned int width, height, size, crc;
};
extern const struct hud_hires_ce_stock hud_hires_ce_stock[];
extern const unsigned int hud_hires_ce_stock_count;
/* At the frame boundary, identify cached bitmaps affected by committed HUD
* or title setting changes. Pixel/CRC validation still occurs on upload. */
unsigned long hud_hires_settings_changed(void);
+2
View File
@@ -389,6 +389,8 @@ static void texture_stage(struct xgpu_text *text, const struct nv2a_pixel_shader
xgpu_text_append(text, "\tt%d = ", stage);
sample(text, key, stage, coordinates);
xgpu_text_append(text, ";\n");
if (stage == 0 && key->ce_meter_channels)
xgpu_text_append(text, "\tt0 = t0.aaar;\n");
if (stage == 0 && key->point_threshold && key->sampler_type[stage] == _xgpu_sampler_2d)
{
/* IDs must not be averaged with another segment or corrupted by
+29 -5
View File
@@ -193,6 +193,10 @@ static const struct config_setting config_settings[] =
"Sharpen textures seen at a grazing angle (floors, walls, terrain), which\n"
"the Xbox did not: 2, 4, 8 or 16 times; 0 filters as the Xbox did. 4 keeps\n"
"most of 16's sharpness at less cost on slower GPUs." },
{ "display.dxt1_astc", _config_boolean, "true", "HALO_DXT1_ASTC", _environment_value, _platform_android,
"On a GPU without DXT textures (Mali), give it the DXT1 textures as ASTC,\n"
"which holds them nearly as they are in a quarter of the memory of the\n"
"32-bit texels they are otherwise decoded to; false decodes them." },
{ "display.latency_meter", _config_boolean, "false", "HALO_LATENCY_METER", _environment_value, _platform_all,
"In a network game, your round trip to the host in milliseconds at the\n"
"screen's top right, with bars (the host: its slowest player's), and\n"
@@ -553,6 +557,12 @@ static const struct config_setting config_settings[] =
"Moving the mouse forward looks down." },
{ "network.block_mouse_aim_assist", _config_boolean, "false", "HALO_NET_BLOCK_MOUSE_AIM_ASSIST", _environment_value,
_platform_all, "Host: disable optional mouse magnetism for mouse/keyboard players. Controllers and touch keep their own assist." },
{ "network.shield_effects", _config_string, "\"stock\"", "HALO_NET_SHIELD_EFFECTS", _environment_value, _platform_all,
"Host: the shield effects every player of a network game sees, whatever\n"
"their own: \"stock\", \"glow\", \"light_show\", \"overshield\",\n"
"\"glow_overshield\" or \"light_show_overshield\" (display.shield_glow,\n"
"its light_show intensity, display.overshield_effect). SHIELD EFFECTS\n"
"in Server Setup > Player Options writes its choice here." },
{ "input.mouse_aim_assist", _config_boolean, "false", "HALO_MOUSE_AIM_ASSIST", _environment_value, _platform_desktop,
"Magnetism while aiming with the mouse, as with a controller: the view\n"
"slowed and dragged along by a target. The last of the mouse and the\n"
@@ -648,7 +658,7 @@ static const struct config_setting config_settings[] =
"as CUSTOM SINGLEPLAYER and CUSTOM MULTIPLAYER. Their tags are checked\n"
"as the game's own maps' are before they run; false refuses them\n"
"(docs/custom_edition_caches.md)." },
/* (the desktop's local bots, bots.c; Ringfall's host bots have their own
/* (the desktop's local bots, bots.c; Mjolnir VR's host bots have their own
bots.count and bots.skill, Android's, below: host_bots.c) */
{ "bots.count", _config_integer, "0", "HALO_BOTS", _environment_value, _platform_desktop,
"Computer players (bots) in a local (split screen) Slayer game: 0 to 15\n"
@@ -671,13 +681,18 @@ static const struct config_setting config_settings[] =
"it charges (2 seconds, 3 from a shield that was down) and staying lit,\n"
"its energy slower, in its own color (the powerup's), on the first-person\n"
"arms too with viewmodel_shield; a hit on it plays what the projectile\n"
"plays on an Elite's shield. Only what is drawn and heard changes." },
"plays on an Elite's shield. Only what is drawn and heard changes.\n"
"Offline only: in a network game, the host's network.shield_effects\n"
"decides." },
{ "display.shield_glow", _config_boolean, "false", "HALO_SHIELD_GLOW", _environment_value, _platform_all,
"Energy shields light what is around them as they flare, as plasma\n"
"does, in the shield's own color." },
"does, in the shield's own color. Offline only: in a network game, the\n"
"host's network.shield_effects decides." },
{ "display.shield_glow_intensity", _config_string, "\"default\"", "HALO_SHIELD_GLOW_INTENSITY", _environment_value, _platform_all,
"How far the shield glow reaches: \"default\" or \"light_show\" (three\n"
"times as far, and at full strength from a third of the flare)." },
"times as far, and at full strength from a third of the flare).\n"
"Offline only: in a network game, the host's network.shield_effects\n"
"decides." },
{ "display.shield_color", _config_string, "\"default\"", "HALO_SHIELD_COLOR", _environment_value, _platform_all,
"Your energy shield's color, as this machine draws it: \"default\" (the\n"
"shield's own) or a multiplayer armor color: white, black, red, blue,\n"
@@ -811,7 +826,14 @@ static const struct config_setting config_settings[] =
"Whether the players of an online co-op game hurt each other: \"off\",\n"
"\"on\", \"shields_only\" or \"explosives_only\" (FRIENDLY FIRE in\n"
"co-op's Server Setup > Co-op Options writes its choice here). Their AI\n"
"allies they always can, as in the campaign." },
"allies they hurt as network.coop_ally_friendly_fire says." },
{ "network.coop_ally_friendly_fire", _config_boolean, "true", "HALO_NET_COOP_ALLY_FRIENDLY_FIRE",
_environment_value, _platform_all,
"Whether the players of an online co-op game hurt their AI allies (the\n"
"Marines, Captain Keyes, the Sentinels while they are allies), as in the\n"
"campaign; false, the players' weapons, grenades and vehicles do them\n"
"no harm. ALLY FRIENDLY FIRE in co-op's Server Setup > Co-op Options\n"
"writes its choice here." },
{ "network.coop_own_friendly_fire", _config_boolean, "true", "HALO_NET_COOP_OWN_FRIENDLY_FIRE",
_environment_value, _platform_all,
"Whether this machine's players hurt, and are hurt by, the other players\n"
@@ -1852,6 +1874,8 @@ static const struct
{ "network.voice_mode", { "off", "team_proximity", "team_enemy_proximity", "team_global",
"team_global_enemy_proximity", NULL }, NULL },
{ "network.coop_friendly_fire", { "off", "on", "shields_only", "explosives_only", NULL }, NULL },
{ "network.shield_effects", { "stock", "glow", "light_show", "overshield", "glow_overshield",
"light_show_overshield", NULL }, NULL },
{ "network.coop_enemies_mode", { "none", "per_player", "multiplier", NULL }, NULL },
{ "streamer.slurs", { "off", "severe", "strong", "mild", NULL }, NULL },
{ "streamer.swearing", { "off", "severe", "strong", "mild", NULL }, NULL },
+152
View File
@@ -117,6 +117,9 @@ static void screen_keyboard_update(void);
/* the windows' icon, a PNG (tools/embed_assets.py, from port/assets/icon) */
extern const unsigned int platform_window_icon[];
extern const unsigned long platform_window_icon_size;
/* the menus' pointer, a PNG (tools/embed_assets.py, from port/assets/cursor) */
extern const unsigned int platform_menu_cursor[];
extern const unsigned long platform_menu_cursor_size;
#endif
#endif
@@ -1005,6 +1008,116 @@ BOOL platform_video_hdr(float *sdr_white, float *headroom)
}
#endif
#ifndef HALO_ANDROID
#ifndef HALO_GLES
/* ---------- the menus' cursor
The blue arrow the menus show for the mouse, in place of the system's. Halo
PC drew its cursor in the menus' 640 x 480, so it took the same part of the
screen at any resolution; this one is made again whenever the window's size
in pixels changes (menu_cursor_fit, from platform_pump_events). */
/* the arrow's height in the menus' 480 lines (72 pixels at 1080p) */
#define MENU_CURSOR_HEIGHT 32
/* the arrow's tip in the picture, past its soft edge: the click point */
#define MENU_CURSOR_TIP 2
static SDL_Surface *menu_cursor_picture;
static SDL_Cursor *menu_cursor;
static int menu_cursor_height;
/* the picture at a height, halved first while it is twice that or more (one
linear scaling to less than half the size skips pixels) */
static SDL_Surface *menu_cursor_scale(int height)
{
int width = (menu_cursor_picture->w * height + menu_cursor_picture->h / 2) / menu_cursor_picture->h;
SDL_Surface *surface = SDL_DuplicateSurface(menu_cursor_picture);
while (surface && surface->h / 2 >= height)
{
SDL_Surface *half = SDL_ScaleSurface(surface, surface->w / 2, surface->h / 2, SDL_SCALEMODE_LINEAR);
SDL_DestroySurface(surface);
surface = half;
}
if (surface && surface->h != height)
{
SDL_Surface *sized = SDL_ScaleSurface(surface, width > 0 ? width : 1, height, SDL_SCALEMODE_LINEAR);
SDL_DestroySurface(surface);
surface = sized;
}
return surface;
}
/* the cursor made for the window's size, when that has changed: its height
the part of the window the menus' 480 lines take (their 4:3 fits a window of
another shape), in pixels; where the desktop counts in points (macOS, Wayland
at a scale) the cursor is that size in points, with the pixels' image as its
alternate */
static void menu_cursor_fit(void)
{
int width = 0, height = 0, lines, cursor_height;
float density;
SDL_Surface *pixels, *points;
SDL_Cursor *cursor = NULL;
if (!menu_cursor_picture || !SDL_GetWindowSizeInPixels(platform_window, &width, &height) ||
width <= 0 || height <= 0)
return;
lines = height < width * 3 / 4 ? height : width * 3 / 4;
cursor_height = lines * MENU_CURSOR_HEIGHT / 480;
if (cursor_height < 16)
cursor_height = 16;
if (cursor_height == menu_cursor_height)
return;
menu_cursor_height = cursor_height;
density = SDL_GetWindowPixelDensity(platform_window);
pixels = menu_cursor_scale(cursor_height);
points = density > 1.0f ? menu_cursor_scale((int)(cursor_height / density + 0.5f)) : pixels;
if (pixels && points && (points == pixels || SDL_AddSurfaceAlternateImage(points, pixels)))
cursor = SDL_CreateColorCursor(points,
(MENU_CURSOR_TIP * points->w + menu_cursor_picture->w / 2) / menu_cursor_picture->w,
(MENU_CURSOR_TIP * points->h + menu_cursor_picture->h / 2) / menu_cursor_picture->h);
if (cursor && SDL_SetCursor(cursor))
{
SDL_DestroyCursor(menu_cursor);
menu_cursor = cursor;
}
else
{
platform_log("cannot set the menus' cursor: %s", SDL_GetError());
if (cursor)
SDL_DestroyCursor(cursor);
}
if (points != pixels)
SDL_DestroySurface(points);
SDL_DestroySurface(pixels);
}
/* A controller's buttons or sticks, used while a menu is up, hide the
cursor, and the mouse moved or clicked shows it again, so a player on a
controller has no arrow left over the menus; a menu opened while the
controller was used last opens without it
(platform_ui_pointer_set_active). */
static BOOL menu_cursor_controller;
static void menu_cursor_controller_used(BOOL in_menus)
{
menu_cursor_controller = TRUE;
if (in_menus && SDL_CursorVisible())
SDL_HideCursor();
}
static void menu_cursor_mouse_used(BOOL in_menus)
{
menu_cursor_controller = FALSE;
if (in_menus && !SDL_CursorVisible())
SDL_ShowCursor();
}
#endif
#endif
BOOL platform_video_initialize(unsigned long width, unsigned long height)
{
int version;
@@ -1097,6 +1210,16 @@ BOOL platform_video_initialize(unsigned long width, unsigned long height)
platform_log("cannot set the window's icon: %s", SDL_GetError());
SDL_DestroySurface(icon);
}
/* the pointer the menus show (platform_ui_pointer_set_active), in place
of the system's, at the window's size */
if (platform_menu_cursor_size && !menu_cursor_picture)
{
menu_cursor_picture = SDL_LoadPNG_IO(SDL_IOFromConstMem(platform_menu_cursor, platform_menu_cursor_size), true);
if (!menu_cursor_picture)
platform_log("cannot read the menus' cursor: %s", SDL_GetError());
}
menu_cursor_height = 0;
menu_cursor_fit();
#endif
platform_fullscreen_requested = platform_fullscreen_setting();
platform_window_mode = platform_display_mode();
@@ -1934,6 +2057,9 @@ void platform_pump_events(void)
halo_vr_frame_begin();
exit_after_check();
platform_show_pending_message();
#if !defined(HALO_ANDROID) && !defined(HALO_GLES)
menu_cursor_fit();
#endif
#ifndef HALO_ANDROID
updater_poll(platform_window);
/* (Settings > Audio's output device, as it changes: dsound_sdl.c) */
@@ -1999,6 +2125,13 @@ void platform_pump_events(void)
break;
case SDL_EVENT_MOUSE_MOTION:
#ifndef HALO_ANDROID
#ifndef HALO_GLES
/* (not the warps: to the middle as a menu opens, and back to
where the mouse is held without relative mode) */
if (input_state.ui_pointer ? event.motion.x != ui_pointer.x || event.motion.y != ui_pointer.y :
!mouse_warp_capture || (int)event.motion.x != mouse_warp_x || (int)event.motion.y != mouse_warp_y)
menu_cursor_mouse_used(input_state.ui_pointer);
#endif
if (scoreboard_pointer_active)
{
scoreboard_pointer.x = event.motion.x;
@@ -2028,6 +2161,10 @@ void platform_pump_events(void)
break;
case SDL_EVENT_MOUSE_BUTTON_DOWN:
case SDL_EVENT_MOUSE_BUTTON_UP:
#if !defined(HALO_ANDROID) && !defined(HALO_GLES)
if (event.button.down)
menu_cursor_mouse_used(input_state.ui_pointer);
#endif
if (event.button.button < 32)
{
if (event.button.down)
@@ -2197,6 +2334,17 @@ void platform_pump_events(void)
}
#endif
break;
#if !defined(HALO_ANDROID) && !defined(HALO_GLES)
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
menu_cursor_controller_used(input_state.ui_pointer);
break;
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
/* (past a stick's or trigger's rest, as gamepad_idle in
xinput_sdl.c has it) */
if (event.gaxis.value > 8000 || event.gaxis.value < -8000)
menu_cursor_controller_used(input_state.ui_pointer);
break;
#endif
case SDL_EVENT_GAMEPAD_REMOVED:
/* (SDL keeps a gamepad open until it is closed, even once the
controller has gone) */
@@ -2284,6 +2432,10 @@ void platform_ui_pointer_set_active(BOOL active)
memset(mouse_buttons_pressed, 0, sizeof(mouse_buttons_pressed));
pthread_mutex_unlock(&input_lock);
platform_mouse_capture(!active && !input_state.mouse_released);
#ifndef HALO_GLES
if (active && menu_cursor_controller)
SDL_HideCursor();
#endif
if (active)
{
int width, height;
+1 -1
View File
@@ -47,7 +47,7 @@ update.h's: posix_update.c on Linux, win32_update.c on Windows.
#endif
/* the VR port's own releases (the original's must not replace it) */
#define UPDATE_REPOSITORY "Cesarus85/ringfall-mjolnir-vr"
#define UPDATE_REPOSITORY "Cesarus85/mjolnir-vr"
#ifdef _WIN32
#define UPDATE_PLATFORM "windows"
#define PATH_SEPARATOR "\\"
+365 -10
View File
@@ -28,6 +28,9 @@ memory_watch.c detects that by write-protecting the pages.
#endif
#include <stdlib.h>
#include <string.h>
#ifdef HALO_ANDROID
#include "../game/android_ce_texture_cache.h"
#endif
#ifndef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83f1
@@ -547,6 +550,224 @@ static void dxt_decode_level(unsigned char kind, const unsigned char *source, un
}
}
}
#ifdef HALO_ANDROID
/* ---------- DXT1 as ASTC 4x4, for ES drivers with ASTC and no S3TC
A DXT1 block is two 565 colors and a 2-bit index for each texel, which an
ASTC 4x4 block holds nearly as it is: the colors as its endpoints, the
indices as its weights. So DXT1 needs no encoder here, only its bits moved,
and takes 8 bits a texel on the GPU instead of the 32 it is decoded to
(display.dxt1_astc). DXT3 and DXT5, whose alpha does not fit beside the
colors, are still decoded. A block is one of three kinds:
- four colors (c0 > c1): RGB endpoints of 8 bits and 2-bit weights, 0, 21,
43 and 64 sixty-fourths of the way (DXT's thirds within a 64th);
- three colors, none transparent: RGB endpoints of 8 bits and weights of
0, 32 and 64 (exact);
- three colors and transparent texels: two planes, the colors' weights and
alpha's (0 or 255), with RGBA endpoints of 7 bits, as many as the block
has room for; a transparent texel takes the darker color, where DXT's is
black.
(The layout: the Khronos Data Format Specification's "ASTC" chapter.) */
#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93b0
/* a field's bits written into the block from the bit given, lowest first;
or for weights (reversed), down from the block's top */
static void astc_bits(unsigned char block[16], unsigned long position, unsigned long count, unsigned long value,
BOOL reversed)
{
unsigned long bit;
for (bit = 0; bit < count; bit++)
{
unsigned long at = reversed ? 127 - (position + bit) : position + bit;
if ((value >> bit) & 1)
block[at >> 3] |= (unsigned char)(1 << (at & 7));
}
}
/* five trits from their 8 bits, as the specification unpacks them */
static void astc_trits_unpacked(unsigned long bits, unsigned char trits[5])
{
unsigned long c;
if (((bits >> 2) & 7) == 7)
{
c = (((bits >> 5) & 7) << 2) | (bits & 3);
trits[4] = 2;
trits[3] = 2;
}
else
{
c = bits & 0x1f;
if (((bits >> 5) & 3) == 3)
{
trits[4] = 2;
trits[3] = (unsigned char)((bits >> 7) & 1);
}
else
{
trits[4] = (unsigned char)((bits >> 7) & 1);
trits[3] = (unsigned char)((bits >> 5) & 3);
}
}
if ((c & 3) == 3)
{
trits[2] = 2;
trits[1] = (unsigned char)((c >> 4) & 1);
trits[0] = (unsigned char)((((c >> 3) & 1) << 1) | ((c >> 2) & 1 & ~(c >> 3)));
}
else if (((c >> 2) & 3) == 3)
{
trits[2] = 2;
trits[1] = 2;
trits[0] = (unsigned char)(c & 3);
}
else
{
trits[2] = (unsigned char)((c >> 4) & 1);
trits[1] = (unsigned char)((c >> 2) & 3);
trits[0] = (unsigned char)((((c >> 1) & 1) << 1) | (c & 1 & ~(c >> 1)));
}
}
/* the weights (0 to 2, count of them) as trits, packed five to 8 bits, the
last group with only the bits its trits need, from the block's top */
static void astc_trit_weights(unsigned char block[16], const unsigned char *weights, unsigned long count)
{
static unsigned char packed[243];
static BOOL made;
unsigned long group, position = 0;
if (!made)
{
static BOOL filled[243];
unsigned long bits;
/* (the smallest bits for each five, so that a last group's unused
trits, zero, need no bits) */
for (bits = 0; bits < 256; bits++)
{
unsigned char trits[5];
unsigned long index;
astc_trits_unpacked(bits, trits);
index = trits[0] + 3 * trits[1] + 9 * trits[2] + 27 * trits[3] + 81 * trits[4];
if (!filled[index])
{
filled[index] = TRUE;
packed[index] = (unsigned char)bits;
}
}
made = TRUE;
}
for (group = 0; group < count; group += 5)
{
static const unsigned char group_bits[6] = { 0, 2, 4, 5, 7, 8 };
unsigned long index = 0, scale = 1, trit, in_group = count - group < 5 ? count - group : 5;
for (trit = 0; trit < in_group; trit++, scale *= 3)
index += weights[group + trit] * scale;
astc_bits(block, position, group_bits[in_group], packed[index], TRUE);
position += group_bits[in_group];
}
}
/* one DXT1 block as ASTC 4x4 */
static void dxt1_astc_block(const unsigned char *source, unsigned char block[16])
{
unsigned long c0 = source[0] | (source[1] << 8), c1 = source[2] | (source[3] << 8);
unsigned long indices = source[4] | (source[5] << 8) | ((unsigned long)source[6] << 16) |
((unsigned long)source[7] << 24);
unsigned long endpoints[2][3], sums[2], channel, texel;
unsigned char weights[32];
BOOL four = c0 > c1, transparent = FALSE, swap;
unsigned long bits = 8, maximum = four ? 3 : 2;
/* (each index's weight from the first color: DXT's order is c0, c1,
then the colors between) */
static const unsigned char four_weights[4] = { 0, 3, 1, 2 }, three_weights[4] = { 0, 2, 1, 0 };
memset(block, 0, 16);
for (texel = 0; texel < 16; texel++)
transparent |= !four && ((indices >> (texel * 2)) & 3) == 3;
if (transparent)
bits = 7;
endpoints[0][0] = expand5(c0 >> 11);
endpoints[0][1] = expand6((c0 >> 5) & 0x3f);
endpoints[0][2] = expand5(c0 & 0x1f);
endpoints[1][0] = expand5(c1 >> 11);
endpoints[1][1] = expand6((c1 >> 5) & 0x3f);
endpoints[1][2] = expand5(c1 & 0x1f);
for (texel = 0; texel < 2; texel++)
{
sums[texel] = 0;
for (channel = 0; channel < 3; channel++)
{
/* (7 bits: the nearest the decoder's bit replication gives) */
if (bits == 7)
endpoints[texel][channel] = ((endpoints[texel][channel] >> 1) << 1) | (endpoints[texel][channel] >> 7);
sums[texel] += endpoints[texel][channel];
}
}
/* (the decoder swaps the endpoints, and blends blue into the others,
where the second's sum is less: the lesser comes first here instead) */
swap = sums[1] < sums[0];
for (texel = 0; texel < 16; texel++)
{
unsigned long index = (indices >> (texel * 2)) & 3;
unsigned char weight = four ? four_weights[index] : three_weights[index];
if (!four && index == 3)
weight = 0;
else if (swap)
weight = (unsigned char)(maximum - weight);
if (transparent)
{
weights[texel * 2] = weight;
weights[texel * 2 + 1] = index != 3 ? 2 : 0;
}
else
weights[texel] = weight;
}
/* the block mode (a 4x4 grid; 2-bit weights, trits, or trits on two
planes), one partition, and its color endpoint mode (RGB direct, or
RGBA direct) */
astc_bits(block, 0, 11, four ? 0x042 : transparent ? 0x451 : 0x051, FALSE);
astc_bits(block, 13, 4, transparent ? 12 : 8, FALSE);
for (channel = 0; channel < 3; channel++)
{
astc_bits(block, 17 + channel * 2 * bits, bits, endpoints[swap][channel] >> (8 - bits), FALSE);
astc_bits(block, 17 + (channel * 2 + 1) * bits, bits, endpoints[!swap][channel] >> (8 - bits), FALSE);
}
if (transparent)
{
/* (alpha 0 at the first endpoint and 255 at the second, and on the
second plane: the color component selector, below the weights) */
astc_bits(block, 17 + 7 * bits, bits, 0x7f, FALSE);
astc_bits(block, 128 - 52 - 2, 2, 3, FALSE);
astc_trit_weights(block, weights, 32);
}
else if (four)
{
for (texel = 0; texel < 16; texel++)
astc_bits(block, texel * 2, 2, weights[texel], TRUE);
}
else
astc_trit_weights(block, weights, 16);
}
static void dxt1_astc_level(const unsigned char *source, unsigned long width, unsigned long height,
unsigned char *blocks)
{
unsigned long block, count = ((width + 3) / 4) * ((height + 3) / 4);
for (block = 0; block < count; block++)
dxt1_astc_block(source + block * 8, blocks + block * 16);
}
#endif
#endif
static GLenum compressed_format(unsigned char kind)
@@ -624,6 +845,8 @@ static const unsigned char custom_edition_channel_sources[NUMBER_OF_CUSTOM_EDITI
{ 2, 1, 3, 0 },
/* the fill order in color, the shape in alpha */
{ 3, 3, 3, 0 },
/* Explicit Xbox-order HUD artwork must not be converted per draw. */
{ 0, 1, 2, 3 },
};
struct custom_edition_texels
@@ -636,6 +859,13 @@ static struct custom_edition_texels *custom_edition_texels;
static unsigned long custom_edition_texel_count;
static unsigned long custom_edition_texel_capacity;
static int custom_edition_hud_meter_active;
void halo_custom_edition_hud_meter(int active)
{
custom_edition_hud_meter_active = active;
}
/* the order of the texels at address */
static unsigned char custom_edition_texels_order(unsigned long address)
{
@@ -690,6 +920,7 @@ void halo_custom_edition_texels_channels(const void *texels, unsigned char chann
void halo_custom_edition_texels_forget(void)
{
custom_edition_hud_meter_active = 0;
free(custom_edition_texels);
custom_edition_texels = NULL;
custom_edition_texel_count = 0;
@@ -754,11 +985,27 @@ static void upload_texels(GLuint texture, GLenum target, const struct xgpu_textu
unsigned long largest = description->width * description->height * description->depth;
BOOL decode_compressed = FALSE;
unsigned long *converted;
unsigned char *astc = NULL;
unsigned long face, level;
#ifdef HALO_GLES
decode_compressed = description->compressed && !xgpu_capabilities.s3tc;
#endif
#ifdef HALO_ANDROID
/* (DXT1 as ASTC 4x4, its bits moved instead of decoded: dxt1_astc_block) */
if (decode_compressed && information.kind == _texel_dxt1 && target != GL_TEXTURE_3D &&
xgpu_capabilities.astc && config_boolean("display.dxt1_astc"))
{
astc = malloc(((description->width + 3) / 4) * ((description->height + 3) / 4) * 16);
if (!astc)
{
platform_log("textures: no memory to convert a %lux%lux%lu texture; it is not drawn",
description->width, description->height, description->depth);
return;
}
decode_compressed = FALSE;
}
#endif
#ifdef HALO_WEB
/* WebGL's S3TC takes 2D textures whose sides are multiples of 4; and a
texture whose channels are where Halo PC keeps them is decoded, to put
@@ -822,7 +1069,15 @@ static void upload_texels(GLuint texture, GLenum target, const struct xgpu_textu
GLsizei height = (GLsizei)level_dimension(description->height, level);
GLsizei depth = (GLsizei)level_dimension(description->depth, level);
if (description->compressed && !decode_compressed)
if (astc)
{
#ifdef HALO_ANDROID
dxt1_astc_level(source, (unsigned long)width, (unsigned long)height, astc);
glCompressedTexImage2D(image_target, (GLint)level, GL_COMPRESSED_RGBA_ASTC_4x4_KHR, width, height, 0,
(GLsizei)(((width + 3) / 4) * ((height + 3) / 4) * 16), astc);
#endif
}
else if (description->compressed && !decode_compressed)
{
if (target == GL_TEXTURE_3D)
glCompressedTexImage3D(image_target, (GLint)level, compressed_format(information.kind), width, height, depth, 0,
@@ -885,6 +1140,7 @@ static void upload_texels(GLuint texture, GLenum target, const struct xgpu_textu
}
}
free(converted);
free(astc);
texture_dump(target, description);
}
@@ -910,6 +1166,9 @@ struct texture_entry
memory watch serial read before it was found: the same while no watched
page has been written since (0: never found) */
unsigned long watched_serial, watched_generation;
#ifdef HALO_ANDROID
const void *ce_resource;
#endif
};
#define TEXTURE_BUCKET_COUNT 4096
@@ -932,6 +1191,9 @@ static struct
struct texture_entry *entry;
unsigned long watch_serial;
unsigned long drop_serial;
#ifdef HALO_ANDROID
const void *ce_resource;
#endif
} recent_textures[RECENT_TEXTURE_COUNT];
static unsigned long texture_drop_serial = 1;
static unsigned long texture_frame = 0;
@@ -964,6 +1226,58 @@ static unsigned long palette_hash(const D3DCOLOR *palette)
return hash ? hash : 1;
}
#ifdef HALO_ANDROID
void android_ce_texture_gpu_forget(const void *resource)
{
const DWORD *header = resource;
struct texture_entry **link = &texture_buckets[bucket_index(header[1], header[3], header[4])];
while (*link)
{
struct texture_entry *entry = *link;
if (entry->ce_resource == resource)
{
*link = entry->next;
glDeleteTextures(1, &entry->texture);
if (entry->hud_upscale)
glDeleteTextures(1, &entry->hud_upscale);
texture_drop_serial++;
free(entry);
}
else
link = &entry->next;
}
xgpu_gl_state_invalidate();
}
#endif
static BOOL texture_entry_pixels_valid(const struct texture_entry *entry)
{
#ifdef HALO_ANDROID
/* Registration and the allocation-length check at creation admit these
* pixels. Their owner removes the GPU entry before freeing the storage. */
if (entry->ce_resource)
return entry->size != 0;
#endif
return platform_is_contiguous((void *)entry->address) &&
platform_is_contiguous((void *)(entry->address + entry->size - 1));
}
/* display.high_res_hud, read again only when a setting changes: it is asked
at every bind, and config_boolean takes the settings' lock and looks the name
up among them all */
static BOOL high_res_hud(void)
{
static unsigned long read_at = (unsigned long)-1;
static BOOL enabled;
if (read_at != config_changes())
{
read_at = config_changes();
enabled = config_boolean("display.high_res_hud") != 0;
}
return enabled;
}
/* an entry's GL texture and description: its replacement's, if it has one,
with the bitmap's own size (which its coordinates are in) */
static GLuint texture_entry_result(struct texture_entry *entry, GLenum *target,
@@ -1018,20 +1332,21 @@ static GLuint texture_entry_result(struct texture_entry *entry, GLenum *target,
}
/* These sheets keep the map's art and coordinates. Decode through the
* normal format reader; the HUD module owns only the interpolation. */
if (config_boolean("display.high_res_hud"))
if (high_res_hud())
{
if (!entry->hud_upscale_checked)
{
long kind = hud_hires_upscale_at(entry->address, entry->description.width, entry->description.height);
entry->hud_upscale_checked = TRUE;
if (entry->size && !entry->description.compressed && entry->target == GL_TEXTURE_2D &&
/* Verified stock CE sheets also include compressed and 512-pixel atlases. */
if (entry->size && (!entry->description.compressed || kind == 4) && entry->target == GL_TEXTURE_2D &&
format_information(entry->description.format).kind != _texel_p8 &&
entry->description.width <= 256 && entry->description.height <= 256 &&
entry->description.width <= (kind == 4 ? 512 : 256) &&
entry->description.height <= (kind == 4 ? 512 : 256) &&
kind &&
custom_edition_texels_order(entry->address) == _custom_edition_channels_xbox &&
platform_is_contiguous((void *)entry->address) &&
platform_is_contiguous((void *)(entry->address + entry->size - 1)))
texture_entry_pixels_valid(entry))
{
unsigned long *pixels = malloc(entry->description.width * entry->description.height * 4);
@@ -1048,6 +1363,11 @@ static GLuint texture_entry_result(struct texture_entry *entry, GLenum *target,
return entry->hud_upscale;
}
}
/* Mixed-use CE sheets stay raw for ordinary artwork. Only a meter draw
reads their alpha as the threshold and red as the shape. Replacements
and sheets already converted above keep their existing channel order. */
description->ce_meter_channels = custom_edition_hud_meter_active &&
custom_edition_texels_order(entry->address) == _custom_edition_channels_xbox;
return entry->texture;
}
@@ -1066,11 +1386,19 @@ GLuint xgpu_texture_get(const DWORD *resource, const D3DCOLOR *palette, GLenum *
static int no_cache = -1;
unsigned long recent = bucket_index(data, format_word, size_word) % RECENT_TEXTURE_COUNT;
unsigned long watch_serial = memory_watch_serial();
#ifdef HALO_ANDROID
unsigned long ce_bytes;
const void *ce_pixels = android_ce_texture_pixels(resource, &ce_bytes);
const void *ce_resource = ce_pixels ? resource : NULL;
#endif
/* (a texture that is not palettized has the one entry, until one is
dropped: remembered, a page written since only means checking it) */
entry = NULL;
if (!palettized && recent_textures[recent].entry && recent_textures[recent].data == data &&
#ifdef HALO_ANDROID
recent_textures[recent].ce_resource == ce_resource &&
#endif
recent_textures[recent].format_word == format_word && recent_textures[recent].size_word == size_word &&
recent_textures[recent].drop_serial == texture_drop_serial)
{
@@ -1088,6 +1416,10 @@ GLuint xgpu_texture_get(const DWORD *resource, const D3DCOLOR *palette, GLenum *
{
if (entry->data == data && entry->format_word == format_word && entry->size_word == size_word)
{
#ifdef HALO_ANDROID
if (entry->ce_resource != ce_resource)
continue;
#endif
if (entry->palette_hash == hash)
break;
variant_count++;
@@ -1124,6 +1456,15 @@ GLuint xgpu_texture_get(const DWORD *resource, const D3DCOLOR *palette, GLenum *
byte counts would not fit in 32 bits) */
entry->size = texture_size_supported(&entry->description) ?
xgpu_texture_face_size(&entry->description) * (entry->description.cube_map ? 6 : 1) : 0;
#ifdef HALO_ANDROID
entry->ce_resource = ce_resource;
if (ce_resource)
{
entry->address = (unsigned long)ce_pixels;
if (entry->size > ce_bytes)
entry->size = 0;
}
#endif
if (!entry->size)
{
platform_log("textures: a %lux%lux%lu texture is larger than the device takes; it is not drawn",
@@ -1141,6 +1482,11 @@ GLuint xgpu_texture_get(const DWORD *resource, const D3DCOLOR *palette, GLenum *
/* (its pages' newest generation, found again only once a watched page
has been written: a large texture's pages, scanned for every draw that
bound it, were much of a frame with many objects) */
#ifdef HALO_ANDROID
if (entry->ce_resource)
generation = 1; /* Published CE map pixels do not change while resident. */
else
#endif
if (entry->watched_serial && entry->watched_serial == watch_serial)
generation = entry->watched_generation;
else
@@ -1152,8 +1498,15 @@ GLuint xgpu_texture_get(const DWORD *resource, const D3DCOLOR *palette, GLenum *
if (!entry->generation || generation > entry->generation || no_cache)
{
/* protect first, so a write racing with the upload is noticed */
memory_watch_protect(entry->address, entry->size);
entry->generation = memory_watch_generation(entry->address, entry->size);
#ifdef HALO_ANDROID
if (entry->ce_resource)
entry->generation = 1;
else
#endif
{
memory_watch_protect(entry->address, entry->size);
entry->generation = memory_watch_generation(entry->address, entry->size);
}
if (!entry->generation)
entry->generation = 1;
/* (which bitmap is here may have changed with the pixels) */
@@ -1175,8 +1528,7 @@ GLuint xgpu_texture_get(const DWORD *resource, const D3DCOLOR *palette, GLenum *
if (entry->override >= 0 && !hud_hires_override_texture(entry->override, &levels))
entry->override = -1;
}
if (entry->override < 0 && entry->size && platform_is_contiguous((void *)entry->address) &&
platform_is_contiguous((void *)(entry->address + entry->size - 1)))
if (entry->override < 0 && entry->size && texture_entry_pixels_valid(entry))
{
if (config_boolean("debug.texture_log"))
{
@@ -1207,6 +1559,9 @@ GLuint xgpu_texture_get(const DWORD *resource, const D3DCOLOR *palette, GLenum *
recent_textures[recent].entry = entry;
recent_textures[recent].watch_serial = watch_serial;
recent_textures[recent].drop_serial = texture_drop_serial;
#ifdef HALO_ANDROID
recent_textures[recent].ce_resource = ce_resource;
#endif
}
return texture_entry_result(entry, target, description);
}
+6
View File
@@ -21,6 +21,9 @@ struct xgpu_capabilities
BOOL border_clamp;
BOOL anisotropy;
BOOL s3tc;
/* KHR_texture_compression_astc_ldr: DXT1 as ASTC where there is no S3TC
(display.dxt1_astc) */
BOOL astc;
/* ES 3.2, or the EXT/OES_draw_elements_base_vertex extension: glDrawElementsBaseVertex */
BOOL base_vertex;
/* ES 3.1 with fragment atomic counters: exact visibility test counts */
@@ -213,6 +216,8 @@ struct nv2a_pixel_shader_key
/* Discrete meter thresholds in texture 0's red are read at level zero,
without filtering. Coverage/brightness still use the filtered lookup. */
unsigned char point_threshold;
/* A CE meter draw sampling a sheet also used as ordinary artwork. */
unsigned char ce_meter_channels;
/* a model lighting program's draw lit for each pixel
(display.per_pixel_lighting): nv2a_vertex_lighting's lights, or 0 for
the diffuse color the vertex shader computed */
@@ -273,6 +278,7 @@ struct xgpu_texture_description
BOOL hires; /* a high-res HUD texture drawn in the texture's place (hud_hires.h) */
BOOL hires_coverage; /* ... whose green is its coverage (a meter's) */
BOOL hires_point_threshold; /* ... whose red holds discrete segment data */
BOOL ce_meter_channels;
};
void xgpu_texture_describe(DWORD format_word, DWORD size_word, struct xgpu_texture_description *description);
+7
View File
@@ -1260,6 +1260,13 @@ long scenario_tags_load(
menu_tags_loaded(cache_file_globals.header.name);
}
/* port: register CE HUD bitmaps before mods replace their tags
(port/linux/game/hud_hires_tags.c), as for Xbox maps below. */
{
extern void hud_hires_tags_loaded(long scenario_index);
hud_hires_tags_loaded(cache_file_globals.tag_header->scenario_tag_index);
}
/* (and the mods' tags, as below) */
{
extern void mods_tags_loaded(char const *map_name);
+48
View File
@@ -122,6 +122,10 @@ symbols in this file:
#include <xtl.h>
#include "custom_edition_cache.h" /* port: port/linux/game/custom_edition_cache.c */
#ifdef HALO_ANDROID
#include "android_ce_texture_cache.h" /* port: port/linux/game/android_ce_texture_cache.c */
#endif
/* ---------- constants */
typedef char verify_xbox_texture_cache_size[
@@ -346,6 +350,10 @@ static unsigned long texture_cache_last_failure_time = 0;
void texture_cache_delete(
void)
{
#ifdef HALO_ANDROID
/* port: release CE heap pixels before their bitmap owners disappear. */
android_ce_texture_reset();
#endif
data_dispose(xbox_texture_cache_globals.textures);
lruv_delete(xbox_texture_cache_globals.cache);
@@ -363,6 +371,10 @@ void texture_cache_open(
void texture_cache_idle(
void)
{
#ifdef HALO_ANDROID
/* port: release the preceding frame's CE residency locks. */
android_ce_texture_idle();
#endif
lruv_idle(xbox_texture_cache_globals.cache);
return;
@@ -398,6 +410,10 @@ void texture_cache_bitmap_delete(
{
long cache_block_index;
#ifdef HALO_ANDROID
/* port: independent CE allocations have no Xbox LRU block index. */
android_ce_texture_delete(bitmap);
#endif
if (TEST_FLAG(bitmap->flags, _bitmap_cached_bit))
{
cache_block_index = bitmap->cache_block_index;
@@ -550,6 +566,10 @@ void texture_cache_flush(
{
IDirect3DDevice8_KickPushBuffer(global_d3d_device);
IDirect3DDevice8_IsBusy(global_d3d_device);
#ifdef HALO_ANDROID
/* port: include CE pixels in map unload, reload and explicit flush. */
android_ce_texture_reset();
#endif
lruv_flush(xbox_texture_cache_globals.cache);
return;
@@ -800,6 +820,21 @@ static boolean texture_cache_bitmap_valid(
return valid;
}
#ifdef HALO_ANDROID
/* port: CE/mod readers fill and convert pixels synchronously before the
* independent hardware header is published to the renderer. */
static void texture_cache_read_android_ce(struct bitmap_data *bitmap, void *header)
{
extern boolean mod_bitmaps_read(struct bitmap_data *bitmap, void *buffer);
boolean loaded = FALSE;
texture_cache_initialize_hardware_format(bitmap, header);
if (!mod_bitmaps_read(bitmap, bitmap->base_address))
cache_file_read(bitmap->tag_index, bitmap->pixels_offset, bitmap->pixels_size,
bitmap->base_address, &loaded, TRUE);
}
#endif
static boolean texture_cache_start_loading_bitmap(
struct bitmap_data *bitmap,
boolean block)
@@ -1015,6 +1050,19 @@ void *_texture_cache_bitmap_get_hardware_format(
"c:\\halo\\SOURCE\\cache\\xbox_texture_cache.c",
210,
load || !block);
#ifdef HALO_ANDROID
/* port: CE's frame working set is not bounded by the Xbox texture arena.
* Keep dynamic textures and Xbox maps on their own paths. */
if (custom_edition_cache_tags_loaded() &&
TEST_FLAG(bitmap->flags, _bitmap_cached_bit))
{
if (texture_cache_bitmap_valid(bitmap))
hardware_format = android_ce_texture_get(bitmap,
MAX(rasterizer_xbox_bitmap_get_pixel_data_size(bitmap), bitmap->pixels_size),
load, texture_cache_read_android_ce);
}
else
#endif
if (TEST_FLAG(bitmap->flags, _bitmap_cached_bit))
{
/* port: a cache block that isn't this bitmap's (a map's stale index)
+4
View File
@@ -44,6 +44,7 @@ symbols in this file:
#include "cseries.h"
#include "game/aim_assist.h"
#include "game_modes.h" /* port: port/linux/game/game_modes.c */
#include "camera/director.h"
#include "camera/observer.h"
@@ -511,6 +512,9 @@ boolean aim_assist(
short ignore_team_index,
struct aim_assist_target *target)
{
/* port: Hardcore has no aim assist: no autoaim, no magnetism */
if (game_modes_aim_assist_off())
return FALSE;
if (scenario_leaf_index_from_point(position)!=NONE)
{
short cluster_index= TAG_BLOCK_GET_ELEMENT(
+5
View File
@@ -120,6 +120,7 @@ struct game_options;
#include "cseries/cseries.h"
#include "game/game.h"
#include "game_modes.h" /* port: port/linux/game/game_modes.c */
#include "ai/ai.h"
#include "bink/bink_playback.h"
#include "bungie_net/network/transport.h"
@@ -491,7 +492,11 @@ void game_set_game_variant_options(
struct game_variant_options const *options)
{
if (options)
{
game_variant_options_global = *options;
/* port: OpenCE's options in range (another machine's: game_modes.c) */
game_modes_options_sanitize(&game_variant_options_global);
}
else
game_variant_options_default(&game_variant_global, &game_variant_options_global);
+53 -11
View File
@@ -537,6 +537,8 @@ symbols in this file:
/* ---------- headers */
#include "cseries.h"
#include "game_modes.h" /* port: port/linux/game/game_modes.c */
#include "infection.h" /* port: port/linux/game/infection.c */
#include "cseries_windows.h"
#include "errors.h"
#include "aim_assist.h"
@@ -1166,7 +1168,9 @@ static void game_engine_generate_title_string(
if (game_variant_options_get()->time_limit > 0 &&
game_engine_globals.postgame_state == game_engine_mode_active)
{
long left = game_variant_options_get()->time_limit * 60L * TICKS_PER_SECOND - game_time_get();
/* port: Infection's round's time starts after its countdown */
long left = infection_enabled() ? infection_remaining_ticks() :
game_variant_options_get()->time_limit * 60L * TICKS_PER_SECOND - game_time_get();
wchar_t time_string[32];
ticks_to_unicode_time_string(MAX(left, 0), NUMBEROF(time_string), time_string);
@@ -4204,6 +4208,8 @@ void game_variant_options_default(
_radar_players_none : _radar_players_all;
options->vehicle_set[0] = options->vehicle_set[1] =
variant ? (byte)variant->universal_variant.vehicle_set : 0;
/* port: OpenCE's gametypes' options at their defaults, with no mode */
game_modes_options_default(options);
return;
}
@@ -5063,6 +5069,8 @@ void game_engine_player_killed(
dead_player_index,
friendly_fire);
}
/* port: OpenCE's gametypes' (Hardcore's restore of the killer) */
game_modes_player_killed(killing_player_index, dead_player_index, friendly_fire);
same_player = killing_player_index == dead_player_index;
if (killing_player_index != NONE && dead_player_index != NONE)
@@ -5097,7 +5105,8 @@ void game_engine_player_killed(
moves the dead to the other team when his is two or more bigger (his
next unit is the other team's, which the clients take it from:
network_player_attach_unit) */
if (global_variant.universal_variant.teams && game_variant_options_get()->auto_team_balance &&
/* port: (not Infection's teams, which are its roles: infection.c) */
if (global_variant.universal_variant.teams && game_variant_options_get()->auto_team_balance && !infection_enabled() &&
!network_game_distributed_client() && VALID_INDEX(dead_player->team_index, 2) && !dead_player->quit_out_of_game)
{
struct data_iterator iterator;
@@ -5125,6 +5134,11 @@ void game_engine_player_killed(
}
}
/* port: Infection's respawn time (infection.c), the betrayal penalty's
after it */
if (infection_enabled())
dead_player->respawn_timer = game_variant_options_get()->infection_respawn_time * TICKS_PER_SECOND;
/* port: the gametype's friendly fire penalty: the team killer's next
respawn later (the dead's own, if he has one waiting) */
{
@@ -5143,7 +5157,9 @@ void game_engine_player_killed(
}
}
dead_player->respawn_timer = MAX(dead_player->respawn_timer, 90);
/* port: (Infection's respawn time may be shorter) */
if (!infection_enabled())
dead_player->respawn_timer = MAX(dead_player->respawn_timer, 90);
dead_player = player_get(dead_player_index);
if (!dead_player->quit_out_of_game)
@@ -5385,6 +5401,9 @@ boolean game_engine_hud_draw_motion_sensor(
default_draw_motion_sensor = FALSE;
draw_motion_sensor |= default_draw_motion_sensor;
/* port: Hardcore has none (port/linux/game/game_modes.c) */
if (game_modes_motion_sensor_hidden())
draw_motion_sensor = FALSE;
}
return draw_motion_sensor;
@@ -5623,6 +5642,9 @@ boolean game_engine_should_end_game(
{
boolean should_end_game = FALSE;
/* port: Infection's round ends by its own rules (infection.c) */
if (infection_enabled())
return FALSE;
if (game_engine && !multiple_teams_alive())
should_end_game = TRUE;
/* port: the gametype's time limit (game_variant_options) */
@@ -7408,8 +7430,12 @@ static void game_engine_predict_resources(
object_definition_predict(list_index_to_weapon_definition_index(_weapon_list_frag_grenade));
object_definition_predict(list_index_to_weapon_definition_index(_weapon_list_plasma_grenade));
if (global_variant.game_engine_index == game_engine_oddball)
/* port: (and Infection's zombies' skull) */
if (global_variant.game_engine_index == game_engine_oddball ||
game_modes_variant_mode(&global_variant, game_variant_options_get()) == _game_mode_infection)
{
object_definition_predict(list_index_to_weapon_definition_index(_weapon_list_ball));
}
if (global_variant.game_engine_index == game_engine_ctf)
object_definition_predict(list_index_to_weapon_definition_index(_weapon_list_flag));
@@ -7446,6 +7472,8 @@ void game_engine_initialize(
game_engine_variant_cleanup(&global_variant);
/* port: the cleaned variant's (the one given may be any number) */
game_engine = game_engines[global_variant.game_engine_index];
/* port: an OpenCE gametype's mode's (port/linux/game/game_modes.c) */
game_engine = game_modes_engine(game_engine);
}
return;
@@ -7739,16 +7767,24 @@ short game_engine_friendly_damage(
/* port: network co-op's friendly fire is Server Setup's FRIENDLY FIRE,
in the host's game settings (only the host deals damage), between its
players: their AI allies they always hurt, as in the campaign. Each
player also has a choice of their own (network_coop_players_friendly_fire) */
players. Each player also has a choice of their own
(network_coop_players_friendly_fire). Their AI allies they hurt as in the
campaign, or not at all with Server Setup's ALLY FRIENDLY FIRE off
(network_coop_ally_friendly_fire), so that no player can kill the allies
a level needs; the AI's own hits of its allies are the game's own */
if (network_coop_active())
{
struct network_game *game = network_game_get_game();
struct unit_datum *unit = (struct unit_datum *)object_try_and_get_and_verify_type(object_index,
_object_mask_unit);
if (!game || !unit || unit->unit.player_index == NONE)
if (!game || !unit)
return _friendly_damage_all;
if (unit->unit.player_index == NONE)
{
return attacker_player_index != NONE && !network_coop_ally_friendly_fire() ?
_friendly_damage_none : _friendly_damage_all;
}
if (!network_coop_players_friendly_fire(attacker_player_index, unit->unit.player_index))
return _friendly_damage_none;
friendly_fire = game->variant_options.friendly_fire;
@@ -9088,8 +9124,8 @@ static void handle_custom_starting_equipment(
/* port: a custom loadout's weapon's place in the globals' weapon list
(game_engine_h's _loadout_weapon_*, from the assault rifle); random: one
of those the map has */
static long game_engine_loadout_weapon_definition(
of those the map has (and port/linux/game/gun_game.c's weapons) */
long game_engine_loadout_weapon_definition(
byte weapon)
{
static short const list_indices[] =
@@ -9260,6 +9296,9 @@ void game_engine_postspawn_player_update(
(char)starting_plasma_grenade_count;
}
}
/* port: an OpenCE gametype's mode's equipment (Gun Game's weapon,
Infection's skull: port/linux/game/game_modes.c) */
game_modes_postspawn(player_index);
return;
}
@@ -9635,7 +9674,9 @@ long game_engine_write_network_state(
switch (game_engine_get_type())
{
case game_engine_ctf: written = game_engine_ctf_write_network_state(buffer, size); break;
case game_engine_slayer: written = game_engine_slayer_write_network_state(buffer, size); break;
/* port: (Infection's own state: infection.c) */
case game_engine_slayer: written = infection_enabled() ? infection_write_network_state(buffer, size) :
game_engine_slayer_write_network_state(buffer, size); break;
case game_engine_oddball: written = game_engine_oddball_write_network_state(buffer, size); break;
case game_engine_king: written = game_engine_king_write_network_state(buffer, size); break;
case game_engine_race: written = game_engine_race_write_network_state(buffer, size); break;
@@ -9662,7 +9703,8 @@ void game_engine_read_network_state(
switch (game_engine_get_type())
{
case game_engine_ctf: read = game_engine_ctf_read_network_state(buffer, size, first); break;
case game_engine_slayer: read = game_engine_slayer_read_network_state(buffer, size, first); break;
case game_engine_slayer: read = infection_enabled() ? infection_read_network_state(buffer, size, first) :
game_engine_slayer_read_network_state(buffer, size, first); break;
case game_engine_oddball: read = game_engine_oddball_read_network_state(buffer, size, first); break;
case game_engine_king: read = game_engine_king_read_network_state(buffer, size, first); break;
case game_engine_race: read = game_engine_race_read_network_state(buffer, size, first); break;
+47 -1
View File
@@ -212,6 +212,27 @@ enum
VARIANT_VEHICLE_SET_CUSTOM = 0xFF
};
/* port: OpenCE's gametypes (port/linux/game/game_modes.c): a mode's rules
over its game engine's (Slayer's), and Hardcore's over any */
enum
{
_game_mode_none = 0,
_game_mode_swat,
_game_mode_infection,
_game_mode_gun_game,
NUMBER_OF_GAME_MODES
};
enum
{
/* Gun Game's weapons: the strongest first, the weakest first, or in an
order the host draws for each game */
_gun_game_order_strongest_first = 0,
_gun_game_order_weakest_first,
_gun_game_order_random,
NUMBER_OF_GUN_GAME_ORDERS
};
/* (the starting equipment, generic or the map's, is the variant's own:
_game_variant_generic_starting_equipment_bit) */
struct game_variant_options
@@ -236,9 +257,30 @@ struct game_variant_options
/* no weapons spawn on the map (its grenades and powerups do): for
a loadout of none, melee only */
boolean no_map_weapons;
/* port: OpenCE's gametypes (game_modes.c): the mode (_game_mode_*), and
Hardcore's rules (no motion sensor, no aim assist, a kill restores the
killer's health and shields) */
byte mode;
boolean hardcore;
/* Infection: the zombies chosen at the start, their speed and their
skull's melee damage (percent), their respawn time and the countdown
before the first are chosen (seconds), and whether they have shields */
byte infection_initial_zombies;
byte infection_zombie_speed;
byte infection_skull_damage;
byte infection_respawn_time;
byte infection_countdown;
boolean infection_zombie_shields;
/* Gun Game: the weapons' order (_gun_game_order_*), and whether a melee
kill takes the victim back a weapon */
byte gun_game_order;
boolean gun_game_melee_demotes;
byte reserved[6];
};
typedef char verify_game_variant_options_size[sizeof(struct game_variant_options) == 0x1C ? 1 : -1];
typedef char verify_game_variant_options_size[sizeof(struct game_variant_options) == 0x2C ? 1 : -1];
/* (builds before OpenCE's gametypes saved and sent only the first 0x1C bytes) */
#define GAME_VARIANT_OPTIONS_V1_SIZE 0x1C
struct game_engine
{
@@ -369,6 +411,10 @@ void game_variant_options_default(
struct game_variant_options *options);
void game_engine_playlist_initialize(
void);
/* port: a loadout weapon's (_loadout_weapon_*) definition, NONE if the map
has none */
long game_engine_loadout_weapon_definition(
byte weapon);
long game_globals_get_weapon(
struct game_globals *game_globals,
+8
View File
@@ -402,6 +402,14 @@ static void slayer_engine_adjust_score(
return;
}
/* port: slayer_engine_adjust_score, for port/linux/game/gun_game.c */
void game_engine_slayer_adjust_score(
long player_index,
long score_delta)
{
slayer_engine_adjust_score(player_index, score_delta);
}
static void find_next_target(
long player_index)
{
+5
View File
@@ -15,6 +15,11 @@ GAME_ENGINE_SLAYER.H
void update_speed_for_score(
long dead_player_index,
long killing_player_index);
/* port: a player's score (and their team's) changed by the host
(port/linux/game/gun_game.c's melee demotion) */
void game_engine_slayer_adjust_score(
long player_index,
long score_delta);
/* ---------- globals */
+7 -2
View File
@@ -228,6 +228,7 @@ symbols in this file:
/* ---------- headers */
#include "cseries.h"
#include "infection.h" /* port: port/linux/game/infection.c */
#include "cseries/errors.h"
#include "cseries/profile.h"
#include "ai/ai.h"
@@ -1561,6 +1562,8 @@ void network_player_attach_unit(
unit->object.owner_team_index = (short)player->team_index;
unit->unit.player_index = player_index;
player->unit_index = unit_index;
/* port: Infection's role, which may have come before the unit */
infection_reconcile_player(player_index);
unit_set_actively_controlled(unit_index, TRUE);
if (player->local_player_index != NONE)
player_control_new_unit(player->local_player_index, unit_index);
@@ -4942,8 +4945,10 @@ void players_update_before_game(
unit_get(player->unit_index)->unit.current_weapon_index);
if (weapon_index != NONE && weapon_must_be_readied(weapon_index))
{
if (TEST_FLAG(action->control_flags, _unit_control_weapon_primary_trigger_bit) ||
TEST_FLAG(action->control_flags, _unit_control_weapon_secondary_trigger_bit))
/* port: (an Infection zombie keeps its skull: infection.c) */
if ((TEST_FLAG(action->control_flags, _unit_control_weapon_primary_trigger_bit) ||
TEST_FLAG(action->control_flags, _unit_control_weapon_secondary_trigger_bit)) &&
infection_allow_weapon_drop(player->unit_index, weapon_index))
{
unit_drop_current_weapon(player->unit_index, TRUE);
}
+13 -1
View File
@@ -201,6 +201,8 @@ long hs_players(
if (player->unit_index != NONE)
object_list_add(object_list_index, player->unit_index);
}
/* port: even an empty (players) list must not open a co-op gate. */
object_list_mark_players(object_list_index);
return object_list_index;
}
@@ -894,14 +896,24 @@ boolean hs_trigger_volume_test_objects_all(
long object_list_index)
{
boolean inside;
boolean waiting = hs_runtime_waiting_on_call();
/* port: an empty player list during respawn is not an arrival. Empty
AI lists retain the original ALL semantics. */
if (waiting && coop_scripts_empty_player_list(object_list_index))
return FALSE;
if (!coop_scripts_any_player_will_do(object_list_index))
return hs_trigger_volume_test_objects(trigger_volume_index, object_list_index, TRUE);
/* port: in network co-op, waiting for every player means waiting for
any one of them, and the rest are brought to them (coop_scripts.c) */
inside = hs_trigger_volume_test_objects(trigger_volume_index, object_list_index, FALSE);
if (inside && hs_runtime_waiting_on_call())
if (inside && waiting)
{
coop_scripts_gather_in_volume(trigger_volume_index, object_list_index);
/* port: gathering may fail or choose a point outside this volume.
Do not close an irreversible gate until everyone actually arrived. */
inside = hs_trigger_volume_test_objects(trigger_volume_index, object_list_index, TRUE);
}
return inside;
}
+18
View File
@@ -70,6 +70,8 @@ enum
player */
MAXIMUM_OBJECT_LISTS_PER_MAP = HALO_PORT_MAXIMUM_OBJECT_LISTS_PER_MAP,
MAXIMUM_LISTED_OBJECTS_PER_MAP = HALO_PORT_MAXIMUM_LISTED_OBJECTS_PER_MAP,
/* port: list provenance; does not change the header's size. */
_object_list_players_bit = 0,
};
/* ---------- macros */
@@ -131,12 +133,26 @@ long object_list_new(
{
struct object_list_header_datum* list = object_list_header_get(list_index);
list->count = 0;
list->flags = 0; /* port: a recycled slot has no previous provenance */
list->first_reference_index = NONE;
}
return list_index;
}
/* port: only hs_players marks its completed result. */
void object_list_mark_players(long list_index)
{
if (list_index != NONE)
SET_FLAG(object_list_header_get(list_index)->flags, _object_list_players_bit, TRUE);
}
boolean object_list_is_players(long list_index)
{
return list_index != NONE &&
TEST_FLAG(object_list_header_get(list_index)->flags, _object_list_players_bit);
}
void object_list_delete(
long list_index)
{
@@ -164,6 +180,8 @@ void object_list_add(
return;
list = object_list_header_get(object_list_index);
/* port: a changed list no longer has hs_players' provenance. */
list->flags = 0;
reference_list_add(object_list_data, &list->first_reference_index, object_index);
list->count++;
+4 -1
View File
@@ -19,7 +19,7 @@ OBJECT_LISTS.H
struct object_list_header_datum
{
short identifier;
word pad;
word flags; /* port: provenance, using the original unused word */
short reference_count;
short count;
long first_reference_index;
@@ -32,6 +32,9 @@ void object_lists_dispose(void);
void object_lists_initialize_for_new_map(void);
void object_lists_dispose_from_old_map(void);
long object_list_new(void);
/* port: distinguish an empty (players) result from an empty AI list. */
void object_list_mark_players(long list_index);
boolean object_list_is_players(long list_index);
void object_list_delete(long list_index);
void object_list_add(long object_list_index, long object_index);
long object_list_get_first(
+9
View File
@@ -1624,7 +1624,11 @@ static void hud_draw_bitmap_internal(
_shader_framebuffer_blend_function_alpha_multiply_add;
parameters.map[0] = (struct bitmap_data *)bitmap;
/* port: shared CE HUD sheets need meter channels only for this draw
(port/linux/src/xbox_textures.c), leaving their static artwork intact. */
halo_custom_edition_hud_meter(meter_parameters && custom_edition_cache_tags_loaded());
rasterizer_psuedo_dynamic_screen_quad_draw(&parameters, vertices);
halo_custom_edition_hud_meter(FALSE); /* port: end the CE meter draw scope */
match_assert_stack_frame("c:\\halo\\SOURCE\\interface\\hud_draw.c", 985);
@@ -1971,6 +1975,11 @@ void hud_draw_meter(
meter_parameters.tint_color = real_alpha_intensity_to_pixel32(
PIN(meter->fade, 0.0f, 1.0f),
PIN(1.0f-meter->opacity, 0.0f, 1.0f));
/* port: PC meter shading does not multiply the emitted color by
the Xbox opacity tint. Keep this compatibility limited to the CE
maps identified as depending on Gearbox meters. */
if (custom_edition_cache_relies_on(_custom_edition_behaviour_gearbox_meters))
meter_parameters.tint_color |= 0x00FFFFFF;
meter_parameters.gradient = 1.0f;
meter_parameters.flash_color_is_negative = FALSE;
meter_parameters.tint_mode_2 = TRUE;
+11 -2
View File
@@ -77,6 +77,7 @@ symbols in this file:
#include "tag_files/tag_groups.h"
#include "units/unit_definitions.h"
#include "units/units.h"
#include "custom_edition_hud.h" /* port: CE warning placement and reticle classification */
#include <math.h>
#include <string.h>
@@ -1370,10 +1371,17 @@ static void crosshairs_draw(
}
else
{
/* port: CE warnings retain HUD coordinates, independent
of the aiming reticle's FOV and passenger projection. */
struct hud_placement_definition placement = item->placement;
custom_edition_hud_warning_placement(state_index,
(short)(render.camera.window_bounds.x1 - render.camera.window_bounds.x0),
(short)(render.camera.window_bounds.y1 - render.camera.window_bounds.y0),
&placement);
hud_draw_bitmap(
bitmap,
&absolute_placement,
&item->placement,
&placement,
sequence ?
&TAG_BLOCK_GET_ELEMENT(&sequence->sprites, frame_index, struct bitmap_group_sprite)->bounds :
NULL,
@@ -1385,7 +1393,8 @@ static void crosshairs_draw(
/* port: a reticle, scaled with display.fov
(view_fov.c); a scope's picture keeps its
place */
state_index != _crosshair_state_zoom);
state_index != _crosshair_state_zoom &&
!custom_edition_hud_warning(state_index));
}
}
}
+4 -1
View File
@@ -220,6 +220,7 @@ symbols in this file:
#include "game/cheats.h"
#include "game/game.h"
#include "game/game_engine.h"
#include "infection.h" /* port: port/linux/game/infection.c */
#include "game/players.h"
#include "game/aim_assist.h" /* port: the reticle's read-only shot direction */
#include "interface/first_person_weapons.h"
@@ -923,7 +924,9 @@ void weapon_delete(
object_delete_initial_recursive) */
if (game_engine_running() && !network_objects_client_deleting())
{
match_assert("c:\\halo\\SOURCE\\items\\weapons.c", 234, !weapon_is_flag(weapon_index));
/* port: (but an Infection zombie's skull: infection.c) */
match_assert("c:\\halo\\SOURCE\\items\\weapons.c", 234,
!weapon_is_flag(weapon_index) || infection_can_delete_skull(weapon_index));
}
return;
+3
View File
@@ -383,6 +383,7 @@ symbols in this file:
#include "network_voice.h" /* port: port/linux/game/network_voice.c */
#include "network_chat.h" /* port: port/linux/game/network_chat.c */
#include "network_aim_assist.h" /* port: port/linux/game/network_aim_assist.c */
#include "network_shield_effects.h" /* port: port/linux/game/network_shield_effects.c */
#include "map_share.h" /* port: port/linux/game/map_share.c */
#include "profile_sections.h" /* port: port/linux/include/profile_sections.h */
#ifdef HALO_PROFILE
@@ -3566,6 +3567,8 @@ static boolean main_loop_iteration(
network_voice_update();
/* port: apply and replicate the host's mouse aim-assist policy. */
network_aim_assist_update();
/* port: the host's shield effects, for every machine (port/linux/game/network_shield_effects.c) */
network_shield_effects_update();
/* port: map sharing, in the lobby and in game (port/linux/game/map_share.c) */
map_share_update();
/* port: network games' text chat (port/linux/game/network_chat.c) */
+3
View File
@@ -48,6 +48,9 @@ enum
/* the players pass through each other (Server Setup's PLAYER COLLISIONS:
OFF, co-op's): network_coop_player_collisions */
_network_game_cooperative_no_player_collisions_bit = 0,
/* the players do their AI allies no harm (Server Setup's ALLY FRIENDLY
FIRE: OFF, co-op's): network_coop_ally_friendly_fire */
_network_game_cooperative_no_ally_friendly_fire_bit = 1,
};
struct network_game
Loaded 100 of 135 files, more files were not shown because too many files have changed in this diff. Show more