mirror of
https://github.com/Cesarus85/ringfall-mjolnir-vr.git
synced 2026-10-24 01:00:30 +02:00
Compare commits
27
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24ddaecd78 | ||
|
|
dedb3755d4 | ||
|
|
d86e8b01ee | ||
|
|
3a917551ca | ||
|
|
d17ecdd6ad | ||
|
|
3c7fe4594c | ||
|
|
63fd36775e | ||
|
|
83ae96e2d7 | ||
|
|
99c2030784 | ||
|
|
fbc71b42de | ||
|
|
cfb212fed9 | ||
|
|
782f4ce1bd | ||
|
|
f1066974ca | ||
|
|
384d9ba5d0 | ||
|
|
4cb621cd26 | ||
|
|
4ab042e144 | ||
|
|
962c3eca45 | ||
|
|
ef0e3be45b | ||
|
|
5744d2d174 | ||
|
|
9a1160573f | ||
|
|
1d38b3f936 | ||
|
|
0b3b6f0749 | ||
|
|
343716689d | ||
|
|
1ea29f7675 | ||
|
|
3975480a3b | ||
|
|
951b8387dd | ||
|
|
34c17f11fc |
No files matched your search
@@ -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
|
||||
|
||||
@@ -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) |
|
||||
|
||||
+22
-5
@@ -233,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
|
||||
|
||||
@@ -543,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
|
||||
@@ -572,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.
|
||||
@@ -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: 272 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 131 KiB |
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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}
|
||||
]
|
||||
}
|
||||
@@ -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"/>
|
||||
|
||||
+246
@@ -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>
|
||||
+17
@@ -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>
|
||||
+9
-8
@@ -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">
|
||||
|
||||
+3
-3
@@ -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>
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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",
|
||||
|
||||
+25
-1
@@ -238,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
|
||||
|
||||
+39
-6
@@ -377,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
|
||||
|
||||
@@ -437,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`. |
|
||||
@@ -480,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. |
|
||||
@@ -496,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. |
|
||||
@@ -1430,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. |
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
Executable
+130
@@ -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;
|
||||
}
|
||||
Executable
+22
@@ -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
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -2404,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
|
||||
@@ -3439,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)
|
||||
@@ -4658,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;
|
||||
@@ -5061,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 */
|
||||
@@ -5677,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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
@@ -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 },
|
||||
|
||||
@@ -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,42 @@ 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 */
|
||||
@@ -1041,13 +1339,14 @@ static GLuint texture_entry_result(struct texture_entry *entry, GLenum *target,
|
||||
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);
|
||||
|
||||
@@ -1064,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;
|
||||
}
|
||||
|
||||
@@ -1082,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)
|
||||
{
|
||||
@@ -1104,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++;
|
||||
@@ -1140,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",
|
||||
@@ -1157,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
|
||||
@@ -1168,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) */
|
||||
@@ -1191,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"))
|
||||
{
|
||||
@@ -1223,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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Vendored
+7
@@ -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);
|
||||
|
||||
Vendored
+48
@@ -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)
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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(¶meters, 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;
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4599,6 +4599,18 @@ void network_game_server_port_set_cooperative_player_collisions(
|
||||
network_event("network_game_server_port_set_cooperative_player_collisions() failed to send updated game settings to clients");
|
||||
}
|
||||
|
||||
void network_game_server_port_set_cooperative_ally_friendly_fire(
|
||||
boolean ally_friendly_fire)
|
||||
{
|
||||
struct network_game_server *server = global_network_game_server_get();
|
||||
|
||||
if (!server)
|
||||
return;
|
||||
SET_FLAG(server->game.cooperative_flags, _network_game_cooperative_no_ally_friendly_fire_bit, !ally_friendly_fire);
|
||||
if (server->state == _network_game_server_state_pregame && !network_game_server_send_game_data_pregame(server))
|
||||
network_event("network_game_server_port_set_cooperative_ally_friendly_fire() failed to send updated game settings to clients");
|
||||
}
|
||||
|
||||
/* port: a game a host runs afresh. A machine that asked to join as the last
|
||||
game ended, before the server switched to the pregame, is left waiting behind
|
||||
the one it holds (server->queued_player): the server refuses every later join
|
||||
|
||||
@@ -85,6 +85,10 @@ void network_game_server_port_set_cooperative_friendly_fire(
|
||||
PLAYER COLLISIONS), kept for the levels after */
|
||||
void network_game_server_port_set_cooperative_player_collisions(
|
||||
boolean player_collisions);
|
||||
/* port: whether co-op's players hurt their AI allies (Server Setup's ALLY
|
||||
FRIENDLY FIRE), kept for the levels after */
|
||||
void network_game_server_port_set_cooperative_ally_friendly_fire(
|
||||
boolean ally_friendly_fire);
|
||||
boolean network_game_server_ban_player(
|
||||
char const *text);
|
||||
/* port: the host's kick command: as the ban command, but nothing kept (no
|
||||
|
||||
+22
-6
@@ -103,6 +103,7 @@ symbols in this file:
|
||||
|
||||
#include "cseries.h"
|
||||
#include "damage.h"
|
||||
#include "game_modes.h" /* port: port/linux/game/game_modes.c */
|
||||
#include "ai/ai.h"
|
||||
#include "cseries/errors.h"
|
||||
#include "effects/effects.h"
|
||||
@@ -149,15 +150,20 @@ void network_damage_player_effect(long player_index, struct damage_data const *d
|
||||
void network_damage_aftermath(long object_index, struct damage_data const *damage, unsigned long being_damaged_flags,
|
||||
real shield_damage, real body_damage, real body_damage_multiplier, short body_part, short node_index,
|
||||
short region_index, short material_index, long victim_player_index);
|
||||
boolean network_damage_static_target(long object_index);
|
||||
|
||||
/* set while a distributed client carries out a kill it does not decide (an
|
||||
act of god: the host's word, network_distributed.c, or the world's) */
|
||||
static boolean distributed_damage_authorized;
|
||||
|
||||
/* whether this machine runs objects' shields (their stun, recharge and
|
||||
/* whether this machine runs the object's shields (their stun, recharge and
|
||||
overcharge): not a client of the distributed netcode, which has the host's
|
||||
(damage_set_network_state) */
|
||||
#define objects_update_shields() (!network_game_distributed_client())
|
||||
(damage_set_network_state), but for the map's scenery and devices that
|
||||
damage can break, whose damage every machine deals as the host did and of
|
||||
which the host sends no state (network_damage.c's static targets: a
|
||||
scenery's shield, broken, came back on no client) */
|
||||
#define objects_update_shields(object_index) \
|
||||
(!network_game_distributed_client() || network_damage_static_target(object_index))
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
@@ -1117,11 +1123,14 @@ static void object_damage_aftermath(
|
||||
being_damaged_flags,
|
||||
_object_being_damaged_body_depleted_bit))
|
||||
{
|
||||
/* port: whether it is a melee's (Gun Game's demotion: game_modes.c) */
|
||||
game_modes_kill_by_melee(damage_effect->damage.category == _damage_category_melee);
|
||||
game_statistics_record_kill(
|
||||
object_index,
|
||||
damage->owner_player_index,
|
||||
damage->owner_object_index,
|
||||
damage->owner_team_index);
|
||||
game_modes_kill_by_melee(FALSE);
|
||||
}
|
||||
}
|
||||
else if (game_engine_can_score())
|
||||
@@ -1230,7 +1239,14 @@ static void object_damage_body(
|
||||
{
|
||||
if (damage_amount > 0.f && TEST_FLAG(damage_material->flags, _damage_material_head_bit))
|
||||
{
|
||||
if (TEST_FLAG(damage_definition->flags, _damage_can_cause_headshots_bit))
|
||||
/* port: SWAT's headshots, a shot of any weapon's (game_modes.c) */
|
||||
if (TEST_FLAG(damage_definition->flags, _damage_can_cause_headshots_bit) ||
|
||||
game_modes_headshot_kills(object_index,
|
||||
damage_definition->category == _damage_category_bullet ||
|
||||
damage_definition->category == _damage_category_sniper ||
|
||||
damage_definition->category == _damage_category_plasma ||
|
||||
damage_definition->category == _damage_category_needle ||
|
||||
damage_definition->category == _damage_category_shotgun))
|
||||
{
|
||||
if (game_engine_running() ||
|
||||
object->object.type != _object_type_biped ||
|
||||
@@ -2033,10 +2049,10 @@ void object_damage_update(
|
||||
FLAG(_object_die_act_of_god_no_statistics_bit));
|
||||
}
|
||||
|
||||
if (objects_update_shields())
|
||||
if (objects_update_shields(object_index))
|
||||
SET_FLAG(object->object.damage_flags, _object_shield_charging_bit, FALSE);
|
||||
damage_flags = object->object.damage_flags;
|
||||
if (objects_update_shields() &&
|
||||
if (objects_update_shields(object_index) &&
|
||||
object->object.maximum_shield_vitality > 0.f &&
|
||||
!TEST_FLAG(damage_flags, _object_dead_bit))
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ OBJECTS.C
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "infection.h" /* port: port/linux/game/infection.c */
|
||||
#include "objects.h"
|
||||
#include "coop_pickups.h" /* port: the host's extra campaign pickups */
|
||||
#include "coop_vehicles.h" /* port: the host's extra campaign vehicles */
|
||||
@@ -1804,7 +1805,9 @@ static void object_delete_initial_recursive(
|
||||
network_objects.c's distributed_client_delete) */
|
||||
if (game_engine_running() && object->object.type == _object_type_weapon && !network_objects_client_deleting())
|
||||
{
|
||||
match_assert("c:\\halo\\SOURCE\\objects\\objects.c", 829, !(weapon_is_flag(object_index)));
|
||||
/* port: (but an Infection zombie's skull: infection.c) */
|
||||
match_assert("c:\\halo\\SOURCE\\objects\\objects.c", 829,
|
||||
!weapon_is_flag(object_index) || infection_can_delete_skull(object_index));
|
||||
}
|
||||
|
||||
if (object->object.first_child_object_index!=NONE)
|
||||
|
||||
@@ -84,6 +84,7 @@ symbols in this file:
|
||||
#include "saved games/saved_game_files.h"
|
||||
#include "tag_files/files.h"
|
||||
#include "game/game_engine_playlist.h"
|
||||
#include "game_modes.h" /* port: port/linux/game/game_modes.c */
|
||||
#include "text/text_group.h"
|
||||
#include "tag_files/tag_groups.h"
|
||||
/* the saved game file checksum is an XDK content signature. */
|
||||
@@ -100,7 +101,9 @@ enum
|
||||
which do not pass. */
|
||||
PLAYLIST_PROFILE_OPTIONS_OFFSET = 0x100,
|
||||
PLAYLIST_PROFILE_OPTIONS_MAGIC = 0x4F565047, /* 'GPVO' little-endian */
|
||||
PLAYLIST_PROFILE_OPTIONS_VERSION = 1,
|
||||
/* port: version 2 adds OpenCE's gametypes' options (game_engine.h's
|
||||
struct game_variant_options from mode on); version 1's are read too */
|
||||
PLAYLIST_PROFILE_OPTIONS_VERSION = 2,
|
||||
MAXIMUM_GAME_VARIANT_NAME_LENGTH = 12,
|
||||
NUMBER_OF_DEFAULT_PLAYLIST_PROFILES = 26,
|
||||
};
|
||||
@@ -124,6 +127,10 @@ struct playlist_profile_data
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
/* port: OpenCE's gametypes follow the Xbox's (game_modes.h) */
|
||||
typedef char verify_game_modes_first_default_playlist_profile[
|
||||
GAME_MODES_FIRST_DEFAULT_PLAYLIST_PROFILE == NUMBER_OF_DEFAULT_PLAYLIST_PROFILES ? 1 : -1];
|
||||
|
||||
typedef char verify_playlist_profile_building_functions_size[
|
||||
sizeof(((struct playlist_profile_data *)0)->
|
||||
default_variant_building_functions) == 0x68 ? 1 : -1];
|
||||
@@ -554,15 +561,25 @@ static void playlist_profile_create_default_profiles_on_disk(
|
||||
{
|
||||
long profile_index;
|
||||
|
||||
/* port: then OpenCE's gametypes (game_modes.c), with their options */
|
||||
for (profile_index = 0;
|
||||
profile_index < NUMBER_OF_DEFAULT_PLAYLIST_PROFILES;
|
||||
profile_index < NUMBER_OF_DEFAULT_PLAYLIST_PROFILES + game_modes_gametype_count();
|
||||
profile_index++)
|
||||
{
|
||||
wchar_t *display_name;
|
||||
wchar_t const *display_name;
|
||||
boolean file_written = FALSE;
|
||||
struct game_variant_options options;
|
||||
|
||||
variant = *playlist_profile_default_data.default_variant_building_functions[
|
||||
profile_index](&temporary);
|
||||
if (profile_index < NUMBER_OF_DEFAULT_PLAYLIST_PROFILES)
|
||||
{
|
||||
variant = *playlist_profile_default_data.default_variant_building_functions[
|
||||
profile_index](&temporary);
|
||||
}
|
||||
else
|
||||
{
|
||||
game_modes_gametype((short)(profile_index - NUMBER_OF_DEFAULT_PLAYLIST_PROFILES), &variant,
|
||||
&options);
|
||||
}
|
||||
|
||||
_snprintf(path, MAXIMUM_FILENAME_LENGTH, "z:\\saved\\playlists\\default_playlist\\%02d", profile_index);
|
||||
path[MAXIMUM_FILENAME_LENGTH] = 0;
|
||||
@@ -570,24 +587,32 @@ static void playlist_profile_create_default_profiles_on_disk(
|
||||
csstrncat(path, "\\blam.lst", MAXIMUM_FILENAME_LENGTH);
|
||||
path[MAXIMUM_FILENAME_LENGTH] = 0;
|
||||
|
||||
display_name = unicode_string_list_get_string(
|
||||
string_list_index,
|
||||
(short)profile_index);
|
||||
display_name = profile_index < NUMBER_OF_DEFAULT_PLAYLIST_PROFILES ?
|
||||
unicode_string_list_get_string(string_list_index, (short)profile_index) :
|
||||
game_modes_gametype_name((short)(profile_index - NUMBER_OF_DEFAULT_PLAYLIST_PROFILES));
|
||||
|
||||
/* port: the block cleared (the options' place, unless written below) */
|
||||
csmemset(block, 0, sizeof(block));
|
||||
csmemcpy(
|
||||
block,
|
||||
&variant,
|
||||
sizeof(struct game_variant));
|
||||
ustrncpy(
|
||||
(wchar_t *)block,
|
||||
display_name,
|
||||
MAXIMUM_GAME_VARIANT_NAME_LENGTH - 1);
|
||||
/* port: (OpenCE's have their own short names: game_modes.c) */
|
||||
if (profile_index < NUMBER_OF_DEFAULT_PLAYLIST_PROFILES)
|
||||
{
|
||||
ustrncpy(
|
||||
(wchar_t *)block,
|
||||
display_name,
|
||||
MAXIMUM_GAME_VARIANT_NAME_LENGTH - 1);
|
||||
}
|
||||
((struct game_variant *)block)->human_readable_game_description[MAXIMUM_GAME_VARIANT_NAME_LENGTH - 1] = 0;
|
||||
((struct game_variant *)block)->flags |= (short)(profile_index << 8);
|
||||
saved_game_file_generate_checksum(
|
||||
block,
|
||||
PLAYLIST_PROFILE_CHECKSUM_DATA_SIZE,
|
||||
(XCALCSIG_SIGNATURE *)(block + PLAYLIST_PROFILE_CHECKSUM_DATA_SIZE));
|
||||
if (profile_index >= NUMBER_OF_DEFAULT_PLAYLIST_PROFILES)
|
||||
playlist_profile_options_to_block(block, &options);
|
||||
|
||||
if (file_reference_create_from_path(&file, path, FALSE) &&
|
||||
file_create(&file) &&
|
||||
@@ -907,15 +932,20 @@ static boolean playlist_profile_options_from_block(
|
||||
XCALCSIG_SIGNATURE checksum;
|
||||
|
||||
csmemcpy(&header, data, sizeof(header));
|
||||
if (header.magic != PLAYLIST_PROFILE_OPTIONS_MAGIC || header.version != PLAYLIST_PROFILE_OPTIONS_VERSION ||
|
||||
header.size != sizeof(*options))
|
||||
if (header.magic != PLAYLIST_PROFILE_OPTIONS_MAGIC ||
|
||||
(!(header.version == PLAYLIST_PROFILE_OPTIONS_VERSION && header.size == sizeof(*options)) &&
|
||||
!(header.version == 1 && header.size == GAME_VARIANT_OPTIONS_V1_SIZE)))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
size = sizeof(header) + header.size;
|
||||
saved_game_file_generate_checksum((byte *)data, size, &checksum);
|
||||
if (csmemcmp(&checksum, data + size, sizeof(checksum)))
|
||||
return FALSE;
|
||||
csmemcpy(options, data + sizeof(header), sizeof(*options));
|
||||
/* (version 1's: none of OpenCE's gametypes, their options the defaults) */
|
||||
game_modes_options_default(options);
|
||||
csmemcpy(options, data + sizeof(header), header.size);
|
||||
game_modes_options_sanitize(options);
|
||||
options->friendly_fire = (short)PIN(options->friendly_fire, 0, NUMBER_OF_FRIENDLY_FIRE_MODES - 1);
|
||||
options->radar_players = (byte)PIN(options->radar_players, 0, NUMBER_OF_RADAR_PLAYERS - 1);
|
||||
options->loadout = (byte)PIN(options->loadout, 0, NUMBER_OF_LOADOUTS - 1);
|
||||
|
||||
@@ -322,6 +322,7 @@ symbols in this file:
|
||||
#include "saved games/playlist_profile.h"
|
||||
#include "interface/player_ui.h"
|
||||
#include "text/text_group.h"
|
||||
#include "game_modes.h" /* port: port/linux/game/game_modes.c */
|
||||
#include "tag_files/tag_groups.h"
|
||||
/* the saved game file checksum is an XDK content signature, and enumerated
|
||||
saved game metadata is created/deleted through the XDK save game API. */
|
||||
@@ -2256,7 +2257,10 @@ static short enumerate_default_playlist_profiles(
|
||||
{
|
||||
while (profile_index < number_of_profiles)
|
||||
{
|
||||
wchar_t *display_name = unicode_string_list_get_string(string_list_index, profile_index);
|
||||
/* port: past the Xbox's, OpenCE's gametypes (game_modes.c) */
|
||||
wchar_t const *display_name = profile_index < GAME_MODES_FIRST_DEFAULT_PLAYLIST_PROFILE ?
|
||||
unicode_string_list_get_string(string_list_index, profile_index) :
|
||||
game_modes_gametype_name((short)(profile_index - GAME_MODES_FIRST_DEFAULT_PLAYLIST_PROFILE));
|
||||
|
||||
_snprintf(path, MAXIMUM_FILENAME_LENGTH, "z:\\saved\\playlists\\default_playlist\\%02d\\blam.lst", profile_index);
|
||||
|
||||
|
||||
+23
-1
@@ -644,6 +644,7 @@ symbols in this file:
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "infection.h" /* port: port/linux/game/infection.c */
|
||||
#include "units.h"
|
||||
|
||||
#include "bipeds.h"
|
||||
@@ -2163,6 +2164,10 @@ boolean unit_add_grenade_to_inventory(
|
||||
boolean result = FALSE;
|
||||
static boolean grenade_type_reported = FALSE;
|
||||
|
||||
/* port: an Infection zombie takes no grenades */
|
||||
if (infection_unit_is_zombie(unit_index))
|
||||
return FALSE;
|
||||
|
||||
match_assert(
|
||||
"c:\\halo\\SOURCE\\units\\units.c",
|
||||
7282,
|
||||
@@ -2226,6 +2231,9 @@ boolean unit_add_equipment_to_inventory(
|
||||
7330,
|
||||
equipment_definition->equipment.powerup_type!=_equipment_powerup_grenade);
|
||||
|
||||
/* port: nor powerups */
|
||||
if (infection_unit_is_zombie(unit_index))
|
||||
return FALSE;
|
||||
if (unit->unit.equipment_object_index!=NONE && replace==TRUE)
|
||||
{
|
||||
object_delete(unit->unit.equipment_object_index);
|
||||
@@ -3077,6 +3085,9 @@ boolean unit_enter_seat(
|
||||
{
|
||||
boolean result = FALSE;
|
||||
|
||||
/* port: and fights on foot */
|
||||
if (infection_unit_is_zombie(unit_index))
|
||||
return FALSE;
|
||||
if (unit_can_enter_seat(unit_index, target_unit_index, seat_index, NULL))
|
||||
{
|
||||
struct unit_datum *unit = unit_get(unit_index);
|
||||
@@ -7789,8 +7800,13 @@ boolean unit_drop_selected_weapon(
|
||||
TEST_FLAG(weapon_definition_get(weapon_get(weapon_index)->definition_index)->weapon.flags,
|
||||
_weapon_doesnt_count_toward_maximum_bit))
|
||||
{
|
||||
/* port: (an Infection zombie keeps its skull: infection.c) */
|
||||
if (!infection_allow_weapon_drop(unit_index, unit_get_current_weapon_index(unit_index)))
|
||||
return FALSE;
|
||||
return unit_drop_current_weapon(unit_index, TRUE);
|
||||
}
|
||||
if (!infection_allow_weapon_drop(unit_index, weapon_index))
|
||||
return FALSE;
|
||||
unit_drop_item(unit_index, weapon_index);
|
||||
unit->unit.weapon_object_indices[slot] = NONE;
|
||||
unit->unit.desired_weapon_index = unit->unit.current_weapon_index!=NONE ?
|
||||
@@ -9127,8 +9143,11 @@ void unit_cause_player_melee_damage(
|
||||
long hit_object_index = collision.object_index;
|
||||
struct object_datum *hit_object = object_get(hit_object_index);
|
||||
|
||||
/* port: (an Infection zombie's skull hits a rider in an open
|
||||
seat itself: infection.c) */
|
||||
if (hit_object->object.type!=_object_type_weapon &&
|
||||
hit_object->object.parent_object_index!=NONE)
|
||||
hit_object->object.parent_object_index!=NONE &&
|
||||
!infection_melee_rider_target(unit_index, hit_object_index))
|
||||
{
|
||||
hit_object_index = hit_object->object.parent_object_index;
|
||||
hit_object = object_get(hit_object_index);
|
||||
@@ -9238,6 +9257,9 @@ void unit_cause_player_melee_damage(
|
||||
struct damage_data damage_data;
|
||||
|
||||
damage_data_new(&damage_data, melee_damage_effect_index);
|
||||
/* port: an Infection zombie's skull's (a client's report the host
|
||||
works out again: network_damage.c) */
|
||||
damage_data.multiplier = infection_melee_multiplier(unit_index);
|
||||
SET_FLAG(damage_data.flags, _damage_area_of_effect_bit, TRUE);
|
||||
damage_data.location = unit->object.location;
|
||||
damage_data.owner_object_index = unit_index;
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
"""Pack existing OpenCE redraws into CE sprite rectangles.
|
||||
|
||||
The committed recipe contains coordinates only. Build needs no game data:
|
||||
python tools/ce_hud_assets.py build
|
||||
"""
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from PIL import Image
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
ASSETS = ROOT / 'port/assets/hud'
|
||||
RECIPE = ASSETS / 'ce_layout.json'
|
||||
|
||||
|
||||
def build_asset(entry):
|
||||
if not 0 < entry['width'] * entry['scale'] <= 2048 or not 0 < entry['height'] * entry['scale'] <= 2048:
|
||||
raise ValueError('CE HUD atlas exceeds texture bounds')
|
||||
image = Image.new('RGBA', (entry['width'] * entry['scale'], entry['height'] * entry['scale']))
|
||||
for cell in entry['cells']:
|
||||
with Image.open(ASSETS / (cell['source'] + '.png')) as source:
|
||||
l, t, r, b = cell['from']
|
||||
if not 0 <= l < r <= source.width or not 0 <= t < b <= source.height:
|
||||
raise ValueError('source rectangle outside redraw')
|
||||
crop = source.crop(cell['from'])
|
||||
rect = [round(v * entry['scale']) for v in cell['to']]
|
||||
if not 0 <= rect[0] < rect[2] <= image.width or not 0 <= rect[1] < rect[3] <= image.height:
|
||||
raise ValueError('destination rectangle outside CE atlas')
|
||||
size = (rect[2] - rect[0], rect[3] - rect[1])
|
||||
# Meter red is categorical threshold data, never interpolate it.
|
||||
resized = crop.resize(size, Image.Resampling.BICUBIC)
|
||||
if entry.get('point_threshold'):
|
||||
channels = list(resized.split())
|
||||
channels[0] = crop.getchannel('R').resize(size, Image.Resampling.NEAREST)
|
||||
resized = Image.merge('RGBA', channels)
|
||||
image.paste(resized, rect[:2])
|
||||
return image
|
||||
|
||||
|
||||
def build():
|
||||
for entry in json.loads(RECIPE.read_text())['assets']:
|
||||
build_asset(entry).save(ASSETS / (entry['name'] + '.png'), optimize=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('command', choices=['build'])
|
||||
parser.parse_args()
|
||||
build()
|
||||
@@ -0,0 +1,102 @@
|
||||
"""Record stock CE HUD fingerprints without distributing game pixels.
|
||||
|
||||
Run with an unmodified Custom Edition bitmaps.map. Only the existing layout
|
||||
allowlist is updated. Runtime pixels use rasterizer_swizzle.c's Morton order
|
||||
for uncompressed power-of-two textures; compressed blocks remain unchanged.
|
||||
"""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import struct
|
||||
import zlib
|
||||
|
||||
LISTING = Path(__file__).resolve().parents[1] / "port/assets/hud/custom_edition.json"
|
||||
|
||||
|
||||
def region(data, offset, size):
|
||||
if offset < 0 or size < 0 or offset > len(data) - size:
|
||||
raise ValueError("bitmap resource range outside file")
|
||||
return data[offset:offset + size]
|
||||
|
||||
|
||||
def fingerprint(data, item, index):
|
||||
count, offset = struct.unpack("<II", region(item, 0x60, 8))
|
||||
if not 0 <= index < count:
|
||||
raise ValueError("bitmap index outside group")
|
||||
bitmap = region(item, offset + index * 48, 48)
|
||||
width, height, depth, kind, fmt, flags = struct.unpack_from("<6H", bitmap, 4)
|
||||
start, stored_size = struct.unpack_from("<II", bitmap, 0x18)
|
||||
if kind or depth != 1 or not 0 < width <= 4096 or not 0 < height <= 4096:
|
||||
raise ValueError("expected a 2D HUD bitmap")
|
||||
compressed = fmt in (14, 15, 16)
|
||||
if compressed:
|
||||
size = max(1, (width + 3) // 4) * max(1, (height + 3) // 4) * (8 if fmt == 14 else 16)
|
||||
else:
|
||||
bpp = {0: 1, 1: 1, 2: 1, 3: 2, 6: 2, 8: 2, 9: 2, 10: 4, 11: 4}[fmt]
|
||||
size = width * height * bpp
|
||||
if size > stored_size:
|
||||
raise ValueError("first mip exceeds stored pixels")
|
||||
pixels = region(data, start, size)
|
||||
if not compressed:
|
||||
if flags & 16:
|
||||
pitch = (width * bpp + 63) & ~63
|
||||
pixels = b"".join(pixels[y * width * bpp:(y + 1) * width * bpp] +
|
||||
bytes(pitch - width * bpp) for y in range(height))
|
||||
else:
|
||||
if width & (width - 1) or height & (height - 1):
|
||||
raise ValueError("non-power-of-two swizzled bitmap")
|
||||
ordered = bytearray(size)
|
||||
for y in range(height):
|
||||
for x in range(width):
|
||||
dest = shift = 0
|
||||
for bit in range(max(width, height).bit_length() - 1):
|
||||
if (1 << bit) < width:
|
||||
dest |= ((x >> bit) & 1) << shift
|
||||
shift += 1
|
||||
if (1 << bit) < height:
|
||||
dest |= ((y >> bit) & 1) << shift
|
||||
shift += 1
|
||||
src = (y * width + x) * bpp
|
||||
ordered[dest * bpp:(dest + 1) * bpp] = pixels[src:src + bpp]
|
||||
pixels = ordered
|
||||
return dict(width=width, height=height, size=len(pixels), crc=zlib.crc32(pixels))
|
||||
|
||||
|
||||
def update(resource, listing):
|
||||
data = resource.read_bytes()
|
||||
kind, names, index, count = struct.unpack("<4I", region(data, 0, 16))
|
||||
if kind != 1:
|
||||
raise ValueError("not a bitmap resource map")
|
||||
entries = region(data, index, count * 12)
|
||||
items = {}
|
||||
for i in range(count):
|
||||
name, size, offset = struct.unpack_from("<3I", entries, i * 12)
|
||||
start = names + name
|
||||
region(data, start, 1)
|
||||
end = data.find(b"\0", start, min(start + 1024, len(data)))
|
||||
if end < 0:
|
||||
raise ValueError("unterminated resource name")
|
||||
items[data[start:end].decode("ascii")] = (offset, size)
|
||||
result = json.loads(listing.read_text())
|
||||
for entry in result.get("assets", result.get("bitmaps", [])):
|
||||
offset, size = items[entry["tag"]]
|
||||
entry.update(fingerprint(data, region(data, offset, size), entry["bitmap"]))
|
||||
result["resource_sha256"] = hashlib.sha256(data).hexdigest()
|
||||
lines = []
|
||||
for key, value in result.items():
|
||||
text = json.dumps(key) + ": "
|
||||
if isinstance(value, list):
|
||||
text += "[\n" + ",\n".join(" " + json.dumps(entry) for entry in value) + "\n ]"
|
||||
else:
|
||||
text += json.dumps(value)
|
||||
lines.append(" " + text)
|
||||
listing.write_text("{\n" + ",\n".join(lines) + "\n}\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("resource", type=Path)
|
||||
parser.add_argument("--listing", type=Path, default=LISTING)
|
||||
args = parser.parse_args()
|
||||
update(args.resource, args.listing)
|
||||
@@ -74,6 +74,12 @@ LEFT_OUT = {
|
||||
# below Co-op, keeping its 32-unit highlight inside the description panel's
|
||||
# bottom curve (port_settings.WIDGET_PATCHES)
|
||||
CHILD_OFFSETS = {
|
||||
# Player Options' rows 27 apart, not 30, so that the host's AIM ASSIST and
|
||||
# SHIELD EFFECTS fit below them and above the help, which some fill with
|
||||
# three lines (port_settings.WIDGET_PATCHES)
|
||||
**{("ui\\shell\\main_menu\\settings_select\\multiplayer_setup\\player_options_edit\\player_options_menu",
|
||||
f"ui\\shell\\main_menu\\settings_select\\multiplayer_setup\\player_options_edit\\op_{row}"): (54, 73 + 27 * index)
|
||||
for index, row in enumerate(port_settings.PLAYER_OPTIONS_ROWS)},
|
||||
("ui\\shell\\main_menu\\main_menu_select_list", "ui\\shell\\main_menu\\main_menu_item_quit_game"):
|
||||
port_settings.QUIT_ITEM_PLACE,
|
||||
("ui\\shell\\main_menu\\multiplayer_type_select\\multiplayer_type_select_list",
|
||||
|
||||
+22
-8
@@ -34,6 +34,8 @@ from typing import Any, List
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
HUD_ASSETS = Path("port/assets/hud")
|
||||
LAYOUT = HUD_ASSETS / "layout.json"
|
||||
CE_LAYOUT = HUD_ASSETS / "ce_layout.json"
|
||||
CE_STOCK = HUD_ASSETS / "ce_stock.json"
|
||||
# the HUD textures whose bitmaps Halo Custom Edition lays out alike
|
||||
CUSTOM_EDITION_HUD = HUD_ASSETS / "custom_edition.json"
|
||||
TITLE_ASSETS = Path("port/assets/titles")
|
||||
@@ -69,7 +71,7 @@ def textures() -> List[tuple]:
|
||||
text)."""
|
||||
result = []
|
||||
for folder, listing, title in ((HUD_ASSETS, LAYOUT, False), (TITLE_ASSETS, TITLE_LIST, True),
|
||||
(BUTTON_ASSETS, BUTTON_LIST, True)):
|
||||
(BUTTON_ASSETS, BUTTON_LIST, True), (HUD_ASSETS, CE_LAYOUT, False)):
|
||||
if (ROOT / listing).is_file():
|
||||
result += [(folder, asset, title) for asset in json.loads((ROOT / listing).read_text())["assets"]]
|
||||
return result
|
||||
@@ -89,7 +91,7 @@ def smaa_files() -> List[tuple]:
|
||||
|
||||
def hud_asset_inputs() -> List[Path]:
|
||||
"""The files the generated source is made from."""
|
||||
inputs = [listing for listing in (LAYOUT, CUSTOM_EDITION_HUD, TITLE_LIST, BUTTON_LIST, FONT_LIST, MENU_LIST)
|
||||
inputs = [listing for listing in (LAYOUT, CE_LAYOUT, CE_STOCK, CUSTOM_EDITION_HUD, TITLE_LIST, BUTTON_LIST, FONT_LIST, MENU_LIST)
|
||||
if (ROOT / listing).is_file()]
|
||||
return [*inputs, *(folder / f"{asset['name']}.png" for folder, asset, _ in textures()),
|
||||
*(FONT_ASSETS / name for name in font_files()), *(MENU_ASSETS / name for name in menu_files()),
|
||||
@@ -103,7 +105,7 @@ def hud_configure_inputs() -> List[Path]:
|
||||
folders, for files added or removed), not each file, which a change of a
|
||||
list may rename or remove."""
|
||||
inputs = []
|
||||
for folder, listing in ((HUD_ASSETS, LAYOUT), (TITLE_ASSETS, TITLE_LIST), (BUTTON_ASSETS, BUTTON_LIST),
|
||||
for folder, listing in ((HUD_ASSETS, LAYOUT), (HUD_ASSETS, CE_LAYOUT), (TITLE_ASSETS, TITLE_LIST), (BUTTON_ASSETS, BUTTON_LIST),
|
||||
(FONT_ASSETS, FONT_LIST), (MENU_ASSETS, MENU_LIST)):
|
||||
if (ROOT / listing).is_file():
|
||||
inputs += [folder, listing]
|
||||
@@ -155,9 +157,9 @@ def main() -> None:
|
||||
"",
|
||||
]
|
||||
table = []
|
||||
custom_edition = set()
|
||||
custom_edition = {}
|
||||
if (ROOT / CUSTOM_EDITION_HUD).is_file():
|
||||
custom_edition = {(entry["tag"], entry["bitmap"])
|
||||
custom_edition = {(entry["tag"], entry["bitmap"]): entry
|
||||
for entry in json.loads((ROOT / CUSTOM_EDITION_HUD).read_text())["assets"]}
|
||||
for index, (folder, asset, title) in enumerate(textures()):
|
||||
name = f"{asset['name']}.png"
|
||||
@@ -171,16 +173,20 @@ def main() -> None:
|
||||
lines.append("};")
|
||||
lines.append("")
|
||||
tag = asset["tag"].replace("\\", "\\\\")
|
||||
coverage = int(any(cell["kind"] == "meter" for cell in asset.get("cells", [])))
|
||||
point_threshold = int(any(cell.get("thresholds") for cell in asset.get("cells", [])))
|
||||
coverage = int(asset.get("coverage", False) or any(cell.get("kind") == "meter" for cell in asset.get("cells", [])))
|
||||
point_threshold = int(asset.get("point_threshold", False) or any(cell.get("thresholds") for cell in asset.get("cells", [])))
|
||||
# (the sequences whose sprites it stands for, a bit each of 32; 0: the whole bitmap)
|
||||
sequences = [sprite["sequence"] for sprite in asset.get("sprites", [])]
|
||||
if any(not 0 <= sequence < 32 for sequence in sequences):
|
||||
sys.exit(f"{name}: sprite sequences must be 0 to 31 (hud_hires.h: sprites)")
|
||||
sprites = sum(1 << sequence for sequence in sequences)
|
||||
ce = custom_edition.get((asset["tag"], asset["bitmap"]), {})
|
||||
if ce.get("replacement", asset["name"]) != asset["name"]:
|
||||
ce = {}
|
||||
table.append(f'\t{{ "{tag}", {asset["bitmap"]}, {width}, {height}, 0x{asset["crc"]:08x}u, {coverage}, '
|
||||
f'{point_threshold}, {int(title)}, 0x{sprites:x}u, '
|
||||
f'{int((asset["tag"], asset["bitmap"]) in custom_edition)}, asset{index}, {len(data)} }},')
|
||||
f'{int(bool(ce))}, {int(asset.get("ce_only", False))}, {ce.get("width", 0)}, {ce.get("height", 0)}, '
|
||||
f'{ce.get("size", 0)}, 0x{ce.get("crc", 0):08x}u, asset{index}, {len(data)} }},')
|
||||
lines.append("const struct hud_hires_embedded hud_hires_embedded[] =")
|
||||
lines.append("{")
|
||||
lines.extend(table)
|
||||
@@ -188,6 +194,14 @@ def main() -> None:
|
||||
lines.append("\t{ 0 },")
|
||||
lines.append("};")
|
||||
lines.append(f"const unsigned int hud_hires_embedded_count = {len(table)};")
|
||||
stock = json.loads((ROOT / CE_STOCK).read_text())["bitmaps"]
|
||||
lines.append("const struct hud_hires_ce_stock hud_hires_ce_stock[] = {")
|
||||
for item in stock:
|
||||
tag = item['tag'].replace('\\', '\\\\')
|
||||
lines.append(f'\t{{ "{tag}", {item["bitmap"]}, {item["width"]}, {item["height"]}, '
|
||||
f'{item["size"]}, 0x{item["crc"]:08x}u }},')
|
||||
lines.append("};")
|
||||
lines.append(f"const unsigned int hud_hires_ce_stock_count = {len(stock)};")
|
||||
lines.append("")
|
||||
# the fonts, and which draws each font tag (text_hires.h)
|
||||
lines.append('#include "text_hires.h"')
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
#include "harness.h"
|
||||
#include "enums.inc"
|
||||
/* game_engine_friendly_damage (game_engine.c) in network co-op: a player's
|
||||
hit of an AI ally, a player or a thing, with Server Setup's ALLY FRIENDLY FIRE
|
||||
on and off. Objects 0 and 1 are the players' bipeds, 2 an AI ally (a Marine),
|
||||
3 no unit */
|
||||
struct game_variant_options { short friendly_fire; };
|
||||
struct network_game { struct game_variant_options variant_options; };
|
||||
struct player_datum { short identifier; long unit_index; };
|
||||
struct unit_datum { struct { long player_index; } unit; };
|
||||
enum { _object_mask_unit = 1 };
|
||||
static struct game_variant_options variant_options;
|
||||
static struct network_game game;
|
||||
static struct { struct { boolean teams; } universal_variant; } global_variant;
|
||||
static void *game_engine;
|
||||
static void *player_data;
|
||||
static boolean coop_active, players_friendly_fire, ally_friendly_fire;
|
||||
static struct unit_datum units[3];
|
||||
static struct player_datum players[2];
|
||||
static struct game_variant_options const *game_variant_options_get(void){return &variant_options;}
|
||||
static boolean network_coop_active(void){return coop_active;}
|
||||
static struct network_game *network_game_get_game(void){return &game;}
|
||||
static void *object_try_and_get_and_verify_type(long object_index,long mask)
|
||||
{
|
||||
(void)mask;return object_index>=0&&object_index<3?&units[object_index]:NULL;
|
||||
}
|
||||
static boolean network_coop_players_friendly_fire(long attacker,long victim){(void)attacker;(void)victim;return players_friendly_fire;}
|
||||
static boolean network_coop_ally_friendly_fire(void){return ally_friendly_fire;}
|
||||
static void *datum_try_and_get(void *array,long index){(void)array;return index>=0&&index<2?&players[index]:NULL;}
|
||||
#include "under_test.inc"
|
||||
static void setup(void)
|
||||
{
|
||||
coop_active=TRUE;players_friendly_fire=TRUE;ally_friendly_fire=TRUE;
|
||||
game.variant_options.friendly_fire=_friendly_fire_on;
|
||||
units[0].unit.player_index=0;units[1].unit.player_index=1;units[2].unit.player_index=NONE;
|
||||
players[0].unit_index=0;players[1].unit_index=1;
|
||||
}
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
const char *case_name=argc>1?argv[1]:"";setup();
|
||||
CASE("ally_on") {
|
||||
for(int explosive=0;explosive<2;explosive++)
|
||||
CHECK(game_engine_friendly_damage(0,2,explosive)==_friendly_damage_all,"a player's hit of an ally, ON");
|
||||
} else CASE("ally_off") {
|
||||
ally_friendly_fire=FALSE;
|
||||
for(int explosive=0;explosive<2;explosive++)
|
||||
CHECK(game_engine_friendly_damage(0,2,explosive)==_friendly_damage_none,"a player's hit of an ally, OFF");
|
||||
} else CASE("ally_off_ai_hit") {
|
||||
ally_friendly_fire=FALSE;
|
||||
CHECK(game_engine_friendly_damage(NONE,2,TRUE)==_friendly_damage_all,"the AI's own hit of its ally");
|
||||
} else CASE("ally_off_players") {
|
||||
ally_friendly_fire=FALSE;
|
||||
CHECK(game_engine_friendly_damage(0,1,FALSE)==_friendly_damage_all,"a player's hit of a player, FRIENDLY FIRE ON");
|
||||
game.variant_options.friendly_fire=_friendly_fire_off;
|
||||
CHECK(game_engine_friendly_damage(0,1,FALSE)==_friendly_damage_none,"a player's hit of a player, FRIENDLY FIRE OFF");
|
||||
game.variant_options.friendly_fire=_friendly_fire_shields_only;
|
||||
CHECK(game_engine_friendly_damage(0,1,FALSE)==_friendly_damage_shields,"SHIELD ONLY");
|
||||
game.variant_options.friendly_fire=_friendly_fire_on;players_friendly_fire=FALSE;
|
||||
CHECK(game_engine_friendly_damage(0,1,FALSE)==_friendly_damage_none,"a player's own choice of no friendly fire");
|
||||
} else CASE("ally_off_not_unit") {
|
||||
ally_friendly_fire=FALSE;
|
||||
CHECK(game_engine_friendly_damage(0,3,FALSE)==_friendly_damage_all,"a player's hit of what is no unit");
|
||||
} else CASE("not_coop") {
|
||||
coop_active=FALSE;ally_friendly_fire=FALSE;
|
||||
CHECK(game_engine_friendly_damage(0,2,FALSE)==_friendly_damage_all,"the campaign alone, no game engine");
|
||||
} else return 2;
|
||||
return 0;
|
||||
}
|
||||
@@ -21,19 +21,21 @@ game is listed: none here */
|
||||
#define TEXT_CHAT_OFF 2
|
||||
static int p2p_hosting_listed(void){return 0;}
|
||||
#include "under_test.inc"
|
||||
#define ROWS 8
|
||||
static char const *rows[]={"op_coop_friendly_fire","op_coop_extra_enemies","op_coop_extra_pickups","op_coop_extra_vehicles",
|
||||
"op_coop_enemies_multiplier","op_coop_enemies_per_player","op_coop_player_collisions"};
|
||||
"op_coop_enemies_multiplier","op_coop_enemies_per_player","op_coop_player_collisions","op_coop_ally_friendly_fire"};
|
||||
static char const *spinners[]={"coop_friendly_fire_spinner","coop_extra_enemies_spinner","coop_extra_pickups_spinner","coop_extra_vehicles_spinner",
|
||||
"coop_enemies_multiplier_spinner","coop_enemies_per_player_spinner","coop_player_collisions_spinner"};
|
||||
static short counts[]={4,3,3,3,5,5,2};
|
||||
static struct widget_instance list,help,row[7],label[7],spinner[7],clone[7];
|
||||
"coop_enemies_multiplier_spinner","coop_enemies_per_player_spinner","coop_player_collisions_spinner",
|
||||
"coop_ally_friendly_fire_spinner"};
|
||||
static short counts[]={4,3,3,3,5,5,2,2};
|
||||
static struct widget_instance list,help,row[ROWS],label[ROWS],spinner[ROWS],clone[ROWS];
|
||||
static void setup(void)
|
||||
{
|
||||
memset(&list,0,sizeof(list));list.name="coop_options_menu";list.vertical_offset=9;list.child=row;
|
||||
list.parameters.list.extended_description=&help;
|
||||
for(int i=0;i<7;i++){
|
||||
for(int i=0;i<ROWS;i++){
|
||||
short y=73+30*i;
|
||||
row[i]=(struct widget_instance){.name=rows[i],.visible=TRUE,.vertical_offset=y,.child=&label[i],.next=i<6?&row[i+1]:NULL};
|
||||
row[i]=(struct widget_instance){.name=rows[i],.visible=TRUE,.vertical_offset=y,.child=&label[i],.next=i<ROWS-1?&row[i+1]:NULL};
|
||||
label[i]=(struct widget_instance){.name="label",.vertical_offset=4,.next=&spinner[i]};
|
||||
spinner[i]=(struct widget_instance){.name=spinners[i],.type=2,.vertical_offset=1,.child=&clone[i]};
|
||||
spinner[i].parameters.list.number_of_items=counts[i];
|
||||
@@ -51,11 +53,11 @@ int main(int argc,char **argv)
|
||||
CHECK(row[5].visible==(mode==0||pickups==0||vehicles==0),"per-player visibility");
|
||||
CHECK(row[4].visible==(mode==1||pickups==1||vehicles==1),"multiplier visibility");
|
||||
CHECK(list.focused_child==&row[1],"focus changed");
|
||||
for(int i=0;i<7;i++){
|
||||
for(int i=0;i<ROWS;i++){
|
||||
if(row[i].visible){CHECK(row[i].vertical_offset==y,"gap or overlap at %s",rows[i]);y+=30;}
|
||||
CHECK(label[i].vertical_offset==4&&spinner[i].vertical_offset==1&&clone[i].vertical_offset==2,
|
||||
"relative descendant positions %s",rows[i]);
|
||||
CHECK(row[i].next==(i<6?&row[i+1]:NULL),"row order changed");
|
||||
CHECK(row[i].next==(i<ROWS-1?&row[i+1]:NULL),"row order changed");
|
||||
}
|
||||
CHECK(y-30+28<=341,"rows overlap help area");
|
||||
}
|
||||
@@ -64,7 +66,7 @@ int main(int argc,char **argv)
|
||||
spinner[1].parameters.list.selected_index=mode;spinner[2].parameters.list.selected_index=pickups;
|
||||
spinner[3].parameters.list.selected_index=vehicles;
|
||||
gametype_option_help(&list);short offset=0;
|
||||
for(int i=0;i<7;i++){
|
||||
for(int i=0;i<ROWS;i++){
|
||||
if(row[i].visible)for(int choice=0;choice<counts[i];choice++){
|
||||
list.focused_child=&row[i];spinner[i].parameters.list.selected_index=choice;gametype_option_help(&list);
|
||||
CHECK(help.parameters.text_box.string_list_index==offset+choice,"wrong help row%d choice%d",i,choice);
|
||||
@@ -76,7 +78,7 @@ int main(int argc,char **argv)
|
||||
}
|
||||
} else CASE("unrelated") {
|
||||
spinner[1].name="unrelated";list.name="other_options";gametype_option_help(&list);
|
||||
for(int i=0;i<7;i++)CHECK(row[i].visible&&row[i].vertical_offset==73+30*i,"unrelated menu altered");
|
||||
for(int i=0;i<ROWS;i++)CHECK(row[i].visible&&row[i].vertical_offset==73+30*i,"unrelated menu altered");
|
||||
} else return 2;
|
||||
return 0;
|
||||
}
|
||||
@@ -10,7 +10,7 @@ struct player_datum { short local_player_index; };
|
||||
struct distributed_unit_state { real_point3d position; unsigned flags; word predicted_time; };
|
||||
struct fake_object {
|
||||
long mask;
|
||||
struct { real_point3d position; } object;
|
||||
struct { real_point3d position, bounding_sphere_center; } object;
|
||||
struct { unsigned flags; long support_surface_index, elevator_object_index; char elevator_ticks; } biped;
|
||||
};
|
||||
#define biped_datum fake_object
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
#include "harness.h"
|
||||
#include "enums.inc"
|
||||
/* OpenCE's gametypes (port/linux/game/game_modes.c, infection.c, gun_game.c):
|
||||
a gametype's options kept in range, the modes each game engine and teams
|
||||
allow, Infection's round result and the state a client takes, and Gun Game's
|
||||
list of weapons. */
|
||||
typedef unsigned short word;
|
||||
#define VALID_INDEX(index, count) ((index) >= 0 && (index) < (count))
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define NUMBEROF(array) ((long)(sizeof(array) / sizeof((array)[0])))
|
||||
#define csmemset memset
|
||||
#define HALO_PORT_MAXIMUM_NETWORK_PLAYERS 4
|
||||
#define INFECTION_MAXIMUM_SCORE 1000000
|
||||
#include "structures.inc"
|
||||
|
||||
/* Gun Game's world: the map's weapons, the host or a client, the draw */
|
||||
static struct game_variant_options options;
|
||||
static boolean map_has[NUMBER_OF_LOADOUT_WEAPONS];
|
||||
static boolean client;
|
||||
static short draws;
|
||||
static struct { byte levels[8]; short level_count; } gun_game;
|
||||
static struct game_variant_options const *game_variant_options_get(void){return &options;}
|
||||
static long game_engine_loadout_weapon_definition(byte weapon){return map_has[weapon]?100+weapon:NONE;}
|
||||
static boolean network_game_distributed_client(void){return client;}
|
||||
/* (the draw: the first of the range each time, so each weapon from the last
|
||||
swaps with the first) */
|
||||
static short local_random_range(short lower,short upper){draws++;(void)upper;return lower;}
|
||||
/* Hardcore's world: a killer's unit, the host or a client */
|
||||
enum { _object_dead_bit = 0, _object_shield_depleted_bit, _object_shield_charging_bit };
|
||||
#define SET_FLAG(flags, bit, value) ((value) ? ((flags) |= FLAG(bit)) : ((flags) &= ~FLAG(bit)))
|
||||
struct player_datum { long unit_index; };
|
||||
struct unit_datum { struct { real body_vitality, shield_vitality, maximum_shield_vitality; long damage_flags; } object; };
|
||||
static struct player_datum killer_player = { 7 };
|
||||
static struct unit_datum killer_unit;
|
||||
static boolean hardcore=TRUE;
|
||||
static boolean game_modes_hardcore(void){return hardcore;}
|
||||
static struct player_datum *player_try_and_get(long index){return index==1?&killer_player:NULL;}
|
||||
static struct unit_datum *unit_try_and_get(long index){return index==7?&killer_unit:NULL;}
|
||||
#include "under_test.inc"
|
||||
|
||||
static void wounded_killer(real body,real shield)
|
||||
{
|
||||
memset(&killer_unit,0,sizeof(killer_unit));
|
||||
killer_unit.object.body_vitality=body;killer_unit.object.shield_vitality=shield;
|
||||
killer_unit.object.maximum_shield_vitality=1.0f;
|
||||
SET_FLAG(killer_unit.object.damage_flags,_object_shield_depleted_bit,TRUE);
|
||||
hardcore=TRUE;client=FALSE;
|
||||
}
|
||||
|
||||
static void map_with_every_weapon(void)
|
||||
{
|
||||
for(int weapon=0;weapon<NUMBER_OF_LOADOUT_WEAPONS;weapon++) map_has[weapon]=weapon>=_loadout_weapon_assault_rifle;
|
||||
}
|
||||
|
||||
static struct distributed_infection_state valid_state(void)
|
||||
{
|
||||
struct distributed_infection_state state;
|
||||
memset(&state,0,sizeof(state));
|
||||
state.game_number=3;state.revision=5;state.phase=_distributed_infection_active;state.winner=NONE;
|
||||
state.players[0].identity=11;state.players[0].role=_distributed_infection_role_human;state.players[0].score=2;
|
||||
state.players[1].identity=12;state.players[1].role=_distributed_infection_role_zombie;
|
||||
return state;
|
||||
}
|
||||
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
const char *case_name=argc>1?argv[1]:"";
|
||||
CASE("sanitize_defaults") {
|
||||
/* (a gametype saved before OpenCE's: every byte 0) */
|
||||
memset(&options,0,sizeof(options));
|
||||
game_modes_options_sanitize(&options);
|
||||
CHECK(options.mode==_game_mode_none&&!options.hardcore,"no mode");
|
||||
CHECK(options.infection_initial_zombies==1&&options.infection_zombie_speed==150&&
|
||||
options.infection_skull_damage==200&&options.infection_respawn_time==5,"Infection's defaults");
|
||||
CHECK(options.infection_countdown==0,"a countdown of 0 is one");
|
||||
} else CASE("options_default") {
|
||||
memset(&options,0xAA,sizeof(options));
|
||||
game_modes_options_default(&options);
|
||||
CHECK(options.mode==_game_mode_none&&!options.hardcore,"no mode, not Hardcore");
|
||||
CHECK(options.infection_countdown==10&&options.infection_zombie_shields&&options.gun_game_melee_demotes,
|
||||
"a countdown, zombies' shields, melee demotes");
|
||||
CHECK(options.time_limit==(short)0xAAAA,"the game type's own options left alone");
|
||||
game_modes_options_sanitize(&options);
|
||||
CHECK(options.infection_countdown==10&&options.infection_zombie_speed==150,"the defaults are in range");
|
||||
} else CASE("hardcore_restore") {
|
||||
wounded_killer(0.25f,0.0f);
|
||||
game_modes_player_killed(1,2,FALSE);
|
||||
CHECK(killer_unit.object.body_vitality==1.0f&&killer_unit.object.shield_vitality==1.0f,"health and shields restored");
|
||||
CHECK(!TEST_FLAG(killer_unit.object.damage_flags,_object_shield_depleted_bit),"the shields no longer depleted");
|
||||
wounded_killer(0.5f,2.0f);
|
||||
game_modes_player_killed(1,2,FALSE);
|
||||
CHECK(killer_unit.object.shield_vitality==2.0f,"an overshield kept");
|
||||
} else CASE("hardcore_no_restore") {
|
||||
wounded_killer(0.25f,0.0f);hardcore=FALSE;
|
||||
game_modes_player_killed(1,2,FALSE);
|
||||
CHECK(killer_unit.object.body_vitality==0.25f,"not Hardcore");
|
||||
wounded_killer(0.25f,0.0f);
|
||||
game_modes_player_killed(1,2,TRUE);
|
||||
CHECK(killer_unit.object.body_vitality==0.25f,"a betrayal");
|
||||
game_modes_player_killed(1,1,FALSE);
|
||||
CHECK(killer_unit.object.body_vitality==0.25f,"a suicide");
|
||||
game_modes_player_killed(NONE,2,FALSE);
|
||||
CHECK(killer_unit.object.body_vitality==0.25f,"no killer");
|
||||
client=TRUE;
|
||||
game_modes_player_killed(1,2,FALSE);
|
||||
CHECK(killer_unit.object.body_vitality==0.25f,"a client's copy of the kill");
|
||||
client=FALSE;
|
||||
SET_FLAG(killer_unit.object.damage_flags,_object_dead_bit,TRUE);
|
||||
game_modes_player_killed(1,2,FALSE);
|
||||
CHECK(killer_unit.object.body_vitality==0.25f,"a killer already dead");
|
||||
} else CASE("sanitize_range") {
|
||||
/* (another machine's, or a file's, out of range) */
|
||||
memset(&options,0xFF,sizeof(options));
|
||||
game_modes_options_sanitize(&options);
|
||||
CHECK(options.mode==_game_mode_none,"an unknown mode is none");
|
||||
CHECK(options.hardcore==TRUE&&options.infection_zombie_shields==TRUE&&options.gun_game_melee_demotes==TRUE,
|
||||
"booleans are 0 or 1");
|
||||
CHECK(options.infection_initial_zombies==1&&options.infection_zombie_speed==150&&options.infection_skull_damage==200&&
|
||||
options.infection_respawn_time==5&&options.infection_countdown==10,"out of range: the defaults");
|
||||
CHECK(options.gun_game_order==_gun_game_order_strongest_first,"an unknown order");
|
||||
for(int index=0;index<(int)sizeof(options.reserved);index++) CHECK(options.reserved[index]==0,"reserved cleared");
|
||||
} else CASE("sanitize_keeps") {
|
||||
memset(&options,0,sizeof(options));
|
||||
options.mode=_game_mode_infection;options.infection_initial_zombies=16;options.infection_zombie_speed=200;
|
||||
options.infection_skull_damage=100;options.infection_respawn_time=30;options.infection_countdown=30;
|
||||
options.gun_game_order=_gun_game_order_random;
|
||||
game_modes_options_sanitize(&options);
|
||||
CHECK(options.mode==_game_mode_infection&&options.infection_initial_zombies==16&&options.infection_zombie_speed==200&&
|
||||
options.infection_skull_damage==100&&options.infection_respawn_time==30&&options.infection_countdown==30&&
|
||||
options.gun_game_order==_gun_game_order_random,"values in range are kept");
|
||||
} else CASE("variant_mode") {
|
||||
struct game_variant variant;
|
||||
memset(&variant,0,sizeof(variant));memset(&options,0,sizeof(options));
|
||||
variant.game_engine_index=game_engine_slayer;
|
||||
options.mode=_game_mode_swat;
|
||||
CHECK(game_modes_variant_mode(&variant,&options)==_game_mode_swat,"SWAT, free for all");
|
||||
variant.universal_variant.teams=TRUE;
|
||||
CHECK(game_modes_variant_mode(&variant,&options)==_game_mode_swat,"SWAT, teams");
|
||||
options.mode=_game_mode_infection;
|
||||
CHECK(game_modes_variant_mode(&variant,&options)==_game_mode_infection,"Infection on teams");
|
||||
variant.universal_variant.teams=FALSE;
|
||||
CHECK(game_modes_variant_mode(&variant,&options)==_game_mode_none,"no Infection without teams");
|
||||
options.mode=_game_mode_gun_game;
|
||||
CHECK(game_modes_variant_mode(&variant,&options)==_game_mode_gun_game,"Gun Game, free for all");
|
||||
variant.universal_variant.teams=TRUE;
|
||||
CHECK(game_modes_variant_mode(&variant,&options)==_game_mode_none,"no Gun Game on teams");
|
||||
variant.universal_variant.teams=FALSE;variant.game_engine_index=game_engine_ctf;
|
||||
CHECK(game_modes_variant_mode(&variant,&options)==_game_mode_none,"Slayer's modes only");
|
||||
CHECK(game_modes_variant_mode(NULL,&options)==_game_mode_none&&game_modes_variant_mode(&variant,NULL)==_game_mode_none,
|
||||
"none without a gametype");
|
||||
} else CASE("round_result") {
|
||||
long limit=300*30;
|
||||
CHECK(infection_round_result(3,1,0,limit)==NONE,"humans and zombies left");
|
||||
CHECK(infection_round_result(0,4,10,limit)==1,"no human left: the zombies");
|
||||
CHECK(infection_round_result(2,1,limit,limit)==0,"the time out: the humans");
|
||||
CHECK(infection_round_result(0,4,limit,limit)==1,"the last human turned as the time runs out: the zombies");
|
||||
CHECK(infection_round_result(2,1,limit*10,0)==NONE,"no time limit");
|
||||
CHECK(infection_round_result(3,0,10,limit)==0,"every zombie gone: the humans");
|
||||
CHECK(infection_round_result(0,0,10,limit)==2,"everyone gone: no one");
|
||||
} else CASE("state_valid") {
|
||||
struct distributed_infection_state state=valid_state();
|
||||
CHECK(infection_state_valid(&state,3,5),"a state of the game, as new");
|
||||
CHECK(!infection_state_valid(&state,4,0),"another game's");
|
||||
CHECK(!infection_state_valid(&state,3,6),"older than the client's");
|
||||
state=valid_state();state.phase=_distributed_infection_finished+1;
|
||||
CHECK(!infection_state_valid(&state,3,0),"an unknown phase");
|
||||
state=valid_state();state.winner=1;
|
||||
CHECK(!infection_state_valid(&state,3,0),"a winner before the round is over");
|
||||
state.phase=_distributed_infection_finished;
|
||||
CHECK(infection_state_valid(&state,3,0),"a winner after");
|
||||
state.winner=2;
|
||||
CHECK(!infection_state_valid(&state,3,0),"no third side");
|
||||
state=valid_state();state.players[2].role=_distributed_infection_role_zombie+1;
|
||||
CHECK(!infection_state_valid(&state,3,0),"an unknown role");
|
||||
state=valid_state();state.players[2].role=_distributed_infection_role_human;
|
||||
CHECK(!infection_state_valid(&state,3,0),"a role with no player");
|
||||
state=valid_state();state.players[0].score=-1;
|
||||
CHECK(!infection_state_valid(&state,3,0),"a negative score");
|
||||
state=valid_state();state.players[0].score=INFECTION_MAXIMUM_SCORE+1;
|
||||
CHECK(!infection_state_valid(&state,3,0),"a score too large");
|
||||
state=valid_state();state.players[1].reserved[1]=1;
|
||||
CHECK(!infection_state_valid(&state,3,0),"reserved bytes set");
|
||||
} else CASE("gun_game_order") {
|
||||
map_with_every_weapon();memset(&options,0,sizeof(options));
|
||||
options.gun_game_order=_gun_game_order_strongest_first;
|
||||
gun_game_levels_build();
|
||||
CHECK(gun_game.level_count==8,"every weapon: %d",gun_game.level_count);
|
||||
CHECK(gun_game.levels[0]==_loadout_weapon_rocket_launcher&&gun_game.levels[7]==_loadout_weapon_pistol,
|
||||
"the rocket launcher first, the pistol last");
|
||||
options.gun_game_order=_gun_game_order_weakest_first;
|
||||
gun_game_levels_build();
|
||||
CHECK(gun_game.levels[0]==_loadout_weapon_pistol&&gun_game.levels[7]==_loadout_weapon_rocket_launcher,
|
||||
"the pistol first");
|
||||
} else CASE("gun_game_missing") {
|
||||
map_with_every_weapon();memset(&options,0,sizeof(options));
|
||||
map_has[_loadout_weapon_shotgun]=FALSE;map_has[_loadout_weapon_needler]=FALSE;
|
||||
gun_game_levels_build();
|
||||
CHECK(gun_game.level_count==6,"the map's weapons only: %d",gun_game.level_count);
|
||||
for(int level=0;level<gun_game.level_count;level++)
|
||||
CHECK(gun_game.levels[level]!=_loadout_weapon_shotgun&&gun_game.levels[level]!=_loadout_weapon_needler,"none missing");
|
||||
} else CASE("gun_game_random") {
|
||||
map_with_every_weapon();memset(&options,0,sizeof(options));
|
||||
options.gun_game_order=_gun_game_order_random;draws=0;
|
||||
gun_game_levels_build();
|
||||
CHECK(draws==7&&gun_game.level_count==8,"the host draws the order");
|
||||
CHECK(gun_game.levels[0]!=_loadout_weapon_rocket_launcher,"in another order");
|
||||
client=TRUE;draws=0;
|
||||
gun_game_levels_build();
|
||||
CHECK(draws==0&&gun_game.level_count==8,"a client draws nothing, its list as long");
|
||||
client=FALSE;
|
||||
} else return 2;
|
||||
return 0;
|
||||
}
|
||||
@@ -71,6 +71,8 @@ static boolean distributed_damage_is_recoil(struct damage_data const *damage, lo
|
||||
static void damage_replay_player_effect(long index, struct damage_data *damage, real amount) { }
|
||||
static boolean network_objects_client_has(long index) { return TRUE; }
|
||||
static boolean static_target(long index) { return FALSE; }
|
||||
/* (no static targets here, so no damage is one's own: test_static_target) */
|
||||
static boolean static_target_damage(struct damage_data const *damage) { return FALSE; }
|
||||
static void distributed_damage_from_data(struct damage_data const *damage, struct damage_data *result) { *result = *damage; }
|
||||
static void object_get_origin(long index, real_point3d *point) { memset(point, 0, sizeof(*point)); }
|
||||
static long distributed_latest_host_time(void) { return 10; }
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
#include "harness.h"
|
||||
/* network_damage.c's static_target: the map's scenery and devices whose hits
|
||||
every machine shares, those with a body damage can destroy and those whose
|
||||
shield is all it can break. Objects: 0 scenery with a body, 1 scenery with a
|
||||
shield only (an energy shield, a tripmine), 2 scenery with neither, 3 a device
|
||||
with a shield only, 4 a unit with a shield (not one: its own state is sent) */
|
||||
enum { _object_mask_scenery = 1, _object_mask_device = 2, _object_mask_unit = 4 };
|
||||
#define STATIC_TARGET_TYPES (_object_mask_scenery | _object_mask_device)
|
||||
static struct { long mask; real body, shield; } objects[] = {
|
||||
{ _object_mask_scenery, 50.0f, 0.0f }, { _object_mask_scenery, 0.0f, 80.0f }, { _object_mask_scenery, 0.0f, 0.0f },
|
||||
{ _object_mask_device, 0.0f, 20.0f }, { _object_mask_unit, 75.0f, 75.0f },
|
||||
};
|
||||
static void *object_try_and_get_and_verify_type(long object_index,long mask)
|
||||
{
|
||||
return object_index>=0&&object_index<5&&(objects[object_index].mask&mask)?&objects[object_index]:NULL;
|
||||
}
|
||||
static real object_get_maximum_body_vitality(long object_index,boolean ignore_difficulty)
|
||||
{
|
||||
(void)ignore_difficulty;return objects[object_index].body;
|
||||
}
|
||||
static real object_get_maximum_shield_vitality(long object_index,boolean ignore_difficulty)
|
||||
{
|
||||
(void)ignore_difficulty;return objects[object_index].shield;
|
||||
}
|
||||
struct damage_data { long owner_object_index; };
|
||||
/* where each object is, and its size (static_target_near) */
|
||||
static real_point3d origins[] = { { 0, 0, 0 }, { 10, 0, 0 }, { 10.5f, 0, 0 }, { 13, 0, 0 }, { 10.1f, 0, 0 } };
|
||||
struct object_datum { struct { real bounding_sphere_radius; } object; };
|
||||
static struct object_datum datums[5] = { { { 0.2f } }, { { 0.2f } }, { { 0.2f } }, { { 0.2f } }, { { 0.5f } } };
|
||||
#define object_get(index) (&datums[index])
|
||||
static void object_get_origin(long object_index,real_point3d *origin){*origin=origins[object_index];}
|
||||
struct object_iterator { long index; long next; unsigned long mask; };
|
||||
static void object_iterator_new(struct object_iterator *iterator,unsigned long mask,byte flags)
|
||||
{
|
||||
(void)flags;iterator->next=0;iterator->mask=mask;iterator->index=NONE;
|
||||
}
|
||||
static void *object_iterator_next(struct object_iterator *iterator)
|
||||
{
|
||||
while(iterator->next<5){long index=iterator->next++;if(objects[index].mask&iterator->mask){iterator->index=index;return &datums[index];}}
|
||||
return NULL;
|
||||
}
|
||||
#include "under_test.inc"
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
const char *case_name=argc>1?argv[1]:"";
|
||||
CASE("body") {
|
||||
CHECK(static_target(0),"scenery with a body");
|
||||
} else CASE("shield") {
|
||||
CHECK(static_target(1),"scenery with a shield only");
|
||||
CHECK(static_target(3),"a device with a shield only");
|
||||
} else CASE("neither") {
|
||||
CHECK(!static_target(2),"scenery damage cannot break");
|
||||
CHECK(!static_target(4),"a unit, whose state the host sends");
|
||||
CHECK(!static_target(NONE),"no object");
|
||||
} else CASE("damage") {
|
||||
/* a tripmine's own explosion (its owner the tripmine), and a player's grenade's (the grenade, no static target) */
|
||||
struct damage_data tripmine={1},grenade={4},none={NONE},light={0};
|
||||
CHECK(static_target_damage(&tripmine),"a shield scenery's own damage");
|
||||
CHECK(static_target_damage(&light),"a destructible scenery's own damage");
|
||||
CHECK(!static_target_damage(&grenade),"what a unit or projectile owns");
|
||||
CHECK(!static_target_damage(&none),"damage with no owner object");
|
||||
} else CASE("near") {
|
||||
/* another machine's copy of a tripmine (object 1, a shield) where this machine has it, and not too far */
|
||||
real_point3d at={10.3f,0,0},away={11.6f,0,0},nothing={30,0,0};
|
||||
CHECK(static_target_near(&at,1.0f)==1,"the nearest static target, %ld",static_target_near(&at,1.0f));
|
||||
CHECK(static_target_near(&away,1.0f)==NONE,"no unit, nothing damage cannot break, none farther");
|
||||
CHECK(static_target_near(¬hing,1.0f)==NONE,"none within reach");
|
||||
CHECK(static_target_near(&at,0.0f)==NONE,"its size and the reach only");
|
||||
{ real_point3d between={12,0,0}; CHECK(static_target_near(&between,2.0f)==3,"the nearer of two, %ld",static_target_near(&between,2.0f)); }
|
||||
} else return 2;
|
||||
return 0;
|
||||
}
|
||||
@@ -30,7 +30,7 @@ def test_menu():
|
||||
root=ET.fromstring('\n'.join(p.multiplayer_files()[p.PLAYER_EDIT.replace('/','.')+'.port.xml']))
|
||||
choices=root.find("strings[@name='"+p.PLAYER_EDIT+"/var_aim_assist']")
|
||||
assert [s.attrib['text'] for s in choices]==['ALLOWED','BLOCK M+KB']
|
||||
assert 313+28<345 and 345+60<414
|
||||
assert 73+27*8==289 and 289+27==316 and 316+28<=345 and 345+60<414
|
||||
assert '"network.block_mouse_aim_assist", { "false", "true" }' in read('port/linux/game/menu_functions.c')
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
"""Network co-op's ALLY FRIENDLY FIRE: a player's hits of AI allies, and the rest left alone."""
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
||||
from harness import CHECK_FAILED, build, enum_with, function, mutated, read, run
|
||||
|
||||
|
||||
def generated(fault=None):
|
||||
header = read('source/game/game_engine.h')
|
||||
enums = enum_with(header, '_friendly_fire_on = 0') + '\n' + enum_with(header, '_friendly_damage_all = 0') + '\n'
|
||||
code = function(read('source/game/game_engine.c'), 'game_engine_friendly_damage')
|
||||
if fault:
|
||||
code = mutated(code, *fault)
|
||||
return (('enums.inc', enums), ('under_test.inc', code))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('case', ['ally_on', 'ally_off', 'ally_off_ai_hit', 'ally_off_players', 'ally_off_not_unit',
|
||||
'not_coop'])
|
||||
def test_case(case):
|
||||
status, output = run(build('coop_ally_friendly_fire', generated()), case)
|
||||
assert status == 0, output
|
||||
|
||||
|
||||
@pytest.mark.parametrize('fault,case', [
|
||||
(('attacker_player_index != NONE && !network_coop_ally_friendly_fire()', 'attacker_player_index != NONE'),
|
||||
'ally_on'),
|
||||
(('attacker_player_index != NONE && !network_coop_ally_friendly_fire()', '!network_coop_ally_friendly_fire()'),
|
||||
'ally_off_ai_hit'),
|
||||
(('_friendly_damage_none : _friendly_damage_all;', '_friendly_damage_all : _friendly_damage_all;'), 'ally_off'),
|
||||
(('if (unit->unit.player_index == NONE)', 'if (unit->unit.player_index == NONE || !network_coop_ally_friendly_fire())'),
|
||||
'ally_off_players'),
|
||||
])
|
||||
def test_negative_control(fault, case):
|
||||
status, output = run(build('coop_ally_friendly_fire', generated(fault)), case)
|
||||
assert status == CHECK_FAILED, output
|
||||
@@ -5,12 +5,14 @@ from pathlib import Path
|
||||
import pytest
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
||||
from harness import CHECK_FAILED, build, function, mutated, read, run
|
||||
from harness import CHECK_FAILED, build, enum_with, function, mutated, read, run
|
||||
|
||||
|
||||
def generated(fault=None):
|
||||
source = read('port/linux/game/menu_functions.c')
|
||||
code = function(source, 'gametype_option_help')
|
||||
# (OPENCE OPTIONS' rows name the modes: game_engine.h)
|
||||
code = enum_with(read('source/game/game_engine.h'), '_game_mode_none = 0') + '\n' + \
|
||||
function(source, 'gametype_option_help')
|
||||
if fault:
|
||||
code = mutated(code, *fault)
|
||||
return (('under_test.inc', code),)
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
"""OpenCE's gametypes: options' defaults and range, Hardcore's restore of a killer, the modes a gametype allows,
|
||||
Infection's round and state, Gun Game's weapons (port/linux/game/game_modes.c, infection.c, gun_game.c)."""
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
||||
from harness import CHECK_FAILED, build, enum_with, function, mutated, read, run, structure
|
||||
|
||||
|
||||
def generated(fault=None):
|
||||
engine = read('source/game/game_engine.h')
|
||||
network = read('port/linux/game/network_infection.h')
|
||||
enums = '\n'.join([
|
||||
enum_with(engine, 'game_engine_none = 0'), enum_with(engine, '_loadout_weapon_none = 0'),
|
||||
enum_with(engine, '_variant_vehicle_warthog = 0'), enum_with(engine, '_game_mode_none = 0'),
|
||||
enum_with(engine, '_gun_game_order_strongest_first = 0'),
|
||||
enum_with(network, '_distributed_infection_waiting = 0'),
|
||||
enum_with(network, '_distributed_infection_role_none = 0')]) + '\n'
|
||||
structures = '\n'.join([
|
||||
structure(engine, 'universal_variant'), 'union game_engine_variant { long data[6]; };',
|
||||
structure(engine, 'game_variant').replace('wchar_t', 'unsigned short'),
|
||||
structure(engine, 'game_variant_options'),
|
||||
structure(network, 'distributed_infection_player'), structure(network, 'distributed_infection_state')]) + '\n'
|
||||
modes = read('port/linux/game/game_modes.c')
|
||||
infection = read('port/linux/game/infection.c')
|
||||
gun_game = read('port/linux/game/gun_game.c')
|
||||
defaults = re.search(r'/\* Infection\'s options when a gametype has none.*?\};', modes, re.S).group(0)
|
||||
order = re.search(r'static byte const gun_game_strongest_first\[\] =.*?\};', gun_game, re.S).group(0)
|
||||
code = '\n'.join([
|
||||
defaults, function(modes, 'game_modes_option'), function(modes, 'game_modes_options_default'),
|
||||
function(modes, 'game_modes_options_sanitize'), function(modes, 'game_modes_player_killed'),
|
||||
function(modes, 'game_modes_variant_mode'), function(infection, 'infection_round_result'),
|
||||
function(infection, 'infection_state_valid'), order,
|
||||
'#define GUN_GAME_MAXIMUM_LEVELS NUMBEROF(gun_game_strongest_first)',
|
||||
function(gun_game, 'gun_game_levels_build')])
|
||||
if fault:
|
||||
code = mutated(code, *fault)
|
||||
return (('enums.inc', enums), ('structures.inc', structures), ('under_test.inc', code))
|
||||
|
||||
|
||||
CASES = ['options_default', 'hardcore_restore', 'hardcore_no_restore', 'sanitize_defaults', 'sanitize_range',
|
||||
'sanitize_keeps', 'variant_mode', 'round_result', 'state_valid', 'gun_game_order', 'gun_game_missing',
|
||||
'gun_game_random']
|
||||
|
||||
|
||||
@pytest.mark.parametrize('case', CASES)
|
||||
def test_case(case):
|
||||
status, output = run(build('game_modes', generated()), case)
|
||||
assert status == 0, output
|
||||
|
||||
|
||||
@pytest.mark.parametrize('fault,case', [
|
||||
(('!= FALSE;\n\tcsmemset(options->reserved, 0,', '!= FALSE;\n\tcsmemset(options->reserved, 1,'), 'sanitize_range'),
|
||||
(('unit->object.shield_vitality < 1.0f', 'TRUE'), 'hardcore_restore'),
|
||||
(('friendly_fire ||\n', ''), 'hardcore_no_restore'),
|
||||
(('return variant->universal_variant.teams ? _game_mode_infection', 'return 1 ? _game_mode_infection'),
|
||||
'variant_mode'),
|
||||
(('if (!humans)\n\t\treturn 1;', 'if (!humans)\n\t\treturn NONE;'), 'round_result'),
|
||||
(('state->revision < revision ||', ''), 'state_valid'),
|
||||
(('player->reserved[0] || player->reserved[1] || player->reserved[2]', 'player->reserved[0]'), 'state_valid'),
|
||||
(('if (game_engine_loadout_weapon_definition(weapon) != NONE)', 'if (TRUE)'), 'gun_game_missing'),
|
||||
(('&& !network_game_distributed_client()', ''), 'gun_game_random'),
|
||||
])
|
||||
def test_negative_control(fault, case):
|
||||
status, output = run(build('game_modes', generated(fault)), case)
|
||||
assert status == CHECK_FAILED, output
|
||||
@@ -0,0 +1,37 @@
|
||||
"""The scenery and devices whose damage every machine shares: a body to destroy, or a shield to break."""
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
||||
from harness import CHECK_FAILED, build, function, mutated, read, run
|
||||
|
||||
|
||||
def generated(fault=None):
|
||||
source = read('port/linux/game/network_damage.c')
|
||||
code = '\n'.join(function(source, name) for name in ('static_target', 'static_target_damage',
|
||||
'distributed_distance_squared', 'static_target_near'))
|
||||
if fault:
|
||||
code = mutated(code, *fault)
|
||||
return (('under_test.inc', code),)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('case', ['body', 'shield', 'neither', 'damage', 'near'])
|
||||
def test_case(case):
|
||||
status, output = run(build('static_target', generated()), case)
|
||||
assert status == 0, output
|
||||
|
||||
|
||||
@pytest.mark.parametrize('fault,case', [
|
||||
# (the shield-only objects left out, as before: Rat Race's shields, a map's tripmines)
|
||||
(('||\n\t\t\tobject_get_maximum_shield_vitality(object_index, TRUE) > 0.0f', ''), 'shield'),
|
||||
(('STATIC_TARGET_TYPES)', 'STATIC_TARGET_TYPES | _object_mask_unit)'), 'neither'),
|
||||
(('object_get_maximum_body_vitality(object_index, TRUE) > 0.0f ||', ''), 'body'),
|
||||
(('damage->owner_object_index != NONE && static_target(damage->owner_object_index)', 'FALSE'), 'damage'),
|
||||
(('distance < nearest_distance', 'distance > nearest_distance'), 'near'),
|
||||
(('if (!static_target(iterator.index))\n\t\t\tcontinue;', ''), 'near'),
|
||||
])
|
||||
def test_negative_control(fault, case):
|
||||
status, output = run(build('static_target', generated(fault)), case)
|
||||
assert status == CHECK_FAILED, output
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
"""The vehicle options' strings (port/assets/menus/ce/strings.xml) and the code that indexes them (menu_functions.c)."""
|
||||
import re
|
||||
import sys
|
||||
import xml.etree.ElementTree as ElementTree
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
||||
import port_settings
|
||||
from harness import read
|
||||
|
||||
VEHICLE_EDIT = "main_menu/settings_select/multiplayer_setup/vehicle_options_edit"
|
||||
|
||||
|
||||
def strings(name):
|
||||
"""a list's strings: (text, its index in the PC version's list or None)"""
|
||||
menus = ElementTree.fromstring(read("port/assets/menus/ce/strings.xml").encode("latin-1"))
|
||||
for strings in menus.iter("strings"):
|
||||
if strings.get("name") == name:
|
||||
return [(string.get("text"), string.get("map")) for string in strings.iter("string")]
|
||||
raise LookupError(name)
|
||||
|
||||
|
||||
def preset(name):
|
||||
return int(re.search(rf"^#define {name} (\d+)$", read("port/linux/game/menu_functions.c"), re.M).group(1))
|
||||
|
||||
|
||||
def test_vehicle_sets_are_the_codes():
|
||||
sets = [text for text, _ in strings(f"{VEHICLE_EDIT}/var_vehicle_set")]
|
||||
assert len(sets) == preset("VEHICLE_PRESET_CUSTOM") + 1
|
||||
assert sets[preset("VEHICLE_PRESET_PC")] == "PC"
|
||||
assert sets[preset("VEHICLE_PRESET_CUSTOM")] == "CUSTOM"
|
||||
|
||||
|
||||
def test_each_value_has_its_help():
|
||||
"""gametype_option_help: the rows' values' helps in turn (respawn, side,
|
||||
set, then the six vehicles' counts)"""
|
||||
rows = [f"{VEHICLE_EDIT}/var_vehicles_respawn", f"{VEHICLE_EDIT}/var_team", f"{VEHICLE_EDIT}/var_vehicle_set"]
|
||||
values = sum(len(strings(row)) for row in rows) + 6 * len(strings(f"{VEHICLE_EDIT}/var_vehicle_options"))
|
||||
helps = [text for text, _ in strings(f"{VEHICLE_EDIT}/cap_vehicle_options")]
|
||||
assert len(helps) == values
|
||||
assert "Halo PC" in helps[7 + 2 + preset("VEHICLE_PRESET_PC")]
|
||||
assert helps[7 + 2 + preset("VEHICLE_PRESET_CUSTOM")].startswith("Customize")
|
||||
|
||||
|
||||
def test_strings_xml_has_port_settings_inserts():
|
||||
"""what tools/ce_menus.py writes from port_settings.STRING_INSERTS, so
|
||||
that making strings.xml again keeps them"""
|
||||
for name in (f"{VEHICLE_EDIT}/var_vehicle_set", f"{VEHICLE_EDIT}/cap_vehicle_options"):
|
||||
shown = strings(name)
|
||||
made = [text for text, original in shown if original is not None]
|
||||
for at, texts in port_settings.STRING_INSERTS[name]:
|
||||
made = made[:at] + texts + made[at:]
|
||||
assert made == [text for text, _ in shown], name
|
||||
+17
-7
@@ -2,13 +2,14 @@
|
||||
"""The wire format of HALO_PORT_NETWORK_VERSION (port/linux/network_format.txt).
|
||||
|
||||
Taken from the sources: the game's message numbers, sizes and fields
|
||||
(network_messages.c, .h) and the distributed netcode's (network_*.c, .h,
|
||||
map_share*.c, .h): the enums with _distributed_ members, the DISTRIBUTED_
|
||||
constants, the structs sent whole (the _message structs, those whose size is
|
||||
taken, and the structs in them) as hashes, and the constants their arrays
|
||||
are sized by, as their definitions. An entry the netcode packs itself (a
|
||||
unit's state, a relayed action) is covered by its flags and its least and
|
||||
largest sizes only.
|
||||
(network_messages.c, .h), the distributed netcode's (network_*.c, .h,
|
||||
map_share*.c, .h), and the gametype's PC options (game_engine.h's struct
|
||||
game_variant_options) and where the game settings record has them: the enums
|
||||
with _distributed_ members, the DISTRIBUTED_ constants, the structs sent
|
||||
whole (the _message structs, those whose size is taken, and the structs in
|
||||
them) as hashes, and the constants their arrays are sized by, as their
|
||||
definitions. An entry the netcode packs itself (a unit's state, a relayed
|
||||
action) is covered by its flags and its least and largest sizes only.
|
||||
|
||||
test_linux_port.py fails when the sources differ from the record. An item
|
||||
changed or removed is one older builds cannot read: raise the version and
|
||||
@@ -112,6 +113,15 @@ def items():
|
||||
values = sorted({" ".join((define or expression).replace("\\\n", " ").split()) for define, expression in found})
|
||||
add(f"bound {name}", " | ".join(values))
|
||||
pending += re.findall(r"\b[A-Z_][A-Z0-9_]*\b", " ".join(values))
|
||||
# the gametype's PC options, which the game settings record carries
|
||||
# whole, and where that record puts them
|
||||
engine = re.sub(r"/\*.*?\*/|//[^\n]*", " ", (ROOT / "source/game/game_engine.h").read_text(encoding="latin-1"),
|
||||
flags=re.S)
|
||||
add("struct game_variant_options", _hash(next(_blocks(engine, r"^struct game_variant_options\s*\{"))))
|
||||
limits = (ROOT / "port/linux/include/halo_port_limits.h").read_text()
|
||||
for name, value in re.findall(r"^#define (HALO_PORT_NETWORK_GAME_(?:VARIANT_OPTIONS_OFFSET|LOCAL_DATA_OFFSET|SIZE)) "
|
||||
r"(.*)$", limits, re.M):
|
||||
add(f"layout {name}", " ".join(value.split()))
|
||||
messages = texts[-2]
|
||||
for name, size in re.findall(r"^DEFINE_NETWORK_GAME_MESSAGE\((\w+), (.*)\);", messages, re.M):
|
||||
add(f"size {name}", " ".join(size.split()))
|
||||
|
||||
+128
-25
@@ -105,13 +105,13 @@ SCREENS = {
|
||||
("PER-PIXEL LIGHTING:", "display.per_pixel_lighting", ON_OFF,
|
||||
"Light models for each pixel, without the facets\nof the Xbox's lighting for each vertex.", None),
|
||||
("OVERSHIELD:", "display.overshield_effect", ON_OFF,
|
||||
"The overshield rises up the body as it charges\nand stays lit, in its own color. Off: stock.", None),
|
||||
"The overshield rises up the body and stays lit,\nin its own color. Online: the host's choice.", None),
|
||||
("MODEL DETAIL:", "display.model_detail", [("STOCK", "stock"), ("NATIVE", "native"), ("HIGHEST", "highest")],
|
||||
"Stock picks models' detail by the Xbox's 480 lines;\nnative by this display's; highest, always the best.", None),
|
||||
("SHIELD GLOW:", "display.shield_glow", ON_OFF,
|
||||
"Shields light their surroundings as they flare,\nin the shield's own color.", None),
|
||||
"Shields light their surroundings as they flare.\nOnline: the host's choice.", None),
|
||||
("GLOW INTENSITY:", "display.shield_glow_intensity", [("DEFAULT", "default"), ("LIGHT SHOW", "light_show")],
|
||||
"Light Show: the shield glow three times as far,\nat full from a third of the flare.", None),
|
||||
"Light Show: three times as far, at full from a\nthird of the flare. Online: the host's choice.", None),
|
||||
("MATCH TIMER:", "display.match_timer", ON_OFF,
|
||||
"Draw a clock at the bottom right in multiplayer,\ncounting up from the start of the game.", None),
|
||||
("HDR:", "display.hdr", ON_OFF,
|
||||
@@ -647,19 +647,82 @@ MT = "main_menu/multiplayer_type_select"
|
||||
# in turn: menu_functions.c's gametype_option_help)
|
||||
SLAYER_EDIT = "main_menu/settings_select/multiplayer_setup/playlist_edit/slayer_edit"
|
||||
PLAYER_EDIT = "main_menu/settings_select/multiplayer_setup/player_options_edit"
|
||||
# (its rows, the PC version's, in order: ce_menus.py moves them 27 apart)
|
||||
PLAYER_OPTIONS_ROWS = ['number_of_lives', 'maximum_health', 'shields', 'respawn_time', 'respawn_time_growth', 'odd_man_out', 'invisible_players', 'suicide_penalty']
|
||||
# the vehicle sets' PC set (game_engine.h's VARIANT_VEHICLE_SET_PC), between
|
||||
# GUN TURRETS and CUSTOM (menu_functions.c's VEHICLE_PRESET_PC), and its help
|
||||
# among the sets' (its rows' values' in turn: gametype_option_help)
|
||||
VEHICLE_EDIT = "main_menu/settings_select/multiplayer_setup/vehicle_options_edit"
|
||||
AIM_ASSIST_HELP = [
|
||||
"Players keep their current mouse aim assist setting.",
|
||||
"Disable mouse aim assist for mouse/keyboard players.\\nController and touch aim assist are unchanged.",
|
||||
]
|
||||
# the host's shield effects, for every player of a network game
|
||||
# (network_shield_effects.c): their words, then their helps
|
||||
SHIELD_EFFECTS = ['STOCK', 'GLOW', 'LIGHT SHOW', 'OVERSHIELD', 'GLOW+OVERSHIELD', 'SHOW+OVERSHIELD']
|
||||
SHIELD_EFFECTS_HELP = [
|
||||
"Everyone sees the stock game's shields and\\novershield, whatever their own settings.",
|
||||
"Everyone's shields light their surroundings as\\nthey flare.",
|
||||
"Everyone's shields light their surroundings as\\nthey flare, three times as far (Light Show).",
|
||||
"For everyone, the overshield rises up the body\\nand stays lit, in its own color.",
|
||||
"For everyone, shields light their surroundings,\\nand the overshield rises and stays lit.",
|
||||
"For everyone, Light Show's shield glow, and the\\novershield rising and staying lit.",
|
||||
]
|
||||
|
||||
# OpenCE's gametypes' options (port/linux/game/game_modes.c), a screen of the
|
||||
# gametype editor's (menu_functions.c's "mp profile init opence options"): the
|
||||
# mode and Hardcore, then the mode's own rows, which menu_functions.c's
|
||||
# gametype_option_help shows (op_inf_ for Infection, op_gg_ for Gun Game)
|
||||
# below them; a row's values are menu_functions.c's gametype_options'
|
||||
PLAYLIST_EDIT = "main_menu/settings_select/multiplayer_setup/playlist_edit"
|
||||
OPENCE_EDIT = "main_menu/settings_select/multiplayer_setup/opence_options_edit"
|
||||
OPENCE_ROWS = [
|
||||
("oce_mode", "MODE:", ["NONE", "SWAT", "INFECTION", "GUN GAME"], [
|
||||
"The game type's own rules.",
|
||||
"No shields, and a shot to the head kills. Slayer only.",
|
||||
"Humans killed join the zombies, who win when\\nno human is left. Team Slayer only.",
|
||||
"Each kill gives the next weapon; a kill with the\\nlast wins. Free for all Slayer only."]),
|
||||
("oce_hardcore", "HARDCORE:", ["OFF", "ON"], [
|
||||
"The motion sensor and aim assist as the game\\ntype has them.",
|
||||
"No motion sensor, no aim assist, and a kill\\nrestores the killer's health and shields."]),
|
||||
("inf_zombies", "FIRST ZOMBIES:", ["1", "2", "3", "4", "8", "16"],
|
||||
["The zombies chosen when the round starts\\n(a human is always left)."] * 6),
|
||||
("inf_speed", "ZOMBIE SPEED:", ["100%", "110%", "125%", "150%", "175%", "200%"],
|
||||
["How fast zombies move, of a human's speed."] * 6),
|
||||
("inf_damage", "SKULL DAMAGE:", ["100%", "150%", "200%", "250%"],
|
||||
["The damage of a zombie's skull's melee."] * 4),
|
||||
("inf_respawn", "ZOMBIE RESPAWN:", ["1 SECOND", "3 SECONDS", "5 SECONDS", "10 SECONDS", "15 SECONDS",
|
||||
"30 SECONDS"],
|
||||
["How long a dead zombie waits to respawn."] * 6),
|
||||
("inf_countdown", "COUNTDOWN:", ["NONE", "5 SECONDS", "10 SECONDS", "15 SECONDS", "30 SECONDS"],
|
||||
["How long the round waits, once two players are\\nalive, before the first zombies are chosen."] * 5),
|
||||
("inf_shields", "ZOMBIE SHIELDS:", ["OFF", "ON"],
|
||||
["Zombies have no shields.", "Zombies have shields, as humans do."]),
|
||||
("gg_order", "WEAPON ORDER:", ["STRONGEST FIRST", "WEAKEST FIRST", "RANDOM"], [
|
||||
"From the rocket launcher to the pistol.", "From the pistol to the rocket launcher.",
|
||||
"In an order the host draws for each game."]),
|
||||
("gg_melee", "MELEE DEMOTES:", ["OFF", "ON"], [
|
||||
"A melee kill takes nothing from the victim.",
|
||||
"A melee kill takes the victim back a weapon."]),
|
||||
]
|
||||
OPENCE_ITEM = f"{PLAYLIST_EDIT}/playlist_edit_opence_item"
|
||||
|
||||
STRING_INSERTS = {
|
||||
f"{PLAYER_EDIT}/player_options_labels": [(8, ["AIM ASSIST:"])],
|
||||
f"{PLAYER_EDIT}/cap_player_options": [(28, AIM_ASSIST_HELP)],
|
||||
# (the gametype editor's OPENCE OPTIONS' words, after the PC version's:
|
||||
# menu_functions.c's playlist_edit_description)
|
||||
f"{PLAYLIST_EDIT}/playlist_edit_list_extended_dsc_text": [(8, [
|
||||
"Choose the rules of OpenCE's\\ngametypes: SWAT, Infection,\\nGun Game and Hardcore.\\nThis gametype:"])],
|
||||
f"{PLAYER_EDIT}/player_options_labels": [(8, ["AIM ASSIST:", "SHIELD EFFECTS:"])],
|
||||
f"{PLAYER_EDIT}/cap_player_options": [(28, AIM_ASSIST_HELP + SHIELD_EFFECTS_HELP)],
|
||||
# (Teamplay Options' voice chat and vote kick rows, after its own:
|
||||
# TEAMPLAY_ROWS)
|
||||
f"{TEAMPLAY_EDIT}/teamplay_options_labels": [(3, [label for _, label, *_ in TEAMPLAY_ROWS])],
|
||||
f"{TEAMPLAY_EDIT}/cap_teamplay_options": [(10, [text for *_, helps in TEAMPLAY_ROWS for text in helps])],
|
||||
f"{SLAYER_EDIT}/var_kills_to_win": [(5, ["75", "100", "150", "200", "250", "500"])],
|
||||
f"{VEHICLE_EDIT}/var_vehicle_set": [(8, ["PC"])],
|
||||
f"{VEHICLE_EDIT}/cap_vehicle_options": [(17, [
|
||||
"Every vehicle the map places will spawn, as in\\nHalo PC.",
|
||||
])],
|
||||
f"{SLAYER_EDIT}/cap_slayer": [(11, [
|
||||
"Seventy-five kills to win. Settle in for a long\\nfight.",
|
||||
"A hundred kills to win. Made for big games.",
|
||||
@@ -696,7 +759,8 @@ STRING_OVERRIDES.update({
|
||||
"Play the campaign with a\\nfriend in split screen:\\nplayer 2 on a gamepad.",
|
||||
"Set all the attributes for your \\nmultiplayer gametypes and\\nkeep them for future use.",
|
||||
],
|
||||
"main_menu/gametype_select/var_gametype_banks": ["STANDARD", "CUSTOM"],
|
||||
# (and the port's OPENCE: OpenCE's gametypes, port/linux/game/game_modes.c)
|
||||
"main_menu/gametype_select/var_gametype_banks": ["STANDARD", "OPENCE", "CUSTOM"],
|
||||
# (the PC's weapon sets, then the Xbox's NO GRENADES: menu_functions.c's
|
||||
# gametype_options maps them to the engine's)
|
||||
"main_menu/settings_select/multiplayer_setup/item_options_edit/item_options_labels": ["INFINITE GRENADES:", "WEAPON SET:", "VEHICLE SET:", "STARTING EQUIPMENT:",
|
||||
@@ -744,7 +808,7 @@ OVERRIDE_ORIGINALS = {
|
||||
f"{PE}/profile_edit_descriptions": [0, None, None, None, None, None, None, 7, None],
|
||||
f"{MT}/multiplayer_options": [0, 1, 2, 3, None, 5, None, None],
|
||||
f"{MT}/multiplayer_option_descriptions": [0, 1, None, None, 4, None, 5],
|
||||
"main_menu/gametype_select/var_gametype_banks": [0, 2],
|
||||
"main_menu/gametype_select/var_gametype_banks": [0, None, 2],
|
||||
"main_menu/settings_select/multiplayer_setup/item_options_edit/item_options_labels": [0, 1, 2, 3, 4] + [None] * 4,
|
||||
# (the first's note that infinite grenades work only with 4 players or
|
||||
# fewer is left out: not so here)
|
||||
@@ -770,8 +834,15 @@ WIDGET_PATCHES = {
|
||||
f'<child widget="main_menu/main_menu_item_mods" x="{MODS_ITEM_PLACE[0]}" y="{MODS_ITEM_PLACE[1]}"/>']}},
|
||||
f"{PLAYER_EDIT}/player_options_menu": {"insert_before": {
|
||||
f"{PLAYER_EDIT}/player_button_bar": [
|
||||
f'<child widget="{PLAYER_EDIT}/op_aim_assist" x="54" y="313"/>']}},
|
||||
f'<child widget="{PLAYER_EDIT}/op_aim_assist" x="54" y="289"/>',
|
||||
f'<child widget="{PLAYER_EDIT}/op_shield_effects" x="54" y="316"/>']}},
|
||||
# (its rows 27 apart, not 30, so that ten fit above the help, which keeps
|
||||
# the three lines some have: ce_menus.py's CHILD_OFFSETS)
|
||||
f"{PLAYER_EDIT}/player_options_help": {"set": {"top": 345, "height": 60}},
|
||||
# (the gametype editor's OPENCE OPTIONS, after its own rows: _opence_options)
|
||||
f"{PLAYLIST_EDIT}/edit_playlist_select_list": {
|
||||
"insert_before": {f"{PLAYLIST_EDIT}/playlist_edit_button_bar": [f'<child widget="{OPENCE_ITEM}"/>']},
|
||||
"inputs": ["port playlist edit desc"]},
|
||||
# (the profile settings' picture: on Gamepad Setup's row, the profile's
|
||||
# button settings, BITMAP_FRAMES; menu_functions.c's
|
||||
# profile_gamepad_layout)
|
||||
@@ -1249,6 +1320,12 @@ COOP_SETUP_SCREENS = [
|
||||
"Players bump into each other, as in the campaign.",
|
||||
"Players walk through each other, so that no one\\nblocks a doorway. The AI's characters still block.",
|
||||
]),
|
||||
# (network.coop_ally_friendly_fire: game_engine.c's
|
||||
# game_engine_friendly_damage)
|
||||
("coop_ally_friendly_fire", "ALLY FRIENDLY FIRE:", ["ON", "OFF"], [
|
||||
"Players can hurt and kill their AI allies, as in\\nthe campaign.",
|
||||
"Players can not hurt their AI allies, so that no\\none can kill Keyes or the Marines a level needs.",
|
||||
]),
|
||||
]),
|
||||
("voice_options", "VOICE AND VOTING", "Voice chat, text chat and votes to kick a player,\\nfor this game.",
|
||||
TEAMPLAY_ROWS),
|
||||
@@ -1588,24 +1665,49 @@ def _item_options_extras() -> list:
|
||||
|
||||
|
||||
def _player_options_extras() -> list:
|
||||
"""The host's aim-assist policy, hidden while editing saved gametypes."""
|
||||
"""The host's aim-assist policy and shield effects, hidden while editing
|
||||
saved gametypes."""
|
||||
base = PLAYER_EDIT
|
||||
lines = _widget(f"{base}/op_aim_assist", [("width", 512), ("height", 28),
|
||||
("flags", "pass_unhandled_to_focused_child"), ("bitmap", "bitmaps/option_bkds"),
|
||||
("color", "#FF2896FF")], [f'<child widget="{base}/aim_assist_label"/>',
|
||||
f'<child widget="{base}/aim_assist_spinner" x="286" y="1"/>'])
|
||||
lines += _widget(f"{base}/aim_assist_label", [("type", "text"), ("controller", 1),
|
||||
("width", 280), ("height", 22), ("string_list", f"{base}/player_options_labels"),
|
||||
("string_index", 8), ("font", "ui\\large_ui"), ("color", "#FF2896FF"),
|
||||
("text_x", 13), ("text_y", 4)], [])
|
||||
lines += _widget(f"{base}/aim_assist_spinner", [("type", "spinner"), ("top", 2),
|
||||
("width", 206), ("height", 20), ("flags", "pass_unhandled_to_focused_child left_right_tabs_items"),
|
||||
("string_list", f"{base}/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"/>'])
|
||||
return lines + _strings(f"{base}/var_aim_assist", ["ALLOWED", "BLOCK M+KB"])
|
||||
lines = []
|
||||
for key, label_index, words in (("aim_assist", 8, ["ALLOWED", "BLOCK M+KB"]),
|
||||
("shield_effects", 9, SHIELD_EFFECTS)):
|
||||
lines += _widget(f"{base}/op_{key}", [("width", 512), ("height", 28),
|
||||
("flags", "pass_unhandled_to_focused_child"), ("bitmap", "bitmaps/option_bkds"),
|
||||
("color", "#FF2896FF")], [f'<child widget="{base}/{key}_label"/>',
|
||||
f'<child widget="{base}/{key}_spinner" x="286" y="1"/>'])
|
||||
lines += _widget(f"{base}/{key}_label", [("type", "text"), ("controller", 1),
|
||||
("width", 280), ("height", 22), ("string_list", f"{base}/player_options_labels"),
|
||||
("string_index", label_index), ("font", "ui\\large_ui"), ("color", "#FF2896FF"),
|
||||
("text_x", 13), ("text_y", 4)], [])
|
||||
lines += _widget(f"{base}/{key}_spinner", [("type", "spinner"), ("top", 2),
|
||||
("width", 206), ("height", 20), ("flags", "pass_unhandled_to_focused_child left_right_tabs_items"),
|
||||
("string_list", f"{base}/var_{key}"), ("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"/>'])
|
||||
return lines + _strings(f"{base}/var_aim_assist", ["ALLOWED", "BLOCK M+KB"]) + \
|
||||
_strings(f"{base}/var_shield_effects", SHIELD_EFFECTS)
|
||||
|
||||
|
||||
def _opence_options() -> list:
|
||||
"""the gametype editor's OPENCE OPTIONS: its row, after the editor's own
|
||||
(as they are laid out), and its screen, as the gametype's options' are
|
||||
(_setup_option_screen), its spinners the gametype's (menu_functions.c's
|
||||
gametype_options), its header its words (no picture of its own)"""
|
||||
lines = _setup_option_screen(OPENCE_EDIT, "opence", OPENCE_ROWS)
|
||||
lines = [line.replace("port setup options init", "mp profile init opence options")
|
||||
.replace("port setup options save", "mp profile set opence options")
|
||||
.replace(f'bitmap="{OPENCE_EDIT}/header_opence"',
|
||||
'type="text" text="OPENCE OPTIONS" font="ui\\large_ui" color="#FFFFFFFF" text_x="13" text_y="16"')
|
||||
for line in lines]
|
||||
lines += _widget(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)],
|
||||
[f'<on event="a" open="{OPENCE_EDIT}/opence_screen"/>',
|
||||
f'<on event="start" open="{OPENCE_EDIT}/opence_screen"/>',
|
||||
'<on event="left_mouse" run="mouse emit accept event"/>'])
|
||||
return lines
|
||||
|
||||
|
||||
def _teamplay_options_extras() -> list:
|
||||
@@ -1676,6 +1778,7 @@ def multiplayer_files() -> dict:
|
||||
"main_menu/settings_select/multiplayer_setup/item_options_edit".replace("/", ".") + ".port.xml": head + _item_options_extras() + ["</menus>", ""],
|
||||
PLAYER_EDIT.replace("/", ".") + ".port.xml": head + _player_options_extras() + ["</menus>", ""],
|
||||
TEAMPLAY_EDIT.replace("/", ".") + ".port.xml": head + _teamplay_options_extras() + ["</menus>", ""],
|
||||
OPENCE_EDIT.replace("/", ".") + ".port.xml": head + _opence_options() + ["</menus>", ""],
|
||||
MODS.replace("/", ".") + ".xml": [head[0], "<!-- The port's Mods screen, in the PC version's style "
|
||||
"(tools/port_settings.py) -->", head[2]] + _mods() + ["</menus>", ""],
|
||||
}
|
||||
|
||||
@@ -0,0 +1,300 @@
|
||||
"""Android CE stable storage, upload reuse, HUD residency and state isolation."""
|
||||
from pathlib import Path
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import pytest
|
||||
from harness import function
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
def run_c(tmp_path, code):
|
||||
compiler = shutil.which("clang")
|
||||
if not compiler:
|
||||
pytest.skip("clang required")
|
||||
path = tmp_path / "cache.c"
|
||||
path.write_text(code)
|
||||
exe = tmp_path / ("cache.exe" if os.name == "nt" else "cache")
|
||||
target = ["--target=i686-pc-windows-msvc", "-fuse-ld=lld", "-D_CRT_SECURE_NO_WARNINGS"] if os.name == "nt" else ["-m32"]
|
||||
result = subprocess.run([compiler, *target, "-std=gnu89", "-Werror=format", str(path), "-o", str(exe)], capture_output=True, text=True)
|
||||
assert result.returncode == 0, result.stderr
|
||||
result = subprocess.run([str(exe)], capture_output=True, text=True)
|
||||
assert result.returncode == 0, result.stderr
|
||||
|
||||
|
||||
GPU_FIXTURE = r'''
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
typedef unsigned int DWORD, GLuint, GLenum, D3DCOLOR;
|
||||
typedef int BOOL;
|
||||
typedef unsigned long long Uint64;
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define GL_TEXTURE_2D 1
|
||||
#define GL_TEXTURE_CUBE_MAP 2
|
||||
#define GL_TEXTURE_3D 3
|
||||
#define D3DFORMAT_FORMAT_MASK 255
|
||||
#define D3DFORMAT_FORMAT_SHIFT 0
|
||||
#define PLATFORM_PHYSICAL_TO_VIRTUAL(x) ((void *)(uintptr_t)(x))
|
||||
struct xgpu_texture_description {
|
||||
unsigned long width, height, depth, levels, format;
|
||||
BOOL cube_map;
|
||||
};
|
||||
static unsigned long serial=1, generation=1, uploads, next_texture;
|
||||
static unsigned long memory_watch_serial(void) { return serial; }
|
||||
static unsigned long memory_watch_generation(unsigned long a,unsigned long s) { return generation; }
|
||||
static void memory_watch_protect(unsigned long a,unsigned long s) {}
|
||||
static BOOL config_boolean(const char *s) { return FALSE; }
|
||||
static unsigned long log_count;
|
||||
static void platform_log(const char *s,...) { log_count++; }
|
||||
static void xgpu_texture_describe(DWORD f,DWORD s,struct xgpu_texture_description *d) {
|
||||
memset(d,0,sizeof(*d));d->width=d->height=16;d->depth=d->levels=1;
|
||||
}
|
||||
static BOOL texture_size_supported(const struct xgpu_texture_description *d) { return TRUE; }
|
||||
static unsigned long xgpu_texture_face_size(const struct xgpu_texture_description *d) { return 1024; }
|
||||
static unsigned long xgpu_texture_level_offset(const struct xgpu_texture_description *d,int l) { return 1024; }
|
||||
static void glGenTextures(int n,GLuint *t) { *t=++next_texture; }
|
||||
static void glDeleteTextures(int n,GLuint *t) {}
|
||||
static void xgpu_gl_state_invalidate(void) {}
|
||||
static long hud_hires_override_find(unsigned long a,unsigned long w,unsigned long h,unsigned long b) { return -1; }
|
||||
static GLuint hud_hires_override_texture(long i,unsigned long *l) { return 0; }
|
||||
static BOOL platform_is_contiguous(void *p) { return TRUE; }
|
||||
static unsigned char custom_edition_texels_order(unsigned long a) { return 0; }
|
||||
static void xgpu_statistics_texture_upload(unsigned long s) {}
|
||||
static void upload(GLuint t,GLenum g,const struct xgpu_texture_description *d,const unsigned char *b,const D3DCOLOR *p,unsigned char c) { uploads++; }
|
||||
'''
|
||||
|
||||
def storage_program():
|
||||
gpu = (ROOT/'port/linux/src/xbox_textures.c').read_text()
|
||||
code = '#define HALO_ANDROID 1\n' + GPU_FIXTURE
|
||||
code = code.replace('static BOOL platform_is_contiguous(void *p) { return TRUE; }',
|
||||
'static BOOL platform_is_contiguous(void *p) { return FALSE; }')
|
||||
code += r'''
|
||||
struct bitmap_data { void *base_address; };
|
||||
static unsigned long reads, unbinds, channel_forgets;
|
||||
static int fail_allocation;
|
||||
static void *storage_calloc(size_t n,size_t s) {
|
||||
if(fail_allocation && --fail_allocation==0)return NULL;
|
||||
return calloc(n,s);
|
||||
}
|
||||
static void halo_custom_edition_texels_channels(const void *p,unsigned char order) { channel_forgets++; }
|
||||
void android_ce_texture_unbind(const void *r) { unbinds++; }
|
||||
'''
|
||||
code += (ROOT/'port/linux/game/android_ce_texture_cache.h').read_text()
|
||||
storage = (ROOT/'port/linux/game/android_ce_texture_cache.c').read_text()
|
||||
# cseries redirects free, but not calloc. Exercise the production source's
|
||||
# allocator pairing, including unload, instead of hiding it in this fixture.
|
||||
code += '#define free(p) abort()\n#define calloc storage_calloc\n'
|
||||
code += re.sub(r'^#include .*$', '', storage, flags=re.M)
|
||||
code += '#undef calloc\n'
|
||||
code += gpu[gpu.index('struct texture_entry\n'):gpu.index('/* (every bit of the three mixed')]
|
||||
for name in ('bucket_index', 'palette_hash', 'android_ce_texture_gpu_forget', 'texture_entry_pixels_valid'):
|
||||
code += function(gpu, name) + '\n'
|
||||
code += r'''
|
||||
static GLuint texture_entry_result(struct texture_entry *e,GLenum *t,struct xgpu_texture_description *d) {
|
||||
*t=e->target;*d=e->description;return e->texture;
|
||||
}
|
||||
static void read_pixels(struct bitmap_data *b,void *h) {
|
||||
unsigned long *header=h;reads++;header[3]=0;header[4]=0;
|
||||
((unsigned char *)b->base_address)[0]=42;
|
||||
}
|
||||
#define CHECK(x) do { if(!(x)) {fprintf(stderr,"line %d: %s\n",__LINE__,#x);return 1;} } while(0)
|
||||
'''
|
||||
return code + gpu_lookup(gpu)
|
||||
|
||||
|
||||
def gpu_lookup(source):
|
||||
# Exercise the common texture lookup; other owners dispatch before it.
|
||||
lookup = function(source, 'xgpu_texture_get')
|
||||
return lookup[:lookup.index('{') + 1] + '\n' + lookup[lookup.index('\tDWORD data ='):]
|
||||
|
||||
|
||||
|
||||
@pytest.mark.parametrize('scenario', ['working_set', 'eviction', 'capacity', 'reload', 'bounds', 'palette', 'oom', 'resident'])
|
||||
def test_stable_ce_storage_and_real_gpu_lookup(tmp_path, scenario):
|
||||
cases = {
|
||||
'working_set': r'''
|
||||
/* 80 MiB of same-frame demand exceeds the old fixed 36 MiB arena.
|
||||
* Repeated frames must not reload pixels, relocate them, or re-upload them. */
|
||||
for(i=0;i<80;i++) {
|
||||
headers[i]=android_ce_texture_get(&bitmaps[i],1024*1024,1,read_pixels);CHECK(headers[i]);
|
||||
CHECK(xgpu_texture_get(headers[i],NULL,&target,&description)!=0);
|
||||
}
|
||||
CHECK(reads==80 && uploads==80 && cache_bytes==80UL*1024*1024);
|
||||
for(frame=0;frame<120;frame++) {
|
||||
android_ce_texture_idle();serial++;generation++;
|
||||
for(i=0;i<80;i++) {
|
||||
CHECK(android_ce_texture_get(&bitmaps[i],1024*1024,1,read_pixels)==headers[i]);
|
||||
xgpu_texture_get(headers[i],NULL,&target,&description);
|
||||
}
|
||||
}
|
||||
CHECK(reads==80 && uploads==80 && !cache_evictions && !cache_failed && !log_count);
|
||||
android_ce_texture_reset();CHECK(cache_bytes==0 && cache_count==0 && unbinds==80 && log_count==1);
|
||||
for(i=0;i<80;i++)CHECK(bitmaps[i].base_address==NULL);
|
||||
for(i=0;i<TEXTURE_BUCKET_COUNT;i++)CHECK(texture_buckets[i]==NULL);''',
|
||||
'eviction': r'''
|
||||
headers[0]=android_ce_texture_get(&bitmaps[0],80UL*1024*1024,1,read_pixels);CHECK(headers[0]);
|
||||
xgpu_texture_get(headers[0],NULL,&target,&description);
|
||||
android_ce_texture_idle();
|
||||
headers[1]=android_ce_texture_get(&bitmaps[1],60UL*1024*1024,1,read_pixels);CHECK(headers[1]);
|
||||
CHECK(!bitmaps[0].base_address && cache_evictions==1 && unbinds==1 && cache_bytes==60UL*1024*1024);
|
||||
CHECK(android_ce_texture_get(&bitmaps[0],1024,0,read_pixels)==NULL);
|
||||
xgpu_texture_get(headers[1],NULL,&target,&description);CHECK(uploads==2);
|
||||
android_ce_texture_reset();''',
|
||||
'capacity': r'''
|
||||
CHECK(android_ce_texture_get(&bitmaps[0],80UL*1024*1024,1,read_pixels));
|
||||
CHECK(!android_ce_texture_get(&bitmaps[1],60UL*1024*1024,1,read_pixels));
|
||||
CHECK(cache_failed==1 && cache_count==1 && !unbinds);
|
||||
CHECK(!android_ce_texture_get(&bitmaps[1],~0UL,1,read_pixels));
|
||||
CHECK(!android_ce_texture_get(&bitmaps[1],0,1,read_pixels));
|
||||
CHECK(log_count==1);
|
||||
android_ce_texture_reset();''',
|
||||
'reload': r'''
|
||||
for(i=0;i<20;i++) {
|
||||
headers[0]=android_ce_texture_get(&bitmaps[0],1024,1,read_pixels);CHECK(headers[0]);
|
||||
xgpu_texture_get(headers[0],NULL,&target,&description);CHECK(uploads==(unsigned long)i+1);
|
||||
android_ce_texture_delete(&bitmaps[0]);
|
||||
CHECK(!bitmaps[0].base_address && cache_bytes==0);
|
||||
CHECK(!android_ce_texture_pixels(headers[0],&bytes) && bytes==0);
|
||||
}
|
||||
CHECK(unbinds==20 && channel_forgets==20);''',
|
||||
'bounds': r'''
|
||||
headers[0]=android_ce_texture_get(&bitmaps[0],512,1,read_pixels);CHECK(headers[0]);
|
||||
xgpu_texture_get(headers[0],NULL,&target,&description);CHECK(uploads==0);
|
||||
/* A matching Data word without the registered header grants no heap access. */
|
||||
memcpy(fake,headers[0],sizeof(fake));
|
||||
xgpu_texture_get(fake,NULL,&target,&description);CHECK(uploads==0);
|
||||
android_ce_texture_reset();''',
|
||||
'palette': r'''
|
||||
headers[0]=android_ce_texture_get(&bitmaps[0],1024,1,read_pixels);CHECK(headers[0]);
|
||||
((DWORD *)headers[0])[3]=11;
|
||||
xgpu_texture_get(headers[0],palette,&target,&description);CHECK(uploads==1);
|
||||
palette[5]=42;xgpu_texture_get(headers[0],palette,&target,&description);CHECK(uploads==2);
|
||||
palette[5]=0;xgpu_texture_get(headers[0],palette,&target,&description);CHECK(uploads==2);
|
||||
android_ce_texture_reset();
|
||||
for(i=0;i<TEXTURE_BUCKET_COUNT;i++)CHECK(texture_buckets[i]==NULL);''',
|
||||
'oom': r'''
|
||||
for(i=1;i<=2;i++) {
|
||||
fail_allocation=i;
|
||||
CHECK(!android_ce_texture_get(&bitmaps[0],1024,1,read_pixels));
|
||||
CHECK(!bitmaps[0].base_address && !cache_bytes && !cache_count && !reads);
|
||||
}
|
||||
fail_allocation=0;
|
||||
CHECK(android_ce_texture_get(&bitmaps[0],1024,1,read_pixels));
|
||||
android_ce_texture_reset();''',
|
||||
'resident': r'''
|
||||
CHECK(!android_ce_texture_resident(&bitmaps[0]));
|
||||
headers[0]=android_ce_texture_get(&bitmaps[0],80UL*1024*1024,1,read_pixels);
|
||||
CHECK(headers[0] && android_ce_texture_resident(&bitmaps[0]));
|
||||
android_ce_texture_idle();
|
||||
/* HUD classification must not pin every registered bitmap for this frame. */
|
||||
CHECK(android_ce_texture_resident(&bitmaps[0]));
|
||||
CHECK(android_ce_texture_get(&bitmaps[1],60UL*1024*1024,1,read_pixels));
|
||||
CHECK(!android_ce_texture_resident(&bitmaps[0]));
|
||||
cache_frame=~0UL;android_ce_texture_idle();CHECK(cache_frame==1);
|
||||
CHECK(android_ce_texture_get(&bitmaps[0],80UL*1024*1024,1,read_pixels));
|
||||
android_ce_texture_reset();''',
|
||||
}
|
||||
code = storage_program() + r'''
|
||||
int main(void) {
|
||||
struct bitmap_data bitmaps[80]={{0}};void *headers[80];
|
||||
DWORD fake[5]={0};D3DCOLOR palette[256]={0};unsigned long bytes;
|
||||
GLenum target;struct xgpu_texture_description description;int i,frame;
|
||||
''' + cases[scenario] + '\nreturn 0;}\n'
|
||||
run_c(tmp_path, code)
|
||||
|
||||
|
||||
def test_android_ce_scope_and_cleanup():
|
||||
source = (ROOT/'source/cache/xbox_texture_cache.c').read_text()
|
||||
get = function(source, '_texture_cache_bitmap_get_hardware_format')
|
||||
assert 'custom_edition_cache_tags_loaded()' in get
|
||||
assert 'TEST_FLAG(bitmap->flags, _bitmap_cached_bit)' in get
|
||||
assert 'texture_cache_bitmap_valid(bitmap)' in get
|
||||
stripped = re.sub(r'#ifdef HALO_ANDROID\n.*?#endif', '', source, flags=re.S)
|
||||
assert 'android_ce_texture_' not in stripped
|
||||
assert 'android_ce_texture_delete(bitmap)' in function(source, 'texture_cache_bitmap_delete')
|
||||
assert 'android_ce_texture_reset()' in function(source, 'texture_cache_flush')
|
||||
|
||||
|
||||
@pytest.mark.parametrize('android', [False, True])
|
||||
def test_hud_residency_uses_the_correct_owner(tmp_path, android):
|
||||
source = (ROOT/'port/linux/game/hud_hires_tags.c').read_text()
|
||||
code = ('#define HALO_ANDROID 1\n' if android else '') + r'''
|
||||
#define TRUE 1
|
||||
#define NONE -1
|
||||
typedef int boolean;
|
||||
struct bitmap_data { long cache_block_index; };
|
||||
static int resident;
|
||||
static int android_ce_texture_resident(const struct bitmap_data *b) { return resident; }
|
||||
''' + function(source, 'hud_hires_bitmap_resident') + r'''
|
||||
int main(void) {
|
||||
struct bitmap_data b={NONE};
|
||||
if(hud_hires_bitmap_resident(&b))return 1;
|
||||
b.cache_block_index=3;if(!hud_hires_bitmap_resident(&b))return 2;
|
||||
b.cache_block_index=NONE;resident=1;
|
||||
'''
|
||||
code += f'if(hud_hires_bitmap_resident(&b)!={int(android)})return 3;\nreturn 0;}}\n'
|
||||
run_c(tmp_path, code)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('platform', ['android', 'desktop', 'web'])
|
||||
def test_normal_gpu_cache_keeps_write_tracking(tmp_path, platform):
|
||||
gpu = (ROOT/'port/linux/src/xbox_textures.c').read_text()
|
||||
code = ('#define HALO_ANDROID 1\n' if platform == 'android' else
|
||||
'#define HALO_WEB 1\n' if platform == 'web' else '') + GPU_FIXTURE
|
||||
code += 'static const void *android_ce_texture_pixels(const void *r,unsigned long *b) { *b=0;return NULL; }\n'
|
||||
code += gpu[gpu.index('struct texture_entry\n'):gpu.index('/* (every bit of the three mixed')]
|
||||
for name in ('bucket_index', 'palette_hash', 'texture_entry_pixels_valid'):
|
||||
code += function(gpu,name) + '\n'
|
||||
code += r'''
|
||||
static GLuint texture_entry_result(struct texture_entry *e,GLenum *t,struct xgpu_texture_description *d) {
|
||||
*t=e->target;*d=e->description;return e->texture;
|
||||
}
|
||||
'''
|
||||
code += gpu_lookup(gpu) + r'''
|
||||
int main(void) {
|
||||
DWORD header[5]={0};GLenum target;struct xgpu_texture_description description;
|
||||
xgpu_texture_get(header,NULL,&target,&description);
|
||||
if(uploads!=1)return 1;
|
||||
xgpu_texture_get(header,NULL,&target,&description);
|
||||
if(uploads!=1)return 2;
|
||||
serial++;generation++;
|
||||
xgpu_texture_get(header,NULL,&target,&description);
|
||||
if(uploads!=2)return 3;
|
||||
return 0;
|
||||
}
|
||||
'''
|
||||
run_c(tmp_path,code)
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Mjolnir VR does not refresh the GL state before every draw (d3d8_gl.c's prepare_draw)")
|
||||
@pytest.mark.parametrize('platform', ['android', 'desktop', 'web'])
|
||||
def test_draw_refresh_is_android_only(tmp_path, platform):
|
||||
draw = function((ROOT/'port/linux/src/d3d8_gl.c').read_text(),'prepare_draw')
|
||||
block = re.search(r'#ifdef HALO_ANDROID\n\t/\* Refresh GL shadow.*?#endif',draw,re.S).group()
|
||||
assert draw.index(block) < draw.index('bind_textures(')
|
||||
code = ('#define HALO_ANDROID 1\n' if platform == 'android' else
|
||||
'#define HALO_WEB 1\n' if platform == 'web' else '')
|
||||
code += 'static int refreshes;static void xgpu_gl_state_invalidate(void){refreshes++;}\nint main(void){\n'
|
||||
code += block + '\nreturn refreshes!=' + str(int(platform == 'android')) + ';}\n'
|
||||
run_c(tmp_path,code)
|
||||
|
||||
|
||||
def test_unbind_clears_only_owned_headers(tmp_path):
|
||||
source = (ROOT/'port/linux/src/d3d8_gl.c').read_text()
|
||||
code = r'''
|
||||
#include <stddef.h>
|
||||
#define D3DTSS_MAXSTAGES 4
|
||||
static struct { void *textures[4]; } device;
|
||||
static int refreshes;
|
||||
static void xgpu_gl_state_invalidate(void) {refreshes++;}
|
||||
''' + function(source,'android_ce_texture_unbind') + r'''
|
||||
int main(void) {
|
||||
int own,other;device.textures[0]=&own;device.textures[1]=&other;device.textures[3]=&own;
|
||||
android_ce_texture_unbind(&own);
|
||||
return device.textures[0]!=NULL || device.textures[1]!=&other || device.textures[3]!=NULL || refreshes!=1;
|
||||
}
|
||||
'''
|
||||
run_c(tmp_path,code)
|
||||
@@ -0,0 +1,80 @@
|
||||
"""Check Android geometry streaming and preserved desktop/web caching.
|
||||
|
||||
Compile the production mirror and frame rotation. Model driver storage
|
||||
renaming, not a particular phone; this does not establish the device cause.
|
||||
"""
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
|
||||
from harness import function, mutated
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
# (Mjolnir VR keeps the geometry cache on Android: d3d8_gl.c's mirror_range)
|
||||
pytestmark = pytest.mark.skip(reason="Mjolnir VR keeps the Android geometry cache")
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def mirror_uploads(tmp_path_factory):
|
||||
compiler = shutil.which(os.environ.get("CC", "clang"))
|
||||
if not compiler:
|
||||
pytest.skip("clang required")
|
||||
renderer = (ROOT / "port/linux/src/d3d8_gl.c").read_text()
|
||||
mirror = renderer[renderer.index("#define MIRROR_SEGMENT_SIZE"):
|
||||
renderer.index("/* the smallest and largest index of an index range")]
|
||||
present = function(renderer, "D3DDevice_Present")
|
||||
rotation = present[present.index("host_gl_fence_frame("):
|
||||
present.index("if (xgpu_capabilities.atomic_counters && device.ring_test_count")]
|
||||
directory = tmp_path_factory.mktemp("android-mirror-regression")
|
||||
target = ["--target=i686-pc-windows-msvc", "-fuse-ld=lld"] if os.name == "nt" else ["-m32"]
|
||||
binaries = {}
|
||||
for variant, defines in (("android", ["-DHALO_ANDROID=1"]), ("android-cached", ["-DHALO_ANDROID=1"]),
|
||||
("gles", []), ("web", ["-DHALO_WEB=1"]),
|
||||
("desktop", ["-DTEST_DESKTOP=1"]), ("unguarded", [])):
|
||||
work = directory / variant
|
||||
work.mkdir()
|
||||
selected = mutated(mirror,
|
||||
"unused && device.frame - mirror.subdata_frame[segment] >= STREAM_BUFFER_RING",
|
||||
"unused") if variant == "unguarded" else mirror
|
||||
if variant == "android-cached":
|
||||
selected = mutated(selected,
|
||||
"/* Persistent geometry caching causes corruption on affected Android\n"
|
||||
"\tdevices. Use current vertex/index bytes through the streaming path. */\n"
|
||||
"\treturn FALSE;",
|
||||
"/* Control: leave the cache enabled. */")
|
||||
(work / "mirror.inc").write_text(selected)
|
||||
(work / "rotation.inc").write_text(rotation)
|
||||
executable = work / ("test.exe" if os.name == "nt" else "test")
|
||||
result = subprocess.run(
|
||||
[compiler, *target, *defines, "-std=gnu89", "-Wall", "-Wextra", "-Werror",
|
||||
"-Wno-unused-function", "-O2", "-I", str(work),
|
||||
str(ROOT / "port/android/tests/mirror_upload_test.c"), "-o", str(executable)],
|
||||
capture_output=True, text=True)
|
||||
assert result.returncode == 0, result.stdout + result.stderr
|
||||
binaries[variant] = executable
|
||||
return binaries
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", ["reuse", "rollover"])
|
||||
@pytest.mark.parametrize("variant", ["android", "android-cached", "gles", "web", "desktop", "unguarded"])
|
||||
def test_mirror_upload_ordering(mirror_uploads, case, variant):
|
||||
result = subprocess.run([str(mirror_uploads[variant]), case], capture_output=True, text=True, timeout=15)
|
||||
if variant == "android-cached":
|
||||
assert result.returncode == 1, result.stdout + result.stderr
|
||||
assert result.stderr.rstrip().endswith(
|
||||
": !mirror_range(PLATFORM_CONTIGUOUS_BASE, 300 * 4096, &buffer, &offset, &generation)"), result.stderr
|
||||
elif variant == "unguarded":
|
||||
assert result.returncode == 1, result.stdout + result.stderr
|
||||
assert "repair_uploads=0" in result.stderr, result.stderr
|
||||
assert result.stderr.rstrip().endswith(": overlaps == 0 && mismatches == 0"), result.stderr
|
||||
assert "overlaps=0 " not in result.stderr and "bad_draws=0 " not in result.stderr, result.stderr
|
||||
else:
|
||||
assert result.returncode == 0, result.stdout + result.stderr
|
||||
if variant == "android":
|
||||
assert "bypassed=4800 allocations=0 uploads=0 watch_reads=0 protections=0" in result.stderr, result.stderr
|
||||
elif variant == "desktop":
|
||||
assert "mapped=0 " in result.stderr, result.stderr
|
||||
Reference in new issue
Block a user