forked from Ports/perfect_dark
Compare commits
138
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9625cd7d28 | ||
|
|
0e2de3b746 | ||
|
|
32417c164c | ||
|
|
1db33f278b | ||
|
|
abc6612641 | ||
|
|
57b1e37397 | ||
|
|
3f3c091289 | ||
|
|
41ddcc7822 | ||
|
|
6708bf2aa6 | ||
|
|
c16aa70a66 | ||
|
|
60c30e9b67 | ||
|
|
bc01ff558f | ||
|
|
8c844874e7 | ||
|
|
2e18ffdad9 | ||
|
|
b2ea9aa5f2 | ||
|
|
b9a51e4a62 | ||
|
|
b72d7f54e1 | ||
|
|
d8b21f78e0 | ||
|
|
0d0de5b0d4 | ||
|
|
7667d37ff0 | ||
|
|
cf7c4d4239 | ||
|
|
adcf56ed34 | ||
|
|
5e65e84210 | ||
|
|
63a9a26908 | ||
|
|
f4530633d6 | ||
|
|
94e244a236 | ||
|
|
92d3a9f564 | ||
|
|
44a67e60e8 | ||
|
|
634eecb35d | ||
|
|
a0db91a0c9 | ||
|
|
6b105d0be0 | ||
|
|
11febd7ace | ||
|
|
dface4696c | ||
|
|
0669ce5668 | ||
|
|
6d3ea5b0fd | ||
|
|
409e955883 | ||
|
|
f006f9ba7b | ||
|
|
6a03e8d9cf | ||
|
|
a1af5b655a | ||
|
|
edeafa596d | ||
|
|
b954e3ce80 | ||
|
|
bfa4035642 | ||
|
|
35be4d589e | ||
|
|
884a30f970 | ||
|
|
7288947390 | ||
|
|
c444e76ecb | ||
|
|
c4b1a8d4a2 | ||
|
|
7c8b1176c7 | ||
|
|
c5a088e7b8 | ||
|
|
8e443d4830 | ||
|
|
2cb52b749c | ||
|
|
de14f90daf | ||
|
|
9afc7e113e | ||
|
|
fbfe4b4564 | ||
|
|
4cb99506cb | ||
|
|
562e763fbd | ||
|
|
952de6e82b | ||
|
|
7ec54e6d0b | ||
|
|
e6df6014c7 | ||
|
|
e688a1c6e6 | ||
|
|
e44298d0c2 | ||
|
|
31cd8fc28a | ||
|
|
a46ce32ad4 | ||
|
|
31d8aae704 | ||
|
|
4b30f52b32 | ||
|
|
c8d42bbf20 | ||
|
|
511d6ca299 | ||
|
|
33f6d643be | ||
|
|
c2d09135f7 | ||
|
|
9f6b21e870 | ||
|
|
4eca4a1f07 | ||
|
|
4439fdf411 | ||
|
|
6ac8a1a0f6 | ||
|
|
f4ec781b8e | ||
|
|
5e256ea406 | ||
|
|
5abb0e484e | ||
|
|
16c247a24e | ||
|
|
0737c688d7 | ||
|
|
9de245eab6 | ||
|
|
a3cc54d33a | ||
|
|
a261246e64 | ||
|
|
2e195fe21a | ||
|
|
36a692991f | ||
|
|
ca0e3c3060 | ||
|
|
39474e97a7 | ||
|
|
b74cd095a1 | ||
|
|
96e1c57f61 | ||
|
|
f6ee8bbf71 | ||
|
|
188faeecf6 | ||
|
|
2c0a0a1337 | ||
|
|
7f92551d5a | ||
|
|
f54dbb596e | ||
|
|
aa3c5a85b7 | ||
|
|
f46e112c3d | ||
|
|
bcb5b3f5c1 | ||
|
|
65589e2fd2 | ||
|
|
54fbd8ba54 | ||
|
|
49129dd3e7 | ||
|
|
7bfa2b9425 | ||
|
|
53fbbb8a10 | ||
|
|
7bee9cdcfc | ||
|
|
928544ae5f | ||
|
|
312c752205 | ||
|
|
a5d1c25fea | ||
|
|
7abebe7405 | ||
|
|
ebc126f837 | ||
|
|
67bc9c4858 | ||
|
|
c4a3c18208 | ||
|
|
cf1b87a833 | ||
|
|
fb123603ca | ||
|
|
b3ab58da3b | ||
|
|
6374fc834c | ||
|
|
6df31649f5 | ||
|
|
9de6b580ba | ||
|
|
8eb6880694 | ||
|
|
fe4d86fae1 | ||
|
|
8492670bad | ||
|
|
04f95ed1d1 | ||
|
|
ee037c10ce | ||
|
|
cbf65e53b9 | ||
|
|
8c2b15d649 | ||
|
|
2134571b9a | ||
|
|
a541c79eda | ||
|
|
454086be6b | ||
|
|
6bd5997059 | ||
|
|
99911b2290 | ||
|
|
95d8b0692f | ||
|
|
e85cc3b309 | ||
|
|
2a01d562c3 | ||
|
|
51daf45c19 | ||
|
|
c9bd2bfd54 | ||
|
|
6225f62412 | ||
|
|
d2ffd73dea | ||
|
|
02329b64a1 | ||
|
|
aae0f70dd3 | ||
|
|
41d9cb4578 | ||
|
|
370047b1b0 | ||
|
|
6fc99e4c23 |
No files matched your search
@@ -2,7 +2,7 @@ name: C/C++ CI
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "port" ]
|
branches: [ "port", "port-net" ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "port" ]
|
branches: [ "port" ]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|||||||
+1
-1
@@ -151,7 +151,7 @@ G_DIR := src/generated/$(ROMID)
|
|||||||
|
|
||||||
ifneq (,$(findstring windows,$(TARGET_PLATFORM)))
|
ifneq (,$(findstring windows,$(TARGET_PLATFORM)))
|
||||||
TARGET_CFLAGS := $(shell pkg-config sdl2 --cflags-only-I)
|
TARGET_CFLAGS := $(shell pkg-config sdl2 --cflags-only-I)
|
||||||
TARGET_LDFLAGS := $(shell pkg-config sdl2 --libs) -lz -lopengl32 -ldbghelp
|
TARGET_LDFLAGS := $(shell pkg-config sdl2 --libs) -lz -lopengl32 -lws2_32 -lwinmm -ldbghelp
|
||||||
# on windows/mingw we need this to be built with a 32-bit compiler so it finds the correct libs
|
# on windows/mingw we need this to be built with a 32-bit compiler so it finds the correct libs
|
||||||
TOOLCHAIN ?= i686-w64-mingw32-
|
TOOLCHAIN ?= i686-w64-mingw32-
|
||||||
# on GCC link libstdc++ statically
|
# on GCC link libstdc++ statically
|
||||||
|
|||||||
@@ -1,4 +1,14 @@
|
|||||||
# Perfect Dark port
|
# Perfect Dark port (`port-net`)
|
||||||
|
|
||||||
|
## Experimental netplay branch
|
||||||
|
|
||||||
|
This branch of the port contains an **extremely** early and experimental implementation of network play.
|
||||||
|
**DISCLAIMER:** This is **NOT READY** for prime time. Use at your own risk if you are not a developer.
|
||||||
|
**Do not create issues about problems in this branch until this disclaimer is gone.**
|
||||||
|
|
||||||
|
See [this file](https://github.com/fgsfdsfgs/perfect_dark/blob/port-net/docs/netplay.md) for more information on how this works.
|
||||||
|
|
||||||
|
## Original description
|
||||||
|
|
||||||
This repository contains a work-in-progress port of the [Perfect Dark decompilation](https://github.com/n64decomp/perfect_dark) to modern platforms.
|
This repository contains a work-in-progress port of the [Perfect Dark decompilation](https://github.com/n64decomp/perfect_dark) to modern platforms.
|
||||||
|
|
||||||
@@ -40,9 +50,9 @@ though you might have to install some additional libraries.
|
|||||||
|
|
||||||
## Download
|
## Download
|
||||||
|
|
||||||
Latest [automatic builds](https://github.com/fgsfdsfgs/perfect_dark/actions) for supported platforms:
|
Latest [automatic builds](https://github.com/fgsfdsfgs/perfect_dark/actions) of the netplay branch for supported platforms:
|
||||||
* [i686-windows](https://nightly.link/fgsfdsfgs/perfect_dark/workflows/c-cpp/port/pd-i686-windows.zip)
|
* [i686-windows (`port-net`)](https://nightly.link/fgsfdsfgs/perfect_dark/workflows/c-cpp/port-net/pd-i686-windows.zip)
|
||||||
* [i686-linux](https://nightly.link/fgsfdsfgs/perfect_dark/workflows/c-cpp/port/pd-i686-linux.zip)
|
* [i686-linux (`port-net`)](https://nightly.link/fgsfdsfgs/perfect_dark/workflows/c-cpp/port-net/pd-i686-linux.zip)
|
||||||
|
|
||||||
If you are looking for netplay builds (the `port-net` branch), see [this link](https://github.com/fgsfdsfgs/perfect_dark/blob/port-net/README.md#download).
|
If you are looking for netplay builds (the `port-net` branch), see [this link](https://github.com/fgsfdsfgs/perfect_dark/blob/port-net/README.md#download).
|
||||||
|
|
||||||
@@ -96,7 +106,7 @@ Controls can be rebound in `pd.ini`. Default control scheme is as follows:
|
|||||||
3. Install dependencies:
|
3. Install dependencies:
|
||||||
`pacman -S mingw-w64-i686-toolchain mingw-w64-i686-SDL2 mingw-w64-i686-zlib make git`
|
`pacman -S mingw-w64-i686-toolchain mingw-w64-i686-SDL2 mingw-w64-i686-zlib make git`
|
||||||
4. Get the source code:
|
4. Get the source code:
|
||||||
`git clone --recursive https://github.com/fgsfdsfgs/perfect_dark.git && cd perfect_dark`
|
`git clone -b port-net --recursive https://github.com/fgsfdsfgs/perfect_dark.git && cd perfect_dark`
|
||||||
5. Run `make -f Makefile.port`.
|
5. Run `make -f Makefile.port`.
|
||||||
* Add ` ROMID=pal-final` or ` ROMID=jpn-final` at the end of the command if you want to build a PAL or JPN executable respectively.
|
* Add ` ROMID=pal-final` or ` ROMID=jpn-final` at the end of the command if you want to build a PAL or JPN executable respectively.
|
||||||
6. The resulting executable will be at `build/ntsc-final-port/pd.exe`.
|
6. The resulting executable will be at `build/ntsc-final-port/pd.exe`.
|
||||||
@@ -107,7 +117,7 @@ Controls can be rebound in `pd.ini`. Default control scheme is as follows:
|
|||||||
1. Ensure you have gcc, g++ (version 10.0+) and 32-bit versions of SDL2 (version 2.0.12+), libGL and ZLib installed on your system.
|
1. Ensure you have gcc, g++ (version 10.0+) and 32-bit versions of SDL2 (version 2.0.12+), libGL and ZLib installed on your system.
|
||||||
* On a 64-bit system you also need to have `gcc-multilib` and `g++-multilib` (or your distro's analogues) installed.
|
* On a 64-bit system you also need to have `gcc-multilib` and `g++-multilib` (or your distro's analogues) installed.
|
||||||
2. Get the source code:
|
2. Get the source code:
|
||||||
`git clone --recursive https://github.com/fgsfdsfgs/perfect_dark.git && cd perfect_dark`
|
`git clone -b port-net --recursive https://github.com/fgsfdsfgs/perfect_dark.git && cd perfect_dark`
|
||||||
3. Run the following command:
|
3. Run the following command:
|
||||||
* On a 64-bit system: ```make -f Makefile.port TARGET_PLATFORM=i686-linux```
|
* On a 64-bit system: ```make -f Makefile.port TARGET_PLATFORM=i686-linux```
|
||||||
* On a 32-bit system: ```make -f Makefile.port```
|
* On a 32-bit system: ```make -f Makefile.port```
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
## Experimental netplay branch
|
||||||
|
|
||||||
|
This branch contains a **highly experimental** implementation of network play.
|
||||||
|
|
||||||
|
Currently only Combat Sim is partially working with experimental 8 player support and really bad netcode.
|
||||||
|
Expect nothing to work right.
|
||||||
|
|
||||||
|
### Hosting
|
||||||
|
|
||||||
|
1. Forward the server port (`27100` by default, can be changed in `pd.ini`).
|
||||||
|
* You can also use something like ZeroTier or Hamachi if you can't port forward.
|
||||||
|
3. Choose `Network Game` -> `Host Game`, configure the player cap, press `Start Game`.
|
||||||
|
4. Configure Combat Sim as desired, but do not start it yet. Keep in mind:
|
||||||
|
* You can save and load the settings as normal.
|
||||||
|
* Your player will have the config of Combat Sim player 1.
|
||||||
|
5. Wait for everyone to join. You can use the console (press `~`) to chat in the meantime.
|
||||||
|
6. Hit Enter/Start. During the game no more players will be able to join.
|
||||||
|
7. After game is over, you will be kicked back to Combat Sim settings, at which point people can join again and the process repeats from step 3.
|
||||||
|
|
||||||
|
### Joining
|
||||||
|
|
||||||
|
1. Your player will have the config of Combat Sim player 1, so set that up beforehand in the Combat Sim menu.
|
||||||
|
2. Choose `Network Game` -> `Join Game`, enter the address (and port if it's not 27100), press `Start Game`.
|
||||||
|
3. If the message says `Waiting for host`, wait until the host configures the game. You can use the console (press `~`) to chat in the meantime or `ESC` to disconnect.
|
||||||
|
4. The game will start automatically.
|
||||||
|
5. After the game is over, press Enter/Start on the stats screen and you will be kicked back to the `Waiting for host` screen, at which point the process repeats from step 3.
|
||||||
|
|
||||||
|
### Misc
|
||||||
|
|
||||||
|
* Everyone has to have the same ROM. The game only compares the file name, but different regions in one game will definitely break everything.
|
||||||
|
* Press `~` to bring up the console, press `F9` for network stats.
|
||||||
|
* You can chat at any time during a net game by entering messages in the console and hitting Enter.
|
||||||
|
* Server port and other network settings can be configured in `pd.ini`.
|
||||||
|
* For a 4+ player game I would recommend changing `Net.Server.UpdateFrames` to `2` in `pd.ini` on the server to lower the bandwidth usage.
|
||||||
|
* You can paste stuff into the `Enter Address` prompt by hitting `CTRL+V`.
|
||||||
|
* Expect nothing to work right.
|
||||||
|
|
||||||
|
### Known issues
|
||||||
|
|
||||||
|
* Clients can't throw laptop guns.
|
||||||
|
* Clients see rocket rotation incorrectly.
|
||||||
|
* Clients can't use Slayer fly-by-wire rockets and they will not correctly sync if the server uses them.
|
||||||
|
* Clients can't use the alt fire mode on the FarSight and probably a couple other guns.
|
||||||
|
* Cloaking device is not synced.
|
||||||
|
* Most likely only Combat works properly.
|
||||||
|
* Sims don't work in netgames.
|
||||||
|
* Bandwidth consumption on the server is pretty large on the default settings, especially with 8 players.
|
||||||
Vendored
+10
@@ -0,0 +1,10 @@
|
|||||||
|
#ifndef _WIN32
|
||||||
|
#ifndef _POSIX_C_SOURCE
|
||||||
|
#define _POSIX_C_SOURCE 200809L
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENET_IMPLEMENTATION 1
|
||||||
|
#define ENET_NO_PRAGMA_LINK 1
|
||||||
|
|
||||||
|
#include "external/enet.h"
|
||||||
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
#define MINIMP3_IMPLEMENTATION
|
||||||
|
#include "external/minimp3.h"
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef _IN_CONSOLE_H
|
||||||
|
#define _IN_CONSOLE_H
|
||||||
|
|
||||||
|
#include <PR/ultratypes.h>
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
|
void conInit(void);
|
||||||
|
Gfx *conRender(Gfx *gdl);
|
||||||
|
void conTick(void);
|
||||||
|
void conPrint(s32 showmsg, const char *s);
|
||||||
|
void conPrintf(s32 showmsg, const char *fmt, ...);
|
||||||
|
void conPrintLn(s32 showmsg, const char *s);
|
||||||
|
|
||||||
|
#endif
|
||||||
Vendored
+5098
File diff suppressed because it is too large.
Load diff
@@ -19,9 +19,29 @@
|
|||||||
enum virtkey {
|
enum virtkey {
|
||||||
/* same order as SDL scancodes */
|
/* same order as SDL scancodes */
|
||||||
VK_KEYBOARD_BEGIN = 0,
|
VK_KEYBOARD_BEGIN = 0,
|
||||||
|
VK_A = 4,
|
||||||
|
VK_Z = 29,
|
||||||
|
VK_1 = 30,
|
||||||
|
VK_9 = 38,
|
||||||
|
VK_0 = 39,
|
||||||
VK_RETURN = 40,
|
VK_RETURN = 40,
|
||||||
VK_ESCAPE = 41,
|
VK_ESCAPE = 41,
|
||||||
|
VK_BACKSPACE = 42,
|
||||||
|
VK_SPACE = 44,
|
||||||
|
VK_MINUS = 45,
|
||||||
|
VK_LEFTBRACKET = 47,
|
||||||
|
VK_RIGHTBRACKET = 48,
|
||||||
|
VK_SEMICOLON = 51,
|
||||||
|
VK_GRAVE = 53,
|
||||||
|
VK_COMMA = 54,
|
||||||
|
VK_PERIOD = 55,
|
||||||
|
VK_F1 = 58,
|
||||||
|
VK_F9 = 66,
|
||||||
VK_DELETE = 76,
|
VK_DELETE = 76,
|
||||||
|
VK_LCTRL = 224,
|
||||||
|
VK_LSHIFT = 225,
|
||||||
|
VK_RCTRL = 228,
|
||||||
|
VK_RSHIFT = 229,
|
||||||
|
|
||||||
/* same order as SDL mouse buttons */
|
/* same order as SDL mouse buttons */
|
||||||
VK_MOUSE_BEGIN = 512,
|
VK_MOUSE_BEGIN = 512,
|
||||||
@@ -199,6 +219,17 @@ void inputSetDefaultKeyBinds(s32 cidx, s32 n64mode);
|
|||||||
void inputClearLastKey(void);
|
void inputClearLastKey(void);
|
||||||
s32 inputGetLastKey(void);
|
s32 inputGetLastKey(void);
|
||||||
|
|
||||||
|
void inputStartTextInput(void);
|
||||||
|
void inputStopTextInput(void);
|
||||||
|
|
||||||
|
void inputClearLastTextChar(void);
|
||||||
|
char inputGetLastTextChar(void);
|
||||||
|
|
||||||
|
s32 inputTextHandler(char *out, const u32 outSize, s32 *curCol);
|
||||||
|
|
||||||
|
void inputClearClipboard(void);
|
||||||
|
const char *inputGetClipboard(void);
|
||||||
|
|
||||||
// get/set Input.MouseDefaultLocked
|
// get/set Input.MouseDefaultLocked
|
||||||
s32 inputGetMouseDefaultLocked(void);
|
s32 inputGetMouseDefaultLocked(void);
|
||||||
void inputSetMouseDefaultLocked(s32 defaultLocked);
|
void inputSetMouseDefaultLocked(s32 defaultLocked);
|
||||||
|
|||||||
@@ -0,0 +1,163 @@
|
|||||||
|
#ifndef _IN_NET_H
|
||||||
|
#define _IN_NET_H
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
#include "constants.h"
|
||||||
|
#include "net/netbuf.h"
|
||||||
|
|
||||||
|
#define NET_PROTOCOL_VER 12
|
||||||
|
|
||||||
|
#define NET_QUERY_MAGIC "PDQM\x01"
|
||||||
|
|
||||||
|
#define NET_MAX_CLIENTS MAX_PLAYERS
|
||||||
|
#define NET_MAX_NAME MAX_PLAYERNAME
|
||||||
|
#define NET_MAX_ADDR 256
|
||||||
|
|
||||||
|
#define NET_BUFSIZE 1440
|
||||||
|
|
||||||
|
#define NET_DEFAULT_PORT 27100
|
||||||
|
|
||||||
|
#define NET_NULL_CLIENT 0xFF
|
||||||
|
#define NET_NULL_PROP 0
|
||||||
|
|
||||||
|
#define NETCHAN_DEFAULT 0
|
||||||
|
#define NETCHAN_CONTROL 1
|
||||||
|
#define NETCHAN_COUNT 2
|
||||||
|
|
||||||
|
#define DISCONNECT_UNKNOWN 0
|
||||||
|
#define DISCONNECT_SHUTDOWN 1
|
||||||
|
#define DISCONNECT_VERSION 2
|
||||||
|
#define DISCONNECT_KICKED 3
|
||||||
|
#define DISCONNECT_BANNED 4
|
||||||
|
#define DISCONNECT_TIMEOUT 5
|
||||||
|
#define DISCONNECT_FULL 6
|
||||||
|
#define DISCONNECT_LATE 7
|
||||||
|
#define DISCONNECT_FILES 8
|
||||||
|
|
||||||
|
#define CLSTATE_DISCONNECTED 0
|
||||||
|
#define CLSTATE_CONNECTING 1
|
||||||
|
#define CLSTATE_AUTH 2
|
||||||
|
#define CLSTATE_LOBBY 3
|
||||||
|
#define CLSTATE_GAME 4
|
||||||
|
|
||||||
|
#define UCMD_FIRE (1 << 0)
|
||||||
|
#define UCMD_ACTIVATE (1 << 1)
|
||||||
|
#define UCMD_RELOAD (1 << 2)
|
||||||
|
#define UCMD_AIMMODE (1 << 3)
|
||||||
|
#define UCMD_DUCK (1 << 4)
|
||||||
|
#define UCMD_SQUAT (1 << 5)
|
||||||
|
#define UCMD_ZOOMIN (1 << 6)
|
||||||
|
#define UCMD_SELECT (1 << 7)
|
||||||
|
#define UCMD_SELECT_DUAL (1 << 8)
|
||||||
|
#define UCMD_EYESSHUT (1 << 9)
|
||||||
|
#define UCMD_SECONDARY (1 << 10)
|
||||||
|
#define UCMD_RESPAWN (1 << 27)
|
||||||
|
#define UCMD_CHAT (1 << 28)
|
||||||
|
#define UCMD_IMPORTANT_MASK (UCMD_FIRE | UCMD_ACTIVATE | UCMD_RELOAD | UCMD_AIMMODE | UCMD_SELECT | UCMD_SELECT_DUAL)
|
||||||
|
#define UCMD_FL_FORCEPOS (1 << 29)
|
||||||
|
#define UCMD_FL_FORCEANGLE (1 << 30)
|
||||||
|
#define UCMD_FL_FORCEGROUND (1 << 31)
|
||||||
|
#define UCMD_FL_FORCEMASK (UCMD_FL_FORCEPOS | UCMD_FL_FORCEANGLE | UCMD_FL_FORCEGROUND)
|
||||||
|
|
||||||
|
struct netplayermove {
|
||||||
|
u32 tick; // g_NetTIck value when this struct was written; if 0, this struct is invalid
|
||||||
|
u32 ucmd; // player commands (UCMD_)
|
||||||
|
f32 leanofs; // analog lean value (-1 .. 1; equal to player->swaytarget / 75.f)
|
||||||
|
f32 crouchofs; // analog crouch value (-90 for SQUAT, 0 for STAND; player->crouchofs)
|
||||||
|
f32 zoomfov; // manual zoom fov for the current gun; synced only if UCMD_AIMING is set
|
||||||
|
f32 movespeed[2]; // move inputs, [0] is forward, [1] is sideways; used mostly for animation
|
||||||
|
f32 angles[2]; // view angles, [0] is theta, [1] is verta
|
||||||
|
f32 crosspos[2]; // crosshair position in aiming mode; normalized to default aspect ratio
|
||||||
|
s8 weaponnum; // switch to this weapon if UCMD_SELECT is set
|
||||||
|
struct coord pos; // player position at g_NetTick == tick
|
||||||
|
};
|
||||||
|
|
||||||
|
struct netclient {
|
||||||
|
struct _ENetPeer *peer;
|
||||||
|
u32 id; // remote client number, server is always 0, even on clients
|
||||||
|
u32 state; // CLSTATE_
|
||||||
|
u32 flags; // CLFLAG_
|
||||||
|
|
||||||
|
struct {
|
||||||
|
char name[NET_MAX_NAME];
|
||||||
|
u16 options;
|
||||||
|
u8 headnum;
|
||||||
|
u8 bodynum;
|
||||||
|
u8 team;
|
||||||
|
f32 fovy;
|
||||||
|
f32 fovzoommult;
|
||||||
|
} settings;
|
||||||
|
|
||||||
|
struct mpplayerconfig *config;
|
||||||
|
struct player *player;
|
||||||
|
u8 playernum;
|
||||||
|
|
||||||
|
struct netplayermove outmove[2]; // last 2 outgoing player inputs, newest one first
|
||||||
|
struct netplayermove inmove[2]; // last 2 incoming player inputs, newest one first
|
||||||
|
u32 inmovetick; // last inmove tick which was applied to the player
|
||||||
|
u32 outmoveack; // last acked outmove tick
|
||||||
|
u32 forcetick; // tick on which the client's position was forced, or 0 if not forcing
|
||||||
|
u32 lerpticks; // how many ticks we've been lerping the position
|
||||||
|
|
||||||
|
struct netbuf out; // outbound messages are written here, except broadcasts
|
||||||
|
struct netbuf in; // incoming packets are fed here
|
||||||
|
|
||||||
|
u8 out_data[NET_BUFSIZE]; // buffer for out
|
||||||
|
};
|
||||||
|
|
||||||
|
extern s32 g_NetMode;
|
||||||
|
|
||||||
|
extern s32 g_NetJoinLatch;
|
||||||
|
extern s32 g_NetHostLatch;
|
||||||
|
|
||||||
|
// net frame, ticks at 60 fps, starts at 0 when the server is started
|
||||||
|
extern u32 g_NetTick;
|
||||||
|
extern u32 g_NetNextSyncId;
|
||||||
|
|
||||||
|
extern u64 g_NetRngSeeds[2];
|
||||||
|
extern u32 g_NetRngLatch;
|
||||||
|
|
||||||
|
extern u32 g_NetInterpTicks;
|
||||||
|
extern u32 g_NetServerPort;
|
||||||
|
extern char g_NetLastJoinAddr[NET_MAX_ADDR + 1];
|
||||||
|
|
||||||
|
extern s32 g_NetDebugDraw;
|
||||||
|
|
||||||
|
extern s32 g_NetMaxClients;
|
||||||
|
extern s32 g_NetNumClients;
|
||||||
|
extern struct netclient g_NetClients[NET_MAX_CLIENTS + 1]; // last is an extra temporary client
|
||||||
|
extern struct netclient *g_NetLocalClient;
|
||||||
|
|
||||||
|
extern struct netbuf g_NetMsg;
|
||||||
|
extern struct netbuf g_NetMsgRel;
|
||||||
|
|
||||||
|
const char *netFormatClientAddr(const struct netclient *cl);
|
||||||
|
|
||||||
|
void netInit(void);
|
||||||
|
s32 netDisconnect(void);
|
||||||
|
void netStartFrame(void);
|
||||||
|
void netEndFrame(void);
|
||||||
|
|
||||||
|
s32 netStartServer(u16 port, s32 maxclients);
|
||||||
|
s32 netStartClient(const char *addr);
|
||||||
|
|
||||||
|
u32 netSend(struct netclient *dstcl, struct netbuf *buf, const s32 reliable, const s32 chan);
|
||||||
|
|
||||||
|
void netChat(struct netclient *dst, const char *text);
|
||||||
|
void netChatPrintf(struct netclient *dst, const char *fmt, ...);
|
||||||
|
|
||||||
|
void netServerStageStart(void);
|
||||||
|
void netServerStageEnd(void);
|
||||||
|
void netServerKick(struct netclient *cl, const u32 reason);
|
||||||
|
|
||||||
|
struct netclient *netClientForPlayerNum(s32 playernum);
|
||||||
|
|
||||||
|
void netClientSyncRng(void);
|
||||||
|
void netClientSettingsChanged(void);
|
||||||
|
|
||||||
|
void netPlayersAllocate(void);
|
||||||
|
void netSyncIdsAllocate(void);
|
||||||
|
|
||||||
|
Gfx *netDebugRender(Gfx *gdl);
|
||||||
|
|
||||||
|
#endif // _IN_NET_H
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
#ifndef _IN_NETBUF_H
|
||||||
|
#define _IN_NETBUF_H
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
|
struct netbuf {
|
||||||
|
u8 *data;
|
||||||
|
u32 size;
|
||||||
|
u32 rp;
|
||||||
|
u32 wp;
|
||||||
|
u32 error;
|
||||||
|
};
|
||||||
|
|
||||||
|
void netbufStartRead(struct netbuf *buf);
|
||||||
|
void netbufStartReadData(struct netbuf *buf, const void *data, u32 size);
|
||||||
|
s32 netbufReadLeft(const struct netbuf *buf);
|
||||||
|
u32 netbufReadData(struct netbuf *buf, void *out, u32 num);
|
||||||
|
u8 netbufReadU8(struct netbuf *buf);
|
||||||
|
u16 netbufReadU16(struct netbuf *buf);
|
||||||
|
u32 netbufReadU32(struct netbuf *buf);
|
||||||
|
u64 netbufReadU64(struct netbuf *buf);
|
||||||
|
s8 netbufReadS8(struct netbuf *buf);
|
||||||
|
s16 netbufReadS16(struct netbuf *buf);
|
||||||
|
s32 netbufReadS32(struct netbuf *buf);
|
||||||
|
s64 netbufReadS64(struct netbuf *buf);
|
||||||
|
f32 netbufReadF32(struct netbuf *buf);
|
||||||
|
char *netbufReadStr(struct netbuf *buf);
|
||||||
|
u32 netbufReadCoord(struct netbuf *buf, struct coord *out);
|
||||||
|
u32 netbufReadMtxf(struct netbuf *buf, Mtxf *out);
|
||||||
|
u32 netbufReadSkip(struct netbuf *buf, u32 count);
|
||||||
|
|
||||||
|
void netbufStartWrite(struct netbuf *buf);
|
||||||
|
s32 netbufWriteLeft(const struct netbuf *buf);
|
||||||
|
u32 netbufWriteData(struct netbuf *buf, const void *data, u32 num);
|
||||||
|
u32 netbufWriteU8(struct netbuf *buf, const u8 v);
|
||||||
|
u32 netbufWriteU16(struct netbuf *buf, const u16 v);
|
||||||
|
u32 netbufWriteU32(struct netbuf *buf, const u32 v);
|
||||||
|
u32 netbufWriteU64(struct netbuf *buf, const u64 v);
|
||||||
|
u32 netbufWriteS8(struct netbuf *buf, const s8 v);
|
||||||
|
u32 netbufWriteS16(struct netbuf *buf, const s16 v);
|
||||||
|
u32 netbufWriteS32(struct netbuf *buf, const s32 v);
|
||||||
|
u32 netbufWriteS64(struct netbuf *buf, const s64 v);
|
||||||
|
u32 netbufWriteF32(struct netbuf *buf, const f32 v);
|
||||||
|
u32 netbufWriteStr(struct netbuf *buf, const char *v);
|
||||||
|
u32 netbufWriteCoord(struct netbuf *buf, const struct coord *v);
|
||||||
|
u32 netbufWriteMtxf(struct netbuf *buf, const Mtxf *in);
|
||||||
|
|
||||||
|
void netbufReset(struct netbuf *buf);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#ifndef _IN_NETENET_H
|
||||||
|
#define _IN_NETENET_H
|
||||||
|
|
||||||
|
#define ENET_NO_PRAGMA_LINK 1
|
||||||
|
#include "external/enet.h"
|
||||||
|
#undef bool
|
||||||
|
#undef near
|
||||||
|
#undef far
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
#ifndef _IN_NETMSG_H
|
||||||
|
#define _IN_NETMSG_H
|
||||||
|
|
||||||
|
#include <PR/ultratypes.h>
|
||||||
|
#include "net/net.h"
|
||||||
|
#include "net/netbuf.h"
|
||||||
|
|
||||||
|
#define SVC_BAD 0x00 // trash
|
||||||
|
#define SVC_NOP 0x01 // does nothing
|
||||||
|
#define SVC_AUTH 0x02 // auth response, sent in response to CLC_AUTH
|
||||||
|
#define SVC_CHAT 0x03 // chat message
|
||||||
|
#define SVC_STAGE_START 0x10 // start level
|
||||||
|
#define SVC_STAGE_END 0x11 // end level
|
||||||
|
#define SVC_PLAYER_MOVE 0x20 // player movement and inputs
|
||||||
|
#define SVC_PLAYER_GUNS 0x21 // player gun state
|
||||||
|
#define SVC_PLAYER_STATS 0x22 // player stats (health etc)
|
||||||
|
#define SVC_PROP_MOVE 0x30 // prop movement
|
||||||
|
#define SVC_PROP_SPAWN 0x31 // new prop spawned
|
||||||
|
#define SVC_PROP_DAMAGE 0x32 // prop was damaged
|
||||||
|
#define SVC_PROP_PICKUP 0x33 // prop was picked up
|
||||||
|
#define SVC_PROP_USE 0x34 // door/lift/etc was used
|
||||||
|
#define SVC_PROP_DOOR 0x35 // door state changed
|
||||||
|
#define SVC_PROP_LIFT 0x36 // lift state changed
|
||||||
|
#define SVC_CHR_DAMAGE 0x42 // chr was damaged
|
||||||
|
#define SVC_CHR_DISARM 0x43 // chr's weapons were dropped
|
||||||
|
|
||||||
|
#define CLC_BAD 0x00 // trash
|
||||||
|
#define CLC_NOP 0x01 // does nothing
|
||||||
|
#define CLC_AUTH 0x02 // auth request, sent immediately after connecting
|
||||||
|
#define CLC_CHAT 0x03 // chat message
|
||||||
|
#define CLC_MOVE 0x04 // player input
|
||||||
|
#define CLC_SETTINGS 0x05 // player settings changed
|
||||||
|
|
||||||
|
u32 netmsgClcAuthWrite(struct netbuf *dst);
|
||||||
|
u32 netmsgClcAuthRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgClcChatWrite(struct netbuf *dst, const char *str);
|
||||||
|
u32 netmsgClcChatRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgClcMoveWrite(struct netbuf *dst);
|
||||||
|
u32 netmsgClcMoveRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgClcSettingsWrite(struct netbuf *dst);
|
||||||
|
u32 netmsgClcSettingsRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
|
||||||
|
u32 netmsgSvcAuthWrite(struct netbuf *dst, struct netclient *authcl);
|
||||||
|
u32 netmsgSvcAuthRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgSvcChatWrite(struct netbuf *dst, const char *str);
|
||||||
|
u32 netmsgSvcChatRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgSvcStageStartWrite(struct netbuf *dst);
|
||||||
|
u32 netmsgSvcStageStartRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgSvcStageEndWrite(struct netbuf *dst);
|
||||||
|
u32 netmsgSvcStageEndRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgSvcPlayerMoveWrite(struct netbuf *dst, struct netclient *movecl);
|
||||||
|
u32 netmsgSvcPlayerMoveRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgSvcPlayerStatsWrite(struct netbuf *dst, struct netclient *actcl);
|
||||||
|
u32 netmsgSvcPlayerStatsRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgSvcPropSpawnWrite(struct netbuf *dst, struct prop *prop);
|
||||||
|
u32 netmsgSvcPropSpawnRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgSvcPropMoveWrite(struct netbuf *dst, struct prop *prop, struct coord *initrot);
|
||||||
|
u32 netmsgSvcPropMoveRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgSvcPropDamageWrite(struct netbuf *dst, struct prop *prop, f32 damage, struct coord *pos, s32 weaponnum, s32 playernum);
|
||||||
|
u32 netmsgSvcPropDamageRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgSvcPropPickupWrite(struct netbuf *dst, struct netclient *actcl, struct prop *prop, const s32 tickop);
|
||||||
|
u32 netmsgSvcPropPickupRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgSvcPropUseWrite(struct netbuf *dst, struct prop *prop, struct netclient *usercl, const s32 tickop);
|
||||||
|
u32 netmsgSvcPropUseRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgSvcPropDoorWrite(struct netbuf *dst, struct prop *prop, struct netclient *usercl);
|
||||||
|
u32 netmsgSvcPropDoorRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgSvcPropLiftWrite(struct netbuf *dst, struct prop *prop);
|
||||||
|
u32 netmsgSvcPropLiftRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgSvcChrDamageWrite(struct netbuf *dst, struct chrdata *chr, f32 damage, struct coord *vector, struct gset *gset, struct prop *aprop, s32 hitpart, bool damageshield, struct prop *prop2, s32 side, s16 *arg11, bool explosion, struct coord *explosionpos);
|
||||||
|
u32 netmsgSvcChrDamageRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
u32 netmsgSvcChrDisarmWrite(struct netbuf *dst, struct chrdata *chr, struct prop *attacker, u8 weaponnum, f32 wpndamage, struct coord *wpnpos);
|
||||||
|
u32 netmsgSvcChrDisarmRead(struct netbuf *src, struct netclient *srccl);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
extern u8 *g_RomFile;
|
extern u8 *g_RomFile;
|
||||||
extern u32 g_RomFileSize;
|
extern u32 g_RomFileSize;
|
||||||
|
extern const char *g_RomName;
|
||||||
|
|
||||||
s32 romdataInit(void);
|
s32 romdataInit(void);
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,14 @@ extern "C" {
|
|||||||
|
|
||||||
#include <PR/ultratypes.h>
|
#include <PR/ultratypes.h>
|
||||||
|
|
||||||
enum LogLevel {
|
#define LOGFLAG_NOCON (1 << 6)
|
||||||
LOG_NOTE,
|
#define LOGFLAG_SHOWMSG (1 << 7)
|
||||||
LOG_WARNING,
|
|
||||||
LOG_ERROR,
|
enum loglevel {
|
||||||
|
LOG_NOTE = 0,
|
||||||
|
LOG_CHAT = 0 | LOGFLAG_SHOWMSG,
|
||||||
|
LOG_WARNING = 1 | LOGFLAG_SHOWMSG,
|
||||||
|
LOG_ERROR = 2 | LOGFLAG_SHOWMSG,
|
||||||
};
|
};
|
||||||
|
|
||||||
void sysInitArgs(s32 argc, const char **argv);
|
void sysInitArgs(s32 argc, const char **argv);
|
||||||
@@ -21,6 +25,7 @@ const char *sysArgGetString(const char *arg);
|
|||||||
s32 sysArgGetInt(const char *arg, s32 defval);
|
s32 sysArgGetInt(const char *arg, s32 defval);
|
||||||
|
|
||||||
u64 sysGetMicroseconds(void);
|
u64 sysGetMicroseconds(void);
|
||||||
|
f32 sysGetSeconds(void);
|
||||||
|
|
||||||
void sysFatalError(const char *fmt, ...) __attribute__((noreturn));
|
void sysFatalError(const char *fmt, ...) __attribute__((noreturn));
|
||||||
|
|
||||||
|
|||||||
@@ -12,4 +12,18 @@ char *strParseToken(char *str, char *out, s32 *outCount);
|
|||||||
char *strFmt(const char *fmt, ...);
|
char *strFmt(const char *fmt, ...);
|
||||||
char *strDuplicate(const char *str);
|
char *strDuplicate(const char *str);
|
||||||
|
|
||||||
|
static inline f32 lerpf(const f32 a, const f32 b, const f32 t) {
|
||||||
|
return a + (b - a) * t;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline f32 lerpanglef(const f32 a, const f32 b, const f32 t) {
|
||||||
|
f32 d = b - a;
|
||||||
|
if (d > 180.f) {
|
||||||
|
d -= 360.f;
|
||||||
|
} else if (d < -180.f) {
|
||||||
|
d += 360.f;
|
||||||
|
}
|
||||||
|
return a + d * t;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -38,6 +38,7 @@ void videoSetFullscreen(s32 fs);
|
|||||||
void videoSetTextureFilter(u32 filter);
|
void videoSetTextureFilter(u32 filter);
|
||||||
void videoSetTextureFilter2D(s32 filter);
|
void videoSetTextureFilter2D(s32 filter);
|
||||||
void videoSetDetailTextures(s32 detail);
|
void videoSetDetailTextures(s32 detail);
|
||||||
|
void videoCapFramerate(s32 limit);
|
||||||
|
|
||||||
s32 videoCreateFramebuffer(u32 w, u32 h, s32 upscale, s32 autoresize);
|
s32 videoCreateFramebuffer(u32 w, u32 h, s32 upscale, s32 autoresize);
|
||||||
void videoSetFramebuffer(s32 target);
|
void videoSetFramebuffer(s32 target);
|
||||||
|
|||||||
@@ -0,0 +1,213 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "types.h"
|
||||||
|
#include "constants.h"
|
||||||
|
#include "data.h"
|
||||||
|
#include "bss.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "video.h"
|
||||||
|
#include "input.h"
|
||||||
|
#include "console.h"
|
||||||
|
#include "system.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "net/net.h"
|
||||||
|
#include "game/hudmsg.h"
|
||||||
|
#include "game/game_1531a0.h"
|
||||||
|
#include "lib/vi.h"
|
||||||
|
|
||||||
|
#define CON_ROWS 80
|
||||||
|
#define CON_COLS 56
|
||||||
|
#define CON_VISROWS 10
|
||||||
|
#define CON_MSGROWS 4
|
||||||
|
#define CON_MSGTIMER 3.f
|
||||||
|
|
||||||
|
static char conBuf[CON_ROWS][CON_COLS + 1];
|
||||||
|
static char conInput[CON_COLS + 1];
|
||||||
|
static char *conVisRows[CON_VISROWS];
|
||||||
|
static s32 conPrintRow = 0;
|
||||||
|
static s32 conPrintCol = 0;
|
||||||
|
static s32 conMsgRows = 0;
|
||||||
|
static f32 conMsgTimer = 0.f;
|
||||||
|
static s32 conInputCol = 0;
|
||||||
|
static u32 conTextColour = 0x00ff00ff;
|
||||||
|
static s32 conOpen = 0;
|
||||||
|
static s32 conButton = 0;
|
||||||
|
|
||||||
|
void conInit(void)
|
||||||
|
{
|
||||||
|
memset(conBuf, 0, sizeof(conBuf));
|
||||||
|
memset(conInput, 0, sizeof(conInput));
|
||||||
|
memset(conVisRows, 0, sizeof(conVisRows));
|
||||||
|
conPrintRow = conPrintCol = 0;
|
||||||
|
conOpen = 0;
|
||||||
|
conMsgRows = 0;
|
||||||
|
conMsgTimer = 0.0f;
|
||||||
|
conInputCol = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void conPrint(s32 showmsg, const char *str)
|
||||||
|
{
|
||||||
|
if (!str || !*str) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const s32 oldRow = conPrintRow;
|
||||||
|
|
||||||
|
for (const char *s = str; *s; ++s) {
|
||||||
|
char ch = *s;
|
||||||
|
switch (ch) {
|
||||||
|
case '\n':
|
||||||
|
if (conPrintCol) {
|
||||||
|
conPrintCol = 0;
|
||||||
|
conPrintRow = (conPrintRow + 1) % CON_ROWS;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '\r':
|
||||||
|
break;
|
||||||
|
case '\t':
|
||||||
|
ch = ' ';
|
||||||
|
/* fallthrough */
|
||||||
|
default:
|
||||||
|
conBuf[conPrintRow][conPrintCol++] = ch;
|
||||||
|
if (conPrintCol == CON_COLS) {
|
||||||
|
conPrintCol = 0;
|
||||||
|
conPrintRow = (conPrintRow + 1) % CON_ROWS;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
conBuf[conPrintRow][conPrintCol] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (conPrintRow != oldRow) {
|
||||||
|
// scroll time
|
||||||
|
for (s32 i = 0; i < ARRAYCOUNT(conVisRows); ++i) {
|
||||||
|
s32 row = conPrintRow - i - 1;
|
||||||
|
if (row < 0) {
|
||||||
|
row = CON_ROWS + row;
|
||||||
|
}
|
||||||
|
conVisRows[i] = &conBuf[row][0];
|
||||||
|
}
|
||||||
|
if (showmsg) {
|
||||||
|
if (conMsgRows < CON_MSGROWS) {
|
||||||
|
if (conPrintRow > oldRow) {
|
||||||
|
conMsgRows += conPrintRow - oldRow;
|
||||||
|
} else {
|
||||||
|
conMsgRows += conPrintRow + (CON_ROWS - oldRow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
conMsgTimer = sysGetSeconds() + CON_MSGTIMER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void conPrintLn(s32 showmsg, const char *s)
|
||||||
|
{
|
||||||
|
char tmp[4096];
|
||||||
|
snprintf(tmp, sizeof(tmp), "%s\n", s);
|
||||||
|
conPrint(showmsg, tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void conPrintf(s32 showmsg, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
char tmp[4096];
|
||||||
|
tmp[sizeof(tmp) - 1] = '\0';
|
||||||
|
tmp[0] = '\0';
|
||||||
|
|
||||||
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
|
vsnprintf(tmp, sizeof(tmp), fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
conPrint(showmsg, tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline Gfx *conRenderMsgs(Gfx *gdl)
|
||||||
|
{
|
||||||
|
if (conMsgRows) {
|
||||||
|
s32 x, y;
|
||||||
|
const u32 c = (conTextColour & 0xffffff00) | 0xa0;
|
||||||
|
for (s32 i = 0; i < conMsgRows; ++i) {
|
||||||
|
char *s = conVisRows[i];
|
||||||
|
if (s) {
|
||||||
|
x = 4;
|
||||||
|
y = 4 + 8 * (conMsgRows - i - 1);
|
||||||
|
gdl = textRenderProjected(gdl, &x, &y, s, g_CharsHandelGothicXs, g_FontHandelGothicXs, c, viGetWidth(), viGetHeight(), 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const f32 t = sysGetSeconds();
|
||||||
|
if (conMsgTimer <= t) {
|
||||||
|
conMsgTimer = t + CON_MSGTIMER;
|
||||||
|
--conMsgRows;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
conMsgTimer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return gdl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Gfx *conRender(Gfx *gdl)
|
||||||
|
{
|
||||||
|
if (!g_CharsHandelGothicXs || !g_FontHandelGothicXs) {
|
||||||
|
return gdl;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdl = text0f153628(gdl);
|
||||||
|
|
||||||
|
if (!conOpen) {
|
||||||
|
gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, G_ASPECT_LEFT_EXT);
|
||||||
|
gdl = conRenderMsgs(gdl);
|
||||||
|
} else {
|
||||||
|
s32 x, y;
|
||||||
|
gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, G_ASPECT_CENTER_EXT);
|
||||||
|
gdl = hudmsgRenderBox(gdl, 16, 0, SCREEN_WIDTH_LO - 16, 4 + 8 * (CON_VISROWS + 1), 1.f, conTextColour, 0.9f);
|
||||||
|
for (s32 i = 0; i < CON_VISROWS; ++i) {
|
||||||
|
char *s = conVisRows[i];
|
||||||
|
if (s) {
|
||||||
|
x = 18;
|
||||||
|
y = 4 + 8 * (CON_VISROWS - i - 1);
|
||||||
|
gdl = textRenderProjected(gdl, &x, &y, s, g_CharsHandelGothicXs, g_FontHandelGothicXs, conTextColour, viGetWidth(), viGetHeight(), 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
char tmp[CON_COLS + 3];
|
||||||
|
snprintf(tmp, sizeof(tmp), "> %s", conInput);
|
||||||
|
x = 18;
|
||||||
|
y = 4 + 8 * CON_VISROWS;
|
||||||
|
gdl = textRenderProjected(gdl, &x, &y, tmp, g_CharsHandelGothicXs, g_FontHandelGothicXs, conTextColour, viGetWidth(), viGetHeight(), 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
gSPClearExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT);
|
||||||
|
|
||||||
|
gdl = text0f153780(gdl);
|
||||||
|
|
||||||
|
return gdl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void conTick(void)
|
||||||
|
{
|
||||||
|
const s32 button = inputKeyPressed(VK_GRAVE);
|
||||||
|
if (button && !conButton) {
|
||||||
|
conOpen = !conOpen;
|
||||||
|
if (conOpen) {
|
||||||
|
inputStartTextInput();
|
||||||
|
} else {
|
||||||
|
inputStopTextInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
conButton = button;
|
||||||
|
|
||||||
|
if (conOpen) {
|
||||||
|
if (inputTextHandler(conInput, CON_COLS, &conInputCol)) {
|
||||||
|
if (g_NetMode) {
|
||||||
|
netChat(NULL, conInput);
|
||||||
|
}
|
||||||
|
conInput[0] = '\0';
|
||||||
|
conInputCol = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -81,6 +81,10 @@ static f32 mouseSensX = 1.5f;
|
|||||||
static f32 mouseSensY = 1.5f;
|
static f32 mouseSensY = 1.5f;
|
||||||
|
|
||||||
static s32 lastKey = 0;
|
static s32 lastKey = 0;
|
||||||
|
static char lastChar = 0;
|
||||||
|
static s32 textInput = 0;
|
||||||
|
|
||||||
|
static char *clipboardText = NULL;
|
||||||
|
|
||||||
static const char *ckNames[CK_TOTAL_COUNT] = {
|
static const char *ckNames[CK_TOTAL_COUNT] = {
|
||||||
"R_CBUTTONS",
|
"R_CBUTTONS",
|
||||||
@@ -512,6 +516,12 @@ static int inputEventFilter(void *data, SDL_Event *event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SDL_TEXTINPUT:
|
||||||
|
if (!lastChar && event->text.text[0] && (u8)event->text.text[0] < 0x80) {
|
||||||
|
lastChar = event->text.text[0];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -719,6 +729,14 @@ s32 inputReadController(s32 idx, OSContPad *npad)
|
|||||||
|
|
||||||
npad->button = 0;
|
npad->button = 0;
|
||||||
|
|
||||||
|
if (textInput) {
|
||||||
|
npad->stick_x = 0;
|
||||||
|
npad->stick_y = 0;
|
||||||
|
npad->rstick_x = 0;
|
||||||
|
npad->rstick_y = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (u32 i = 0; i < CONT_NUM_BUTTONS; ++i) {
|
for (u32 i = 0; i < CONT_NUM_BUTTONS; ++i) {
|
||||||
if (inputBindPressed(idx, i)) {
|
if (inputBindPressed(idx, i)) {
|
||||||
npad->button |= 1U << i;
|
npad->button |= 1U << i;
|
||||||
@@ -1251,6 +1269,100 @@ s32 inputGetLastKey(void)
|
|||||||
return lastKey;
|
return lastKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void inputStartTextInput(void)
|
||||||
|
{
|
||||||
|
lastChar = 0;
|
||||||
|
lastKey = 0;
|
||||||
|
textInput = 1;
|
||||||
|
SDL_StartTextInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inputClearLastTextChar(void)
|
||||||
|
{
|
||||||
|
lastChar = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char inputGetLastTextChar(void)
|
||||||
|
{
|
||||||
|
return lastChar;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 inputTextHandler(char *out, const u32 outSize, s32 *curCol)
|
||||||
|
{
|
||||||
|
const s32 ctrlHeld = inputKeyPressed(VK_LCTRL) || inputKeyPressed(VK_RCTRL);
|
||||||
|
|
||||||
|
if (!ctrlHeld) {
|
||||||
|
const char chr = inputGetLastTextChar();
|
||||||
|
inputClearLastTextChar();
|
||||||
|
if (chr && isprint(chr)) {
|
||||||
|
if (*curCol < outSize - 1) {
|
||||||
|
out[(*curCol)++] = chr;
|
||||||
|
out[*curCol] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const s32 key = inputGetLastKey();
|
||||||
|
inputClearLastKey();
|
||||||
|
if (ctrlHeld && (key == VK_A + ('v' - 'a'))) {
|
||||||
|
// CTRL+V; paste from clipboard
|
||||||
|
const char *clip = inputGetClipboard();
|
||||||
|
if (clip) {
|
||||||
|
const s32 remain = outSize - *curCol - 1;
|
||||||
|
inputClearClipboard();
|
||||||
|
*curCol += snprintf(out + *curCol, remain, "%s", clip);
|
||||||
|
if (*curCol > outSize) {
|
||||||
|
*curCol = outSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (key == VK_BACKSPACE) {
|
||||||
|
if (*curCol) {
|
||||||
|
out[--*curCol] = '\0';
|
||||||
|
} else {
|
||||||
|
out[0] = '\0';
|
||||||
|
}
|
||||||
|
} else if (key == VK_RETURN) {
|
||||||
|
if (out[0] && *curCol) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} else if (key == VK_ESCAPE) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void inputClearClipboard(void)
|
||||||
|
{
|
||||||
|
if (clipboardText) {
|
||||||
|
SDL_free(clipboardText);
|
||||||
|
clipboardText = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *inputGetClipboard(void)
|
||||||
|
{
|
||||||
|
if (!clipboardText) {
|
||||||
|
char *text = SDL_GetClipboardText();
|
||||||
|
if (text) {
|
||||||
|
clipboardText = text;
|
||||||
|
// remove non-printable and multibyte chars
|
||||||
|
for (; *text; ++text) {
|
||||||
|
if ((u8)*text < 0x20 || (u8)*text >= 0x7F) {
|
||||||
|
*text = '?';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return clipboardText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void inputStopTextInput(void)
|
||||||
|
{
|
||||||
|
SDL_StopTextInput();
|
||||||
|
textInput = 0;
|
||||||
|
}
|
||||||
|
|
||||||
PD_CONSTRUCTOR static void inputConfigInit(void)
|
PD_CONSTRUCTOR static void inputConfigInit(void)
|
||||||
{
|
{
|
||||||
configRegisterInt("Input.MouseEnabled", &mouseEnabled, 0, 1);
|
configRegisterInt("Input.MouseEnabled", &mouseEnabled, 0, 1);
|
||||||
|
|||||||
+18
-3
@@ -16,7 +16,9 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "mod.h"
|
#include "mod.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
#include "console.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "net/net.h"
|
||||||
|
|
||||||
u32 g_OsMemSize = 0;
|
u32 g_OsMemSize = 0;
|
||||||
s32 g_OsMemSizeMb = 16;
|
s32 g_OsMemSizeMb = 16;
|
||||||
@@ -69,7 +71,7 @@ static void gameInit(void)
|
|||||||
{
|
{
|
||||||
osMemSize = g_OsMemSizeMb * 1024 * 1024;
|
osMemSize = g_OsMemSizeMb * 1024 * 1024;
|
||||||
|
|
||||||
for (s32 i = 0; i < MAX_PLAYERS; ++i) {
|
for (s32 i = 0; i < MAX_LOCAL_PLAYERS; ++i) {
|
||||||
struct extplayerconfig *cfg = g_PlayerExtCfg + i;
|
struct extplayerconfig *cfg = g_PlayerExtCfg + i;
|
||||||
cfg->fovzoommult = cfg->fovzoom ? cfg->fovy / 60.0f : 1.0f;
|
cfg->fovzoommult = cfg->fovzoom ? cfg->fovy / 60.0f : 1.0f;
|
||||||
}
|
}
|
||||||
@@ -86,6 +88,7 @@ static void gameInit(void)
|
|||||||
static void cleanup(void)
|
static void cleanup(void)
|
||||||
{
|
{
|
||||||
sysLogPrintf(LOG_NOTE, "shutdown");
|
sysLogPrintf(LOG_NOTE, "shutdown");
|
||||||
|
netDisconnect();
|
||||||
inputSaveBinds();
|
inputSaveBinds();
|
||||||
configSave(CONFIG_PATH);
|
configSave(CONFIG_PATH);
|
||||||
crashShutdown();
|
crashShutdown();
|
||||||
@@ -100,6 +103,7 @@ int main(int argc, const char **argv)
|
|||||||
crashInit();
|
crashInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
conInit();
|
||||||
sysInit();
|
sysInit();
|
||||||
fsInit();
|
fsInit();
|
||||||
configInit();
|
configInit();
|
||||||
@@ -107,6 +111,7 @@ int main(int argc, const char **argv)
|
|||||||
inputInit();
|
inputInit();
|
||||||
audioInit();
|
audioInit();
|
||||||
romdataInit();
|
romdataInit();
|
||||||
|
netInit();
|
||||||
|
|
||||||
gameInit();
|
gameInit();
|
||||||
|
|
||||||
@@ -133,6 +138,8 @@ int main(int argc, const char **argv)
|
|||||||
|
|
||||||
g_StageNum = sysArgGetInt("--boot-stage", STAGE_TITLE);
|
g_StageNum = sysArgGetInt("--boot-stage", STAGE_TITLE);
|
||||||
|
|
||||||
|
g_FileAutoSelect = sysArgGetInt("--profile", -1);
|
||||||
|
|
||||||
if (g_StageNum == STAGE_TITLE && (sysArgCheck("--skip-intro") || g_SkipIntro)) {
|
if (g_StageNum == STAGE_TITLE && (sysArgCheck("--skip-intro") || g_SkipIntro)) {
|
||||||
// shorthand for --boot-stage 0x26
|
// shorthand for --boot-stage 0x26
|
||||||
g_StageNum = STAGE_CITRAINING;
|
g_StageNum = STAGE_CITRAINING;
|
||||||
@@ -141,11 +148,19 @@ int main(int argc, const char **argv)
|
|||||||
g_StageNum = STAGE_TITLE;
|
g_StageNum = STAGE_TITLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_NetJoinLatch || g_NetHostLatch) {
|
||||||
|
if (g_FileAutoSelect < 0) {
|
||||||
|
// default to profile 0 if going into a net game
|
||||||
|
g_FileAutoSelect = 0;
|
||||||
|
}
|
||||||
|
// skip the intro if going into a net game
|
||||||
|
g_StageNum = STAGE_CITRAINING;
|
||||||
|
}
|
||||||
|
|
||||||
if (g_StageNum != STAGE_TITLE) {
|
if (g_StageNum != STAGE_TITLE) {
|
||||||
sysLogPrintf(LOG_NOTE, "boot stage set to 0x%02x", g_StageNum);
|
sysLogPrintf(LOG_NOTE, "boot stage set to 0x%02x", g_StageNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_FileAutoSelect = sysArgGetInt("--profile", -1);
|
|
||||||
if (g_FileAutoSelect >= 0) {
|
if (g_FileAutoSelect >= 0) {
|
||||||
sysLogPrintf(LOG_NOTE, "player profile set to %d", g_FileAutoSelect);
|
sysLogPrintf(LOG_NOTE, "player profile set to %d", g_FileAutoSelect);
|
||||||
}
|
}
|
||||||
@@ -165,7 +180,7 @@ PD_CONSTRUCTOR static void gameConfigInit(void)
|
|||||||
configRegisterInt("Game.SkipIntro", &g_SkipIntro, 0, 1);
|
configRegisterInt("Game.SkipIntro", &g_SkipIntro, 0, 1);
|
||||||
configRegisterInt("Game.DisableMpDeathMusic", &g_MusicDisableMpDeath, 0, 1);
|
configRegisterInt("Game.DisableMpDeathMusic", &g_MusicDisableMpDeath, 0, 1);
|
||||||
configRegisterInt("Game.GEMuzzleFlashes", &g_BgunGeMuzzleFlashes, 0, 1);
|
configRegisterInt("Game.GEMuzzleFlashes", &g_BgunGeMuzzleFlashes, 0, 1);
|
||||||
for (s32 j = 0; j < MAX_PLAYERS; ++j) {
|
for (s32 j = 0; j < MAX_LOCAL_PLAYERS; ++j) {
|
||||||
const s32 i = j + 1;
|
const s32 i = j + 1;
|
||||||
configRegisterFloat(strFmt("Game.Player%d.FovY", i), &g_PlayerExtCfg[j].fovy, 5.f, 175.f);
|
configRegisterFloat(strFmt("Game.Player%d.FovY", i), &g_PlayerExtCfg[j].fovy, 5.f, 175.f);
|
||||||
configRegisterInt(strFmt("Game.Player%d.FovAffectsZoom", i), &g_PlayerExtCfg[j].fovzoom, 0, 1);
|
configRegisterInt(strFmt("Game.Player%d.FovAffectsZoom", i), &g_PlayerExtCfg[j].fovzoom, 0, 1);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include "mixer.h"
|
#include "mixer.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
#define MINIMP3_IMPLEMENTATION
|
|
||||||
#include "external/minimp3.h"
|
#include "external/minimp3.h"
|
||||||
|
|
||||||
#ifdef __SSE4_1__
|
#ifdef __SSE4_1__
|
||||||
|
|||||||
+1127
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,305 @@
|
|||||||
|
#include <string.h>
|
||||||
|
#include "types.h"
|
||||||
|
#include "platform.h"
|
||||||
|
#include "system.h"
|
||||||
|
#include "net/netbuf.h"
|
||||||
|
|
||||||
|
/* read */
|
||||||
|
|
||||||
|
void netbufStartRead(struct netbuf *buf)
|
||||||
|
{
|
||||||
|
buf->error = 0;
|
||||||
|
buf->wp = buf->size;
|
||||||
|
buf->rp = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void netbufStartReadData(struct netbuf *buf, const void *data, u32 size)
|
||||||
|
{
|
||||||
|
buf->size = size;
|
||||||
|
buf->data = (void *)data;
|
||||||
|
netbufStartRead(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 netbufReadLeft(const struct netbuf *buf)
|
||||||
|
{
|
||||||
|
return buf->wp - buf->rp;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline u32 netbufCanRead(struct netbuf *buf, const u32 num)
|
||||||
|
{
|
||||||
|
if (buf->error || buf->rp + num > buf->wp) {
|
||||||
|
sysLogPrintf(LOG_ERROR, "NET: could not read %u bytes", num);
|
||||||
|
__builtin_trap();
|
||||||
|
buf->error = 1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufReadData(struct netbuf *buf, void *out, u32 num)
|
||||||
|
{
|
||||||
|
if (netbufCanRead(buf, num)) {
|
||||||
|
memcpy(out, buf->data + buf->rp, num);
|
||||||
|
buf->rp += num;
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 netbufReadU8(struct netbuf *buf)
|
||||||
|
{
|
||||||
|
if (netbufCanRead(buf, 1)) {
|
||||||
|
return buf->data[buf->rp++];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u16 netbufReadU16(struct netbuf *buf)
|
||||||
|
{
|
||||||
|
if (netbufCanRead(buf, 2)) {
|
||||||
|
const u16 ret = *(u16 *)&buf->data[buf->rp];
|
||||||
|
buf->rp += sizeof(ret);
|
||||||
|
return PD_LE16(ret);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufReadU32(struct netbuf *buf)
|
||||||
|
{
|
||||||
|
if (netbufCanRead(buf, 4)) {
|
||||||
|
const u32 ret = *(u32 *)&buf->data[buf->rp];
|
||||||
|
buf->rp += sizeof(ret);
|
||||||
|
return PD_LE32(ret);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 netbufReadU64(struct netbuf *buf)
|
||||||
|
{
|
||||||
|
if (netbufCanRead(buf, 8)) {
|
||||||
|
const u64 ret = *(u64 *)&buf->data[buf->rp];
|
||||||
|
buf->rp += sizeof(ret);
|
||||||
|
return PD_LE64(ret);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
s8 netbufReadS8(struct netbuf *buf) {
|
||||||
|
return (s8)netbufReadU8(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
s16 netbufReadS16(struct netbuf *buf) {
|
||||||
|
return (s16)netbufReadU16(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 netbufReadS32(struct netbuf *buf) {
|
||||||
|
return (s32)netbufReadU32(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
s64 netbufReadS64(struct netbuf *buf) {
|
||||||
|
return (s64)netbufReadU64(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
f32 netbufReadF32(struct netbuf *buf)
|
||||||
|
{
|
||||||
|
union {
|
||||||
|
f32 f;
|
||||||
|
u32 i;
|
||||||
|
} hack;
|
||||||
|
hack.i = netbufReadU32(buf);
|
||||||
|
return hack.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *netbufReadStr(struct netbuf *buf)
|
||||||
|
{
|
||||||
|
const u16 len = netbufReadU16(buf);
|
||||||
|
if (netbufCanRead(buf, len)) {
|
||||||
|
char *ret = (char *)&buf->data[buf->rp];
|
||||||
|
buf->rp += len;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufReadCoord(struct netbuf *buf, struct coord *out)
|
||||||
|
{
|
||||||
|
if (netbufCanRead(buf, sizeof(*out))) {
|
||||||
|
out->x = netbufReadF32(buf);
|
||||||
|
out->y = netbufReadF32(buf);
|
||||||
|
out->z = netbufReadF32(buf);
|
||||||
|
return sizeof(*out);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufReadMtxf(struct netbuf *buf, Mtxf *out)
|
||||||
|
{
|
||||||
|
if (netbufCanRead(buf, sizeof(*out))) {
|
||||||
|
for (s32 i = 0; i < 4; ++i) {
|
||||||
|
for (s32 j = 0; j < 4; ++j) {
|
||||||
|
out->m[i][j] = netbufReadF32(buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sizeof(*out);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufReadSkip(struct netbuf *buf, u32 count)
|
||||||
|
{
|
||||||
|
if (netbufCanRead(buf, count)) {
|
||||||
|
buf->rp += count;
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* write */
|
||||||
|
|
||||||
|
void netbufStartWrite(struct netbuf *buf)
|
||||||
|
{
|
||||||
|
buf->wp = 0;
|
||||||
|
buf->error = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline u32 netbufCanWrite(struct netbuf *buf, const u32 num)
|
||||||
|
{
|
||||||
|
if (buf->error || buf->wp + num > buf->size) {
|
||||||
|
buf->error = 1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 netbufWriteLeft(const struct netbuf *buf)
|
||||||
|
{
|
||||||
|
return buf->size - buf->wp;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufWriteData(struct netbuf *buf, const void *data, u32 num)
|
||||||
|
{
|
||||||
|
if (netbufCanWrite(buf, num)) {
|
||||||
|
memcpy(buf->data + buf->wp, data, num);
|
||||||
|
buf->wp += num;
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufWriteU8(struct netbuf *buf, const u8 v)
|
||||||
|
{
|
||||||
|
if (netbufCanWrite(buf, sizeof(v))) {
|
||||||
|
buf->data[buf->wp++] = v;
|
||||||
|
return sizeof(v);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufWriteU16(struct netbuf *buf, const u16 v)
|
||||||
|
{
|
||||||
|
if (netbufCanWrite(buf, sizeof(v))) {
|
||||||
|
*(u16 *)&buf->data[buf->wp] = PD_LE16(v);
|
||||||
|
buf->wp += sizeof(v);
|
||||||
|
return sizeof(v);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufWriteU32(struct netbuf *buf, const u32 v)
|
||||||
|
{
|
||||||
|
if (netbufCanWrite(buf, sizeof(v))) {
|
||||||
|
*(u32 *)&buf->data[buf->wp] = PD_LE32(v);
|
||||||
|
buf->wp += sizeof(v);
|
||||||
|
return sizeof(v);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufWriteU64(struct netbuf *buf, const u64 v)
|
||||||
|
{
|
||||||
|
if (netbufCanWrite(buf, sizeof(v))) {
|
||||||
|
*(u64 *)&buf->data[buf->wp] = PD_LE64(v);
|
||||||
|
buf->wp += sizeof(v);
|
||||||
|
return sizeof(v);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufWriteS8(struct netbuf *buf, const s8 v)
|
||||||
|
{
|
||||||
|
return netbufWriteU8(buf, (u8)v);
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufWriteS16(struct netbuf *buf, const s16 v)
|
||||||
|
{
|
||||||
|
return netbufWriteU16(buf, (u16)v);
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufWriteS32(struct netbuf *buf, const s32 v)
|
||||||
|
{
|
||||||
|
return netbufWriteU32(buf, (u32)v);
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufWriteS64(struct netbuf *buf, const s64 v)
|
||||||
|
{
|
||||||
|
return netbufWriteU64(buf, (u64)v);
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufWriteF32(struct netbuf *buf, const f32 v)
|
||||||
|
{
|
||||||
|
const union {
|
||||||
|
f32 f;
|
||||||
|
u32 i;
|
||||||
|
} hack = { .f = v };
|
||||||
|
return netbufWriteU32(buf, hack.i);
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufWriteStr(struct netbuf *buf, const char *v)
|
||||||
|
{
|
||||||
|
if (!v) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 len = strlen(v) + 1;
|
||||||
|
if (len > 0xFFFF) {
|
||||||
|
len = 0xFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (netbufCanWrite(buf, len + sizeof(u16))) {
|
||||||
|
netbufWriteU16(buf, len);
|
||||||
|
netbufWriteData(buf, v, len);
|
||||||
|
buf->data[buf->wp - 1] = 0;
|
||||||
|
return sizeof(u16) + len;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufWriteCoord(struct netbuf *buf, const struct coord *v)
|
||||||
|
{
|
||||||
|
if (netbufCanWrite(buf, sizeof(*v))) {
|
||||||
|
netbufWriteF32(buf, v->x);
|
||||||
|
netbufWriteF32(buf, v->y);
|
||||||
|
netbufWriteF32(buf, v->z);
|
||||||
|
return sizeof(*v);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 netbufWriteMtxf(struct netbuf *buf, const Mtxf *in)
|
||||||
|
{
|
||||||
|
if (netbufCanWrite(buf, sizeof(*in))) {
|
||||||
|
for (s32 i = 0; i < 4; ++i) {
|
||||||
|
for (s32 j = 0; j < 4; ++j) {
|
||||||
|
netbufWriteF32(buf, in->m[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sizeof(*in);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void netbufReset(struct netbuf *buf)
|
||||||
|
{
|
||||||
|
memset(buf, 0, sizeof(*buf));
|
||||||
|
}
|
||||||
@@ -0,0 +1,386 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <PR/ultratypes.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "data.h"
|
||||||
|
#include "types.h"
|
||||||
|
#include "game/mainmenu.h"
|
||||||
|
#include "game/menu.h"
|
||||||
|
#include "game/gamefile.h"
|
||||||
|
#include "video.h"
|
||||||
|
#include "input.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "net/net.h"
|
||||||
|
|
||||||
|
extern MenuItemHandlerResult menuhandlerMainMenuCombatSimulator(s32 operation, struct menuitem *item, union handlerdata *data);
|
||||||
|
extern MenuItemHandlerResult menuhandlerMpAdvancedSetup(s32 operation, struct menuitem *item, union handlerdata *data);
|
||||||
|
|
||||||
|
static s32 g_NetMenuMaxPlayers = NET_MAX_CLIENTS;
|
||||||
|
static s32 g_NetMenuPort = NET_DEFAULT_PORT;
|
||||||
|
static char g_NetJoinAddr[NET_MAX_ADDR + 1];
|
||||||
|
static s32 g_NetJoinAddrPtr = 0;
|
||||||
|
|
||||||
|
/* host */
|
||||||
|
|
||||||
|
static MenuItemHandlerResult menuhandlerHostMaxPlayers(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||||
|
{
|
||||||
|
switch (operation) {
|
||||||
|
case MENUOP_GETSLIDER:
|
||||||
|
data->slider.value = g_NetMenuMaxPlayers;
|
||||||
|
break;
|
||||||
|
case MENUOP_SET:
|
||||||
|
if (data->slider.value) {
|
||||||
|
g_NetMenuMaxPlayers = data->slider.value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static MenuItemHandlerResult menuhandlerHostPort(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||||
|
{
|
||||||
|
if (operation == MENUOP_SET) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *menuhandlerHostPortValue(struct menuitem *item)
|
||||||
|
{
|
||||||
|
static char tmp[16];
|
||||||
|
snprintf(tmp, sizeof(tmp), "%u\n", g_NetMenuPort);
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItemHandlerResult menuhandlerHostStart(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||||
|
{
|
||||||
|
if (operation == MENUOP_SET) {
|
||||||
|
if (netStartServer(g_NetMenuPort, g_NetMenuMaxPlayers) == 0) {
|
||||||
|
menuhandlerMainMenuCombatSimulator(MENUOP_SET, NULL, NULL);
|
||||||
|
menuhandlerMpAdvancedSetup(MENUOP_SET, NULL, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct menuitem g_NetHostMenuItems[] = {
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SLIDER,
|
||||||
|
0,
|
||||||
|
MENUITEMFLAG_LITERAL_TEXT,
|
||||||
|
(uintptr_t)"Max Players",
|
||||||
|
NET_MAX_CLIENTS,
|
||||||
|
menuhandlerHostMaxPlayers,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SELECTABLE,
|
||||||
|
0,
|
||||||
|
MENUITEMFLAG_LITERAL_TEXT,
|
||||||
|
(uintptr_t)"Port\n",
|
||||||
|
(uintptr_t)&menuhandlerHostPortValue,
|
||||||
|
menuhandlerHostPort,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SELECTABLE,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
L_MPMENU_036, // "Start Game"
|
||||||
|
0,
|
||||||
|
menuhandlerHostStart,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SEPARATOR,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SELECTABLE,
|
||||||
|
0,
|
||||||
|
MENUITEMFLAG_SELECTABLE_CLOSESDIALOG,
|
||||||
|
L_OPTIONS_213, // "Back"
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
|
{ MENUITEMTYPE_END },
|
||||||
|
};
|
||||||
|
|
||||||
|
struct menudialogdef g_NetHostMenuDialog = {
|
||||||
|
MENUDIALOGTYPE_DEFAULT,
|
||||||
|
(uintptr_t)"Host Network Game",
|
||||||
|
g_NetHostMenuItems,
|
||||||
|
NULL,
|
||||||
|
MENUDIALOGFLAG_LITERAL_TEXT,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* join */
|
||||||
|
|
||||||
|
static const char *menutextJoinAddress(struct menuitem *item)
|
||||||
|
{
|
||||||
|
static char tmp[256 + 1];
|
||||||
|
if (item && item->flags & MENUITEMFLAG_SELECTABLE_CENTRE) {
|
||||||
|
// in centered dialog
|
||||||
|
if (g_NetMode == NETMODE_NONE) {
|
||||||
|
snprintf(tmp, sizeof(tmp), "%s_\n", g_NetJoinAddr);
|
||||||
|
} else if (g_NetLocalClient->state == CLSTATE_CONNECTING) {
|
||||||
|
snprintf(tmp, sizeof(tmp), "Connecting to %s...\n", g_NetJoinAddr);
|
||||||
|
} else if (g_NetLocalClient->state == CLSTATE_AUTH) {
|
||||||
|
snprintf(tmp, sizeof(tmp), "Authenticating with %s...\n", g_NetJoinAddr);
|
||||||
|
} else if (g_NetLocalClient->state == CLSTATE_LOBBY) {
|
||||||
|
snprintf(tmp, sizeof(tmp), "Waiting for host...\n");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// label
|
||||||
|
snprintf(tmp, sizeof(tmp), "%s\n", g_NetJoinAddr);
|
||||||
|
}
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
static MenuItemHandlerResult menuhandlerJoining(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||||
|
{
|
||||||
|
if (inputKeyPressed(VK_ESCAPE)) {
|
||||||
|
netDisconnect();
|
||||||
|
menuPopDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct menuitem g_NetJoiningMenuItems[] = {
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_LABEL,
|
||||||
|
0,
|
||||||
|
MENUITEMFLAG_SELECTABLE_CENTRE,
|
||||||
|
(uintptr_t)&menutextJoinAddress,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SEPARATOR,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SELECTABLE,
|
||||||
|
0,
|
||||||
|
MENUITEMFLAG_SELECTABLE_CENTRE | MENUITEMFLAG_LITERAL_TEXT,
|
||||||
|
(uintptr_t)"ESC to abort\n",
|
||||||
|
0,
|
||||||
|
menuhandlerJoining,
|
||||||
|
},
|
||||||
|
{ MENUITEMTYPE_END },
|
||||||
|
};
|
||||||
|
|
||||||
|
struct menudialogdef g_NetJoiningDialog = {
|
||||||
|
MENUDIALOGTYPE_SUCCESS,
|
||||||
|
(uintptr_t)"Joining Game...",
|
||||||
|
g_NetJoiningMenuItems,
|
||||||
|
NULL,
|
||||||
|
MENUDIALOGFLAG_LITERAL_TEXT | MENUDIALOGFLAG_IGNOREBACK | MENUDIALOGFLAG_STARTSELECTS,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static MenuItemHandlerResult menuhandlerEnterJoinAddress(s32 operation, struct menuitem *item, union handlerdata *data);
|
||||||
|
|
||||||
|
struct menuitem g_NetJoinAddressMenuItems[] = {
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_LABEL,
|
||||||
|
0,
|
||||||
|
MENUITEMFLAG_SELECTABLE_CENTRE,
|
||||||
|
(uintptr_t)&menutextJoinAddress,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SEPARATOR,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SELECTABLE,
|
||||||
|
0,
|
||||||
|
MENUITEMFLAG_SELECTABLE_CENTRE | MENUITEMFLAG_LITERAL_TEXT,
|
||||||
|
(uintptr_t)"ESC to return\n",
|
||||||
|
0,
|
||||||
|
menuhandlerEnterJoinAddress,
|
||||||
|
},
|
||||||
|
{ MENUITEMTYPE_END },
|
||||||
|
};
|
||||||
|
|
||||||
|
struct menudialogdef g_NetJoinAddressDialog = {
|
||||||
|
MENUDIALOGTYPE_SUCCESS,
|
||||||
|
(uintptr_t)"Enter Address",
|
||||||
|
g_NetJoinAddressMenuItems,
|
||||||
|
NULL,
|
||||||
|
MENUDIALOGFLAG_LITERAL_TEXT | MENUDIALOGFLAG_IGNOREBACK | MENUDIALOGFLAG_STARTSELECTS,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static MenuItemHandlerResult menuhandlerEnterJoinAddress(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||||
|
{
|
||||||
|
if (!menuIsDialogOpen(&g_NetJoinAddressDialog)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inputTextHandler(g_NetJoinAddr, NET_MAX_ADDR, &g_NetJoinAddrPtr) < 0) {
|
||||||
|
// escape has been pressed, stop editing
|
||||||
|
inputStopTextInput();
|
||||||
|
menuPopDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static MenuItemHandlerResult menuhandlerJoinAddress(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||||
|
{
|
||||||
|
if (operation == MENUOP_SET) {
|
||||||
|
inputClearLastKey();
|
||||||
|
inputClearLastTextChar();
|
||||||
|
inputStartTextInput();
|
||||||
|
g_NetJoinAddrPtr = strlen(g_NetJoinAddr);
|
||||||
|
menuPushDialog(&g_NetJoinAddressDialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItemHandlerResult menuhandlerJoinStart(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||||
|
{
|
||||||
|
if (operation == MENUOP_SET) {
|
||||||
|
if (netStartClient(g_NetJoinAddr) == 0) {
|
||||||
|
menuPushDialog(&g_NetJoiningDialog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct menuitem g_NetJoinMenuItems[] = {
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SELECTABLE,
|
||||||
|
0,
|
||||||
|
MENUITEMFLAG_LITERAL_TEXT,
|
||||||
|
(uintptr_t)"Address: \n",
|
||||||
|
(uintptr_t)&menutextJoinAddress,
|
||||||
|
menuhandlerJoinAddress,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SELECTABLE,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
L_MPMENU_036, // "Start Game"
|
||||||
|
0,
|
||||||
|
menuhandlerJoinStart,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SEPARATOR,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SELECTABLE,
|
||||||
|
0,
|
||||||
|
MENUITEMFLAG_SELECTABLE_CLOSESDIALOG,
|
||||||
|
L_OPTIONS_213, // "Back"
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
|
{ MENUITEMTYPE_END },
|
||||||
|
};
|
||||||
|
|
||||||
|
struct menudialogdef g_NetJoinMenuDialog = {
|
||||||
|
MENUDIALOGTYPE_DEFAULT,
|
||||||
|
(uintptr_t)"Join Network Game",
|
||||||
|
g_NetJoinMenuItems,
|
||||||
|
NULL,
|
||||||
|
MENUDIALOGFLAG_LITERAL_TEXT | MENUDIALOGFLAG_STARTSELECTS | MENUDIALOGFLAG_IGNOREBACK,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* main */
|
||||||
|
|
||||||
|
MenuItemHandlerResult menuhandlerHostGame(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||||
|
{
|
||||||
|
if (operation == MENUOP_SET) {
|
||||||
|
g_NetMenuPort = g_NetServerPort;
|
||||||
|
g_NetMenuMaxPlayers = g_NetMaxClients;
|
||||||
|
menuPushDialog(&g_NetHostMenuDialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItemHandlerResult menuhandlerJoinGame(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||||
|
{
|
||||||
|
if (operation == MENUOP_SET) {
|
||||||
|
if (g_NetJoinAddr[0] == '\0') {
|
||||||
|
strncpy(g_NetJoinAddr, g_NetLastJoinAddr, NET_MAX_ADDR);
|
||||||
|
g_NetJoinAddrPtr = strlen(g_NetJoinAddr);
|
||||||
|
}
|
||||||
|
menuPushDialog(&g_NetJoinMenuDialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct menuitem g_NetMenuItems[] = {
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SELECTABLE,
|
||||||
|
0,
|
||||||
|
MENUITEMFLAG_LITERAL_TEXT,
|
||||||
|
(uintptr_t)"Host Game\n",
|
||||||
|
0,
|
||||||
|
menuhandlerHostGame,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SELECTABLE,
|
||||||
|
0,
|
||||||
|
MENUITEMFLAG_LITERAL_TEXT,
|
||||||
|
(uintptr_t)"Join Game\n",
|
||||||
|
0,
|
||||||
|
menuhandlerJoinGame,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SEPARATOR,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SELECTABLE,
|
||||||
|
0,
|
||||||
|
MENUITEMFLAG_SELECTABLE_CLOSESDIALOG,
|
||||||
|
L_OPTIONS_213, // "Back"
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
|
{ MENUITEMTYPE_END },
|
||||||
|
};
|
||||||
|
|
||||||
|
struct menudialogdef g_NetMenuDialog = {
|
||||||
|
MENUDIALOGTYPE_DEFAULT,
|
||||||
|
(uintptr_t)"Network Game",
|
||||||
|
g_NetMenuItems,
|
||||||
|
NULL,
|
||||||
|
MENUDIALOGFLAG_MPLOCKABLE | MENUDIALOGFLAG_LITERAL_TEXT,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
File diff suppressed because it is too large.
Load diff
+23
-12
@@ -73,6 +73,9 @@
|
|||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
#include "console.h"
|
||||||
|
#include "net/net.h"
|
||||||
|
#include "net/netmsg.h"
|
||||||
|
|
||||||
extern u8 *g_MempHeap;
|
extern u8 *g_MempHeap;
|
||||||
extern u32 g_MempHeapSize;
|
extern u32 g_MempHeapSize;
|
||||||
@@ -419,6 +422,9 @@ void mainLoop(void)
|
|||||||
|
|
||||||
if (argFindByPrefix(1, "-ma")) {
|
if (argFindByPrefix(1, "-ma")) {
|
||||||
g_MainMemaHeapSize = strtol(argFindByPrefix(1, "-ma"), NULL, 0) * 1024;
|
g_MainMemaHeapSize = strtol(argFindByPrefix(1, "-ma"), NULL, 0) * 1024;
|
||||||
|
if (g_NetMode && g_NetMaxClients > MAX_LOCAL_PLAYERS) {
|
||||||
|
g_MainMemaHeapSize *= MAX_PLAYERS / MAX_LOCAL_PLAYERS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memaReset(mempAlloc(g_MainMemaHeapSize, MEMPOOL_STAGE), g_MainMemaHeapSize);
|
memaReset(mempAlloc(g_MainMemaHeapSize, MEMPOOL_STAGE), g_MainMemaHeapSize);
|
||||||
@@ -460,7 +466,15 @@ void mainLoop(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
|
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
|
||||||
|
#ifdef PLATFORM_N64
|
||||||
g_MpSetup.chrslots = 0x03;
|
g_MpSetup.chrslots = 0x03;
|
||||||
|
#else
|
||||||
|
if (g_Vars.antiplayernum < 0) {
|
||||||
|
// Counter-Operative now uses a different approach which allows more than 2 players.
|
||||||
|
// Co-Operative, on the other hand, is currently limited to 2 players.
|
||||||
|
g_MpSetup.chrslots = 0x03;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
mpReset();
|
mpReset();
|
||||||
} else if (g_Vars.perfectbuddynum) {
|
} else if (g_Vars.perfectbuddynum) {
|
||||||
mpReset();
|
mpReset();
|
||||||
@@ -468,16 +482,8 @@ void mainLoop(void)
|
|||||||
&& (numplayers >= 2 || g_Vars.lvmpbotlevel || argFindByPrefix(1, "-play"))) {
|
&& (numplayers >= 2 || g_Vars.lvmpbotlevel || argFindByPrefix(1, "-play"))) {
|
||||||
g_MpSetup.chrslots = 1;
|
g_MpSetup.chrslots = 1;
|
||||||
|
|
||||||
if (numplayers >= 2) {
|
for (s32 i = 1; i < numplayers; ++i) {
|
||||||
g_MpSetup.chrslots |= 1 << 1;
|
g_MpSetup.chrslots |= 1 << i;
|
||||||
}
|
|
||||||
|
|
||||||
if (numplayers >= 3) {
|
|
||||||
g_MpSetup.chrslots |= 1 << 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (numplayers >= 4) {
|
|
||||||
g_MpSetup.chrslots |= 1 << 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_MpSetup.stagenum = g_StageNum;
|
g_MpSetup.stagenum = g_StageNum;
|
||||||
@@ -561,6 +567,9 @@ void mainTick(void)
|
|||||||
gdl = profileRender(gdl);
|
gdl = profileRender(gdl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gdl = conRender(gdl);
|
||||||
|
gdl = netDebugRender(gdl);
|
||||||
|
|
||||||
gDPFullSync(gdl++);
|
gDPFullSync(gdl++);
|
||||||
gSPEndDisplayList(gdl++);
|
gSPEndDisplayList(gdl++);
|
||||||
}
|
}
|
||||||
@@ -588,7 +597,7 @@ void mainEndStage(void)
|
|||||||
s32 prevplayernum = g_Vars.currentplayernum;
|
s32 prevplayernum = g_Vars.currentplayernum;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < PLAYERCOUNT(); i++) {
|
for (i = 0; i < LOCALPLAYERCOUNT(); i++) {
|
||||||
setCurrentPlayerNum(i);
|
setCurrentPlayerNum(i);
|
||||||
endscreenPushCoop();
|
endscreenPushCoop();
|
||||||
}
|
}
|
||||||
@@ -599,7 +608,7 @@ void mainEndStage(void)
|
|||||||
s32 prevplayernum = g_Vars.currentplayernum;
|
s32 prevplayernum = g_Vars.currentplayernum;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < PLAYERCOUNT(); i++) {
|
for (i = 0; i < LOCALPLAYERCOUNT(); i++) {
|
||||||
setCurrentPlayerNum(i);
|
setCurrentPlayerNum(i);
|
||||||
endscreenPushAnti();
|
endscreenPushAnti();
|
||||||
}
|
}
|
||||||
@@ -612,6 +621,8 @@ void mainEndStage(void)
|
|||||||
endscreenPrepare();
|
endscreenPrepare();
|
||||||
musicStartMenu();
|
musicStartMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
netServerStageEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
g_MainIsEndscreen = true;
|
g_MainIsEndscreen = true;
|
||||||
|
|||||||
@@ -24,7 +24,9 @@
|
|||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
#include "console.h"
|
||||||
#include "mixer.h"
|
#include "mixer.h"
|
||||||
|
#include "net/net.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* private typedefs and defines
|
* private typedefs and defines
|
||||||
@@ -240,6 +242,14 @@ void schedSubmitTask(OSSched *sc, OSScTask *t)
|
|||||||
void schedStartFrame(OSSched *sc)
|
void schedStartFrame(OSSched *sc)
|
||||||
{
|
{
|
||||||
videoStartFrame();
|
videoStartFrame();
|
||||||
|
if (g_Vars.diffframe60) {
|
||||||
|
if (g_NetMode) {
|
||||||
|
videoCapFramerate(120);
|
||||||
|
netStartFrame();
|
||||||
|
} else {
|
||||||
|
videoCapFramerate(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void schedAudioFrame(OSSched *sc)
|
void schedAudioFrame(OSSched *sc)
|
||||||
@@ -270,6 +280,8 @@ void schedAudioFrame(OSSched *sc)
|
|||||||
*/
|
*/
|
||||||
void schedEndFrame(OSSched *sc)
|
void schedEndFrame(OSSched *sc)
|
||||||
{
|
{
|
||||||
|
static bool netDebugKey = false;
|
||||||
|
|
||||||
sc->frameCount++;
|
sc->frameCount++;
|
||||||
|
|
||||||
#if PAL
|
#if PAL
|
||||||
@@ -289,11 +301,22 @@ void schedEndFrame(OSSched *sc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inputUpdate();
|
inputUpdate();
|
||||||
|
conTick();
|
||||||
|
|
||||||
|
const bool newKey = inputKeyPressed(VK_F9);
|
||||||
|
if (!netDebugKey && newKey) {
|
||||||
|
g_NetDebugDraw = !g_NetDebugDraw;
|
||||||
|
}
|
||||||
|
netDebugKey = newKey;
|
||||||
|
|
||||||
joyStartReadData(&g_PiMesgQueue);
|
joyStartReadData(&g_PiMesgQueue);
|
||||||
joyReadData();
|
joyReadData();
|
||||||
joy00014238();
|
joy00014238();
|
||||||
|
|
||||||
|
if (g_Vars.diffframe60) {
|
||||||
|
netEndFrame();
|
||||||
|
}
|
||||||
|
|
||||||
sndHandleRetrace();
|
sndHandleRetrace();
|
||||||
schedAudioFrame(sc);
|
schedAudioFrame(sc);
|
||||||
schedRenderCrashPeriodically(sc->frameCount);
|
schedRenderCrashPeriodically(sc->frameCount);
|
||||||
|
|||||||
@@ -1042,6 +1042,10 @@ void preprocessMpConfigs(u8 *data, u32 size)
|
|||||||
PD_SWAP_VAL(cfg->setup.options);
|
PD_SWAP_VAL(cfg->setup.options);
|
||||||
PD_SWAP_VAL(cfg->setup.teamscorelimit);
|
PD_SWAP_VAL(cfg->setup.teamscorelimit);
|
||||||
PD_SWAP_VAL(cfg->setup.chrslots);
|
PD_SWAP_VAL(cfg->setup.chrslots);
|
||||||
|
#if MAX_PLAYERS > 4
|
||||||
|
// make space for the extra players
|
||||||
|
cfg->setup.chrslots = (cfg->setup.chrslots & 0x000f) | ((cfg->setup.chrslots & 0x0ff0) << 4);
|
||||||
|
#endif
|
||||||
// TODO: are these required or are they always 0?
|
// TODO: are these required or are they always 0?
|
||||||
PD_SWAP_VAL(cfg->setup.fileguid.deviceserial);
|
PD_SWAP_VAL(cfg->setup.fileguid.deviceserial);
|
||||||
PD_SWAP_VAL(cfg->setup.fileguid.fileid);
|
PD_SWAP_VAL(cfg->setup.fileguid.fileid);
|
||||||
|
|||||||
+5
-5
@@ -53,10 +53,10 @@
|
|||||||
|
|
||||||
u8 *g_RomFile;
|
u8 *g_RomFile;
|
||||||
u32 g_RomFileSize;
|
u32 g_RomFileSize;
|
||||||
|
const char *g_RomName = ROMDATA_ROM_NAME;
|
||||||
|
|
||||||
static u8 *romDataSeg;
|
static u8 *romDataSeg;
|
||||||
static u32 romDataSegSize;
|
static u32 romDataSegSize;
|
||||||
static const char *romName = ROMDATA_ROM_NAME;
|
|
||||||
|
|
||||||
enum loadsource {
|
enum loadsource {
|
||||||
SRC_UNLOADED = 0,
|
SRC_UNLOADED = 0,
|
||||||
@@ -188,12 +188,12 @@ static inline void romdataWrongRomError(const char *fmt, ...)
|
|||||||
|
|
||||||
static inline void romdataLoadRom(void)
|
static inline void romdataLoadRom(void)
|
||||||
{
|
{
|
||||||
sysLogPrintf(LOG_NOTE, "ROM file: %s", romName);
|
sysLogPrintf(LOG_NOTE, "ROM file: %s", g_RomName);
|
||||||
|
|
||||||
g_RomFile = fsFileLoad(romName, &g_RomFileSize);
|
g_RomFile = fsFileLoad(g_RomName, &g_RomFileSize);
|
||||||
|
|
||||||
if (!g_RomFile) {
|
if (!g_RomFile) {
|
||||||
sysFatalError("Could not open ROM file %s.\nEnsure that it is in the %s directory.", romName, fsFullPath(""));
|
sysFatalError("Could not open ROM file %s.\nEnsure that it is in the %s directory.", g_RomName, fsFullPath(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
// zips are not guaranteed to start with PK, but might as well at least try
|
// zips are not guaranteed to start with PK, but might as well at least try
|
||||||
@@ -368,7 +368,7 @@ s32 romdataInit(void)
|
|||||||
{
|
{
|
||||||
const char *altRomName = sysArgGetString("--rom-file");
|
const char *altRomName = sysArgGetString("--rom-file");
|
||||||
if (altRomName) {
|
if (altRomName) {
|
||||||
romName = altRomName;
|
g_RomName = altRomName;
|
||||||
}
|
}
|
||||||
|
|
||||||
romdataLoadRom();
|
romdataLoadRom();
|
||||||
|
|||||||
+14
-2
@@ -12,6 +12,7 @@
|
|||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <PR/ultratypes.h>
|
#include <PR/ultratypes.h>
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
#include "console.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
#ifdef PLATFORM_WIN32
|
#ifdef PLATFORM_WIN32
|
||||||
@@ -157,6 +158,12 @@ u64 sysGetMicroseconds(void)
|
|||||||
return ((u64)tv.tv_sec * USEC_IN_SEC + (u64)tv.tv_usec) - startTick;
|
return ((u64)tv.tv_sec * USEC_IN_SEC + (u64)tv.tv_usec) - startTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float sysGetSeconds(void)
|
||||||
|
{
|
||||||
|
u64 t = sysGetMicroseconds();
|
||||||
|
return (f32)t / 1000000.f;
|
||||||
|
}
|
||||||
|
|
||||||
s32 sysLogIsOpen(void)
|
s32 sysLogIsOpen(void)
|
||||||
{
|
{
|
||||||
return (logPath[0] != '\0');
|
return (logPath[0] != '\0');
|
||||||
@@ -183,8 +190,13 @@ void sysLogPrintf(s32 level, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *fout = (level == LOG_NOTE) ? stdout : stderr;
|
FILE *fout = ((level & 0x0f) == LOG_NOTE) ? stdout : stderr;
|
||||||
fprintf(fout, "%s%s\n", prefix[level], logmsg);
|
fprintf(fout, "%s%s\n", prefix[level & 0x0f], logmsg);
|
||||||
|
fflush(fout);
|
||||||
|
|
||||||
|
if ((level & LOGFLAG_NOCON) == 0) {
|
||||||
|
conPrintLn((level & LOGFLAG_SHOWMSG) != 0, logmsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sysFatalError(const char *fmt, ...)
|
void sysFatalError(const char *fmt, ...)
|
||||||
|
|||||||
@@ -233,6 +233,14 @@ void videoSetDetailTextures(s32 detail)
|
|||||||
gfx_detail_textures_enabled = (bool)texDetail;
|
gfx_detail_textures_enabled = (bool)texDetail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void videoCapFramerate(s32 limit)
|
||||||
|
{
|
||||||
|
if (vidFramerateLimit > 0 && vidFramerateLimit < limit) {
|
||||||
|
limit = vidFramerateLimit;
|
||||||
|
}
|
||||||
|
wmAPI->set_target_fps(limit ? limit : vidFramerateLimit);
|
||||||
|
}
|
||||||
|
|
||||||
s32 videoCreateFramebuffer(u32 w, u32 h, s32 upscale, s32 autoresize)
|
s32 videoCreateFramebuffer(u32 w, u32 h, s32 upscale, s32 autoresize)
|
||||||
{
|
{
|
||||||
return gfx_create_framebuffer(w, h, upscale, autoresize);
|
return gfx_create_framebuffer(w, h, upscale, autoresize);
|
||||||
|
|||||||
+29
-29
@@ -26,7 +26,7 @@
|
|||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
struct activemenu g_AmMenus[MAX_PLAYERS];
|
struct activemenu g_AmMenus[MAX_LOCAL_PLAYERS];
|
||||||
struct fontchar *g_AmFont1;
|
struct fontchar *g_AmFont1;
|
||||||
struct font *g_AmFont2;
|
struct font *g_AmFont2;
|
||||||
s32 g_AmIndex;
|
s32 g_AmIndex;
|
||||||
@@ -547,7 +547,7 @@ void amReset(void)
|
|||||||
g_AmFont1 = g_CharsHandelGothicSm;
|
g_AmFont1 = g_CharsHandelGothicSm;
|
||||||
g_AmFont2 = g_FontHandelGothicSm;
|
g_AmFont2 = g_FontHandelGothicSm;
|
||||||
#else
|
#else
|
||||||
if (PLAYERCOUNT() >= 2) {
|
if (LOCALPLAYERCOUNT() >= 2) {
|
||||||
g_AmFont1 = g_CharsHandelGothicXs;
|
g_AmFont1 = g_CharsHandelGothicXs;
|
||||||
g_AmFont2 = g_FontHandelGothicXs;
|
g_AmFont2 = g_FontHandelGothicXs;
|
||||||
} else {
|
} else {
|
||||||
@@ -578,7 +578,7 @@ s16 amCalculateSlotWidth(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
if (PLAYERCOUNT() > 1) {
|
if (LOCALPLAYERCOUNT() > 1) {
|
||||||
max += 3;
|
max += 3;
|
||||||
} else {
|
} else {
|
||||||
max += 4;
|
max += 4;
|
||||||
@@ -762,32 +762,32 @@ void amClose(void)
|
|||||||
bool amIsCramped(void)
|
bool amIsCramped(void)
|
||||||
{
|
{
|
||||||
#if VERSION == VERSION_JPN_FINAL
|
#if VERSION == VERSION_JPN_FINAL
|
||||||
if (PLAYERCOUNT() >= 3 && g_AmMenus[g_AmIndex].screenindex != 1) {
|
if (LOCALPLAYERCOUNT() >= 3 && g_AmMenus[g_AmIndex].screenindex != 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS4MB() && PLAYERCOUNT() == 2) {
|
if (IS4MB() && LOCALPLAYERCOUNT() == 2) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||||
&& PLAYERCOUNT() == 2
|
&& LOCALPLAYERCOUNT() == 2
|
||||||
&& g_AmMenus[g_AmIndex].screenindex != 1) {
|
&& g_AmMenus[g_AmIndex].screenindex != 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
return (g_AmMenus[g_AmIndex].screenindex == 0 && PLAYERCOUNT() >= 3)
|
return (g_AmMenus[g_AmIndex].screenindex == 0 && LOCALPLAYERCOUNT() >= 3)
|
||||||
|| (IS4MB() && PLAYERCOUNT() == 2)
|
|| (IS4MB() && LOCALPLAYERCOUNT() == 2)
|
||||||
|| (PLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL);
|
|| (LOCALPLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void amCalculateSlotPosition(s16 column, s16 row, s16 *x, s16 *y)
|
void amCalculateSlotPosition(s16 column, s16 row, s16 *x, s16 *y)
|
||||||
{
|
{
|
||||||
#if VERSION == VERSION_JPN_FINAL
|
#if VERSION == VERSION_JPN_FINAL
|
||||||
s32 playercount = PLAYERCOUNT();
|
s32 playercount = LOCALPLAYERCOUNT();
|
||||||
|
|
||||||
*x = g_AmMenus[g_AmIndex].xradius * (column - 1);
|
*x = g_AmMenus[g_AmIndex].xradius * (column - 1);
|
||||||
*y = (row - 1) * 50;
|
*y = (row - 1) * 50;
|
||||||
@@ -841,7 +841,7 @@ void amCalculateSlotPosition(s16 column, s16 row, s16 *x, s16 *y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif VERSION >= VERSION_NTSC_1_0
|
#elif VERSION >= VERSION_NTSC_1_0
|
||||||
s32 playercount = PLAYERCOUNT();
|
s32 playercount = LOCALPLAYERCOUNT();
|
||||||
|
|
||||||
*x = g_AmMenus[g_AmIndex].xradius * (column - 1);
|
*x = g_AmMenus[g_AmIndex].xradius * (column - 1);
|
||||||
*y = (row - 1) * 50;
|
*y = (row - 1) * 50;
|
||||||
@@ -893,7 +893,7 @@ void amCalculateSlotPosition(s16 column, s16 row, s16 *x, s16 *y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
s32 playercount = PLAYERCOUNT();
|
s32 playercount = LOCALPLAYERCOUNT();
|
||||||
|
|
||||||
*x = g_AmMenus[g_AmIndex].xradius * (column - 1);
|
*x = g_AmMenus[g_AmIndex].xradius * (column - 1);
|
||||||
*y = (row - 1) * 50;
|
*y = (row - 1) * 50;
|
||||||
@@ -973,15 +973,15 @@ Gfx *amRenderAibotInfo(Gfx *gdl, s32 buddynum)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
if (PLAYERCOUNT() == 1 && optionsGetEffectiveScreenSize() != SCREENSIZE_FULL) {
|
if (LOCALPLAYERCOUNT() == 1 && optionsGetEffectiveScreenSize() != SCREENSIZE_FULL) {
|
||||||
wide = true;
|
wide = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
if ((PLAYERCOUNT() == 2 && (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || IS4MB())) || PLAYERCOUNT() >= 3)
|
if ((LOCALPLAYERCOUNT() == 2 && (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || IS4MB())) || LOCALPLAYERCOUNT() >= 3)
|
||||||
#else
|
#else
|
||||||
if ((PLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) || PLAYERCOUNT() >= 3)
|
if ((LOCALPLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) || LOCALPLAYERCOUNT() >= 3)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if ((g_Vars.currentplayernum % 2) == 0) {
|
if ((g_Vars.currentplayernum % 2) == 0) {
|
||||||
@@ -1014,7 +1014,7 @@ Gfx *amRenderAibotInfo(Gfx *gdl, s32 buddynum)
|
|||||||
- (s32)(textwidth * 0.5f)
|
- (s32)(textwidth * 0.5f)
|
||||||
+ offset;
|
+ offset;
|
||||||
|
|
||||||
if (PLAYERCOUNT() >= 2) {
|
if (LOCALPLAYERCOUNT() >= 2) {
|
||||||
y = viGetViewTop() + 5;
|
y = viGetViewTop() + 5;
|
||||||
} else {
|
} else {
|
||||||
y = viGetViewTop() + 10;
|
y = viGetViewTop() + 10;
|
||||||
@@ -1030,12 +1030,12 @@ Gfx *amRenderAibotInfo(Gfx *gdl, s32 buddynum)
|
|||||||
gdl = func0f1574d0jf(gdl, &x, &y, aibotname, g_AmFont1, g_AmFont2, -1,
|
gdl = func0f1574d0jf(gdl, &x, &y, aibotname, g_AmFont1, g_AmFont2, -1,
|
||||||
0x000000ff, SCREEN_320, SCREEN_240, 0, 0);
|
0x000000ff, SCREEN_320, SCREEN_240, 0, 0);
|
||||||
|
|
||||||
y += (PLAYERCOUNT() >= 2) ? 0 : (s32)(textheight * 1.1f);
|
y += (LOCALPLAYERCOUNT() >= 2) ? 0 : (s32)(textheight * 1.1f);
|
||||||
#else
|
#else
|
||||||
gdl = textRender(gdl, &x, &y, aibotname, g_AmFont1, g_AmFont2, -1,
|
gdl = textRender(gdl, &x, &y, aibotname, g_AmFont1, g_AmFont2, -1,
|
||||||
0x000000ff, SCREEN_320, SCREEN_240, 0, 0);
|
0x000000ff, SCREEN_320, SCREEN_240, 0, 0);
|
||||||
|
|
||||||
y += (PLAYERCOUNT() >= 2) ? 0 : (s32)(textheight * 1.1f);
|
y += (LOCALPLAYERCOUNT() >= 2) ? 0 : (s32)(textheight * 1.1f);
|
||||||
textMeasure(&textheight, &textwidth, weaponname, g_AmFont1, g_AmFont2, 0);
|
textMeasure(&textheight, &textwidth, weaponname, g_AmFont1, g_AmFont2, 0);
|
||||||
|
|
||||||
x = viGetViewLeft() / g_ScaleX
|
x = viGetViewLeft() / g_ScaleX
|
||||||
@@ -1064,7 +1064,7 @@ Gfx *amRenderAibotInfo(Gfx *gdl, s32 buddynum)
|
|||||||
- (s32)(textwidth * 0.5f)
|
- (s32)(textwidth * 0.5f)
|
||||||
+ offset;
|
+ offset;
|
||||||
|
|
||||||
if (PLAYERCOUNT() >= 2) {
|
if (LOCALPLAYERCOUNT() >= 2) {
|
||||||
y = viGetViewTop() + 5;
|
y = viGetViewTop() + 5;
|
||||||
} else {
|
} else {
|
||||||
y = viGetViewTop() + 10;
|
y = viGetViewTop() + 10;
|
||||||
@@ -1123,7 +1123,7 @@ Gfx *amRenderSlot(Gfx *gdl, char *text, s16 x, s16 y, s32 mode, s32 flags)
|
|||||||
paddingtop = 6;
|
paddingtop = 6;
|
||||||
paddingbottom = 6;
|
paddingbottom = 6;
|
||||||
|
|
||||||
if (PLAYERCOUNT() >= 2) {
|
if (LOCALPLAYERCOUNT() >= 2) {
|
||||||
paddingtop = 5;
|
paddingtop = 5;
|
||||||
paddingbottom = 3;
|
paddingbottom = 3;
|
||||||
}
|
}
|
||||||
@@ -1262,7 +1262,7 @@ Gfx *amRender(Gfx *gdl)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
const s32 playercount = PLAYERCOUNT();
|
const s32 playercount = LOCALPLAYERCOUNT();
|
||||||
if (playercount < 2 || (playercount == 2 && optionsGetScreenSplit() == SCREENSPLIT_HORIZONTAL)) {
|
if (playercount < 2 || (playercount == 2 && optionsGetScreenSplit() == SCREENSPLIT_HORIZONTAL)) {
|
||||||
gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT);
|
gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT);
|
||||||
}
|
}
|
||||||
@@ -1487,7 +1487,7 @@ Gfx *amRender(Gfx *gdl)
|
|||||||
above = 6;
|
above = 6;
|
||||||
below = 6;
|
below = 6;
|
||||||
|
|
||||||
if (PLAYERCOUNT() >= 2) {
|
if (LOCALPLAYERCOUNT() >= 2) {
|
||||||
above = 5;
|
above = 5;
|
||||||
below = 3;
|
below = 3;
|
||||||
}
|
}
|
||||||
@@ -1510,7 +1510,7 @@ Gfx *amRender(Gfx *gdl)
|
|||||||
halfwidth = 1;
|
halfwidth = 1;
|
||||||
above = 2;
|
above = 2;
|
||||||
below = 0;
|
below = 0;
|
||||||
} else if (PLAYERCOUNT() >= 2) {
|
} else if (LOCALPLAYERCOUNT() >= 2) {
|
||||||
s32 textheight;
|
s32 textheight;
|
||||||
s32 textwidth;
|
s32 textwidth;
|
||||||
char text[32];
|
char text[32];
|
||||||
@@ -1592,16 +1592,16 @@ Gfx *amRender(Gfx *gdl)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
barwidth = PLAYERCOUNT() >= 2 ? 48 : 64;
|
barwidth = LOCALPLAYERCOUNT() >= 2 ? 48 : 64;
|
||||||
barheight = PLAYERCOUNT() >= 2 ? 7 : 11;
|
barheight = LOCALPLAYERCOUNT() >= 2 ? 7 : 11;
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
|
|
||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
if ((PLAYERCOUNT() == 2 && (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || IS4MB())) || PLAYERCOUNT() >= 3) {
|
if ((LOCALPLAYERCOUNT() == 2 && (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || IS4MB())) || LOCALPLAYERCOUNT() >= 3) {
|
||||||
xoffset = (g_Vars.currentplayernum & 1) == 0 ? 8 : -8;
|
xoffset = (g_Vars.currentplayernum & 1) == 0 ? 8 : -8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PLAYERCOUNT() == 1 && optionsGetEffectiveScreenSize() != SCREENSIZE_FULL) {
|
if (LOCALPLAYERCOUNT() == 1 && optionsGetEffectiveScreenSize() != SCREENSIZE_FULL) {
|
||||||
part1left = viGetViewLeft() / g_ScaleX + 32;
|
part1left = viGetViewLeft() / g_ScaleX + 32;
|
||||||
} else {
|
} else {
|
||||||
part1left = (s32) ((viGetViewWidth() / g_ScaleX) * 0.5f)
|
part1left = (s32) ((viGetViewWidth() / g_ScaleX) * 0.5f)
|
||||||
@@ -1610,7 +1610,7 @@ Gfx *amRender(Gfx *gdl)
|
|||||||
+ xoffset;
|
+ xoffset;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if ((PLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) || PLAYERCOUNT() >= 3) {
|
if ((LOCALPLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) || LOCALPLAYERCOUNT() >= 3) {
|
||||||
xoffset = (g_Vars.currentplayernum & 1) == 0 ? 8 : -8;
|
xoffset = (g_Vars.currentplayernum & 1) == 0 ? 8 : -8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1636,7 +1636,7 @@ Gfx *amRender(Gfx *gdl)
|
|||||||
gDPSetRenderMode(gdl++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
|
gDPSetRenderMode(gdl++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
|
||||||
gDPSetCombineMode(gdl++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
|
gDPSetCombineMode(gdl++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
|
||||||
|
|
||||||
y = viGetViewTop() + viGetViewHeight() - (PLAYERCOUNT() >= 2 ? 19 : 34);
|
y = viGetViewTop() + viGetViewHeight() - (LOCALPLAYERCOUNT() >= 2 ? 19 : 34);
|
||||||
|
|
||||||
// NTSC beta doesn't scale the health bar when hi-res is on,
|
// NTSC beta doesn't scale the health bar when hi-res is on,
|
||||||
// and it only matches if part2left is an inline expression
|
// and it only matches if part2left is an inline expression
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ void amTick(void)
|
|||||||
s32 prevplayernum = g_Vars.currentplayernum;
|
s32 prevplayernum = g_Vars.currentplayernum;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < PLAYERCOUNT(); i++) {
|
for (i = 0; i < LOCALPLAYERCOUNT(); i++) {
|
||||||
setCurrentPlayerNum(i);
|
setCurrentPlayerNum(i);
|
||||||
g_AmIndex = g_Vars.currentplayernum;
|
g_AmIndex = g_Vars.currentplayernum;
|
||||||
|
|
||||||
|
|||||||
@@ -1016,7 +1016,7 @@ void eyespyProcessInput(bool allowbuttons)
|
|||||||
// Make eyespy look horizontally
|
// Make eyespy look horizontally
|
||||||
if (domovecentre) {
|
if (domovecentre) {
|
||||||
if (g_Vars.currentplayer->eyespy->verta > 0.0f && forwardspeed != 0) {
|
if (g_Vars.currentplayer->eyespy->verta > 0.0f && forwardspeed != 0) {
|
||||||
if (controlmode != CONTROLMODE_PC) {
|
if (controlmode < CONTROLMODE_PC) {
|
||||||
if (g_Vars.currentplayer->eyespy->verta < 180.0f) {
|
if (g_Vars.currentplayer->eyespy->verta < 180.0f) {
|
||||||
tmp = g_Vars.currentplayer->eyespy->verta;
|
tmp = g_Vars.currentplayer->eyespy->verta;
|
||||||
|
|
||||||
|
|||||||
+55
-5
@@ -56,6 +56,8 @@
|
|||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
#include "game/stagetable.h"
|
#include "game/stagetable.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
|
#include "net/net.h"
|
||||||
|
#include "net/netmsg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GUNLOADSTATE_FLUX 0
|
#define GUNLOADSTATE_FLUX 0
|
||||||
@@ -4472,7 +4474,7 @@ struct defaultobj *bgunCreateThrownProjectile2(struct chrdata *chr, struct gset
|
|||||||
* 2 = fumbling grenade from right hand (due to nbomb)
|
* 2 = fumbling grenade from right hand (due to nbomb)
|
||||||
* 3 = fumbling grenade from left hand (actually not possible)
|
* 3 = fumbling grenade from left hand (actually not possible)
|
||||||
*/
|
*/
|
||||||
void bgunCreateThrownProjectile(s32 handnum, struct gset *gset)
|
struct defaultobj *bgunCreateThrownProjectile(s32 handnum, struct gset *gset)
|
||||||
{
|
{
|
||||||
struct coord velocity = {0, 0, 0};
|
struct coord velocity = {0, 0, 0};
|
||||||
Mtxf sp1f4;
|
Mtxf sp1f4;
|
||||||
@@ -4502,6 +4504,13 @@ void bgunCreateThrownProjectile(s32 handnum, struct gset *gset)
|
|||||||
struct trainingdata *data;
|
struct trainingdata *data;
|
||||||
u32 stack;
|
u32 stack;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
// don't do anything if we're not the authority
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (handnum >= 2) {
|
if (handnum >= 2) {
|
||||||
droppinggrenade = true;
|
droppinggrenade = true;
|
||||||
handnum -= 2;
|
handnum -= 2;
|
||||||
@@ -4667,7 +4676,16 @@ void bgunCreateThrownProjectile(s32 handnum, struct gset *gset)
|
|||||||
weapon->base.hidden |= OBJHFLAG_THROWNKNIFE;
|
weapon->base.hidden |= OBJHFLAG_THROWNKNIFE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (obj && g_NetMode == NETMODE_SERVER) {
|
||||||
|
netmsgSvcPropSpawnWrite(&g_NetMsgRel, obj->prop);
|
||||||
|
netmsgSvcPropMoveWrite(&g_NetMsgRel, obj->prop, NULL);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bgunUpdateHeldRocket(s32 handnum)
|
void bgunUpdateHeldRocket(s32 handnum)
|
||||||
@@ -4771,6 +4789,12 @@ void bgunCreateFiredProjectile(s32 handnum)
|
|||||||
f32 spd4[4];
|
f32 spd4[4];
|
||||||
f32 spc4[4];
|
f32 spc4[4];
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
hand = g_Vars.currentplayer->hands + handnum;
|
hand = g_Vars.currentplayer->hands + handnum;
|
||||||
|
|
||||||
playerprop = g_Vars.currentplayer->prop;
|
playerprop = g_Vars.currentplayer->prop;
|
||||||
@@ -4983,6 +5007,12 @@ void bgunCreateFiredProjectile(s32 handnum)
|
|||||||
weapon->base.prop = NULL;
|
weapon->base.prop = NULL;
|
||||||
weapon->base.model = NULL;
|
weapon->base.model = NULL;
|
||||||
}
|
}
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
else if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
netmsgSvcPropSpawnWrite(&g_NetMsgRel, weapon->base.prop);
|
||||||
|
netmsgSvcPropMoveWrite(&g_NetMsgRel, weapon->base.prop, NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
// NTSC beta doesn't have any of the failure checks
|
// NTSC beta doesn't have any of the failure checks
|
||||||
Mtxf sp78;
|
Mtxf sp78;
|
||||||
@@ -6313,6 +6343,13 @@ void bgunDisarm(struct prop *attackerprop)
|
|||||||
s32 modelnum;
|
s32 modelnum;
|
||||||
s32 i;
|
s32 i;
|
||||||
bool drop;
|
bool drop;
|
||||||
|
struct defaultobj *obj;
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
// don't do anything if we're not the authority
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!weaponHasFlag(weaponnum, WEAPONFLAG_UNDROPPABLE) && weaponnum <= WEAPON_RCP45) {
|
if (!weaponHasFlag(weaponnum, WEAPONFLAG_UNDROPPABLE) && weaponnum <= WEAPON_RCP45) {
|
||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
@@ -6330,6 +6367,12 @@ void bgunDisarm(struct prop *attackerprop)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
netmsgSvcChrDisarmWrite(&g_NetMsgRel, player->prop->chr, attackerprop, weaponnum, 0.f, NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
chr = player->prop->chr;
|
chr = player->prop->chr;
|
||||||
drop = true;
|
drop = true;
|
||||||
|
|
||||||
@@ -6358,7 +6401,7 @@ void bgunDisarm(struct prop *attackerprop)
|
|||||||
&& player->hands[i].stateminor == HANDSTATEMINOR_ATTACK_THROW_0) {
|
&& player->hands[i].stateminor == HANDSTATEMINOR_ATTACK_THROW_0) {
|
||||||
#endif
|
#endif
|
||||||
drop = false;
|
drop = false;
|
||||||
bgunCreateThrownProjectile(i + 2, &player->hands[i].gset);
|
obj = bgunCreateThrownProjectile(i + 2, &player->hands[i].gset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6382,6 +6425,13 @@ void bgunDisarm(struct prop *attackerprop)
|
|||||||
}
|
}
|
||||||
|
|
||||||
objDrop(prop2, true);
|
objDrop(prop2, true);
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
netmsgSvcPropSpawnWrite(&g_NetMsgRel, prop2);
|
||||||
|
netmsgSvcPropMoveWrite(&g_NetMsgRel, prop2, NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11734,7 +11784,7 @@ void bgunSetTriggerOn(s32 handnum, bool on)
|
|||||||
s32 bgunConsiderToggleGunFunction(s32 usedowntime, bool trigpressed, bool fromactivemenu, bool fromdedicatedbutton)
|
s32 bgunConsiderToggleGunFunction(s32 usedowntime, bool trigpressed, bool fromactivemenu, bool fromdedicatedbutton)
|
||||||
{
|
{
|
||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
const bool extcontrols = PLAYER_EXTCFG().extcontrols;
|
const bool extcontrols = PLAYER_EXTCFG().extcontrols || g_Vars.currentplayer->isremote;
|
||||||
bool docontinue;
|
bool docontinue;
|
||||||
#endif
|
#endif
|
||||||
switch (bgunGetWeaponNum(HAND_RIGHT)) {
|
switch (bgunGetWeaponNum(HAND_RIGHT)) {
|
||||||
@@ -11853,7 +11903,7 @@ void bgun0f0a8c50(void)
|
|||||||
case WEAPON_LAPTOPGUN:
|
case WEAPON_LAPTOPGUN:
|
||||||
case WEAPON_DRAGON:
|
case WEAPON_DRAGON:
|
||||||
case WEAPON_REMOTEMINE:
|
case WEAPON_REMOTEMINE:
|
||||||
if (PLAYER_EXTCFG().extcontrols) {
|
if (PLAYER_EXTCFG().extcontrols || g_Vars.currentplayer->isremote) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -12756,7 +12806,7 @@ Gfx *bgunDrawHud(Gfx *gdl)
|
|||||||
{
|
{
|
||||||
struct player *player = g_Vars.currentplayer;
|
struct player *player = g_Vars.currentplayer;
|
||||||
s32 bottom = viGetViewTop() + viGetViewHeight() - 13;
|
s32 bottom = viGetViewTop() + viGetViewHeight() - 13;
|
||||||
s32 playercount = PLAYERCOUNT();
|
s32 playercount = LOCALPLAYERCOUNT();
|
||||||
s32 playernum = g_Vars.currentplayernum;
|
s32 playernum = g_Vars.currentplayernum;
|
||||||
struct gunctrl *ctrl;
|
struct gunctrl *ctrl;
|
||||||
s32 secs60;
|
s32 secs60;
|
||||||
|
|||||||
+213
-6
@@ -42,6 +42,10 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
|
#include "system.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "net/net.h"
|
||||||
|
#include "net/netmsg.h"
|
||||||
|
|
||||||
static void bgunProcessQuickDetonate(struct movedata *data, u32 c1buttons, u32 c1buttonsthisframe, u32 buttons1, u32 buttons2) {
|
static void bgunProcessQuickDetonate(struct movedata *data, u32 c1buttons, u32 c1buttonsthisframe, u32 buttons1, u32 buttons2) {
|
||||||
if ((((c1buttons & (buttons1)) && (c1buttonsthisframe & (buttons2)))
|
if ((((c1buttons & (buttons1)) && (c1buttonsthisframe & (buttons2)))
|
||||||
@@ -105,6 +109,159 @@ static void bgunProcessInputAltButton(struct movedata *data, s8 contpad, s32 i)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void bmoveProcessRemoteInput(const bool allowc1buttons)
|
||||||
|
{
|
||||||
|
struct player *pl = g_Vars.currentplayer;
|
||||||
|
if (!pl->client) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct netplayermove *inmove = &pl->client->inmove[0];
|
||||||
|
struct netplayermove *inmoveprev = &pl->client->inmove[1];
|
||||||
|
s32 moveticks = inmove->tick - inmoveprev->tick;
|
||||||
|
if (moveticks > g_NetInterpTicks) {
|
||||||
|
moveticks = g_NetInterpTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool handled = (pl->client->inmovetick >= inmove->tick);
|
||||||
|
|
||||||
|
if (!inmove->tick) {
|
||||||
|
// no input
|
||||||
|
inmove->pos = inmoveprev->pos = pl->prop->pos;
|
||||||
|
inmove->angles[0] = inmoveprev->angles[0] = pl->vv_theta;
|
||||||
|
inmove->angles[1] = inmoveprev->angles[1] = pl->vv_verta;
|
||||||
|
inmove->ucmd = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inmove->ucmd & UCMD_DUCK) {
|
||||||
|
pl->crouchpos = CROUCHPOS_DUCK;
|
||||||
|
} else if (inmove->ucmd & UCMD_SQUAT) {
|
||||||
|
pl->crouchpos = CROUCHPOS_SQUAT;
|
||||||
|
} else {
|
||||||
|
pl->crouchpos = CROUCHPOS_STAND;
|
||||||
|
}
|
||||||
|
|
||||||
|
pl->bondactivateorreload = 0;
|
||||||
|
|
||||||
|
pl->eyesshut = (inmove->ucmd & UCMD_EYESSHUT) != 0;
|
||||||
|
|
||||||
|
pl->speedtheta = 0.f; // TODO: figure out if anglespeed is even required
|
||||||
|
pl->speedverta = 0.f;
|
||||||
|
pl->crouchoffset = inmove->crouchofs;
|
||||||
|
|
||||||
|
pl->oldcrosspos[0] = pl->crosspos[0];
|
||||||
|
pl->oldcrosspos[1] = pl->crosspos[1];
|
||||||
|
pl->crosspos[0] = inmove->crosspos[0];
|
||||||
|
pl->crosspos[1] = inmove->crosspos[1];
|
||||||
|
|
||||||
|
// denormalize crosspos x
|
||||||
|
pl->crosspos[0] -= (f32)(SCREEN_WIDTH_LO / 2);
|
||||||
|
pl->crosspos[0] = (f32)(SCREEN_WIDTH_LO / 2) + pl->crosspos[0] / pl->aspect * SCREEN_ASPECT;
|
||||||
|
|
||||||
|
pl->crosspos2[0] = pl->crosspos[0];
|
||||||
|
pl->crosspos2[1] = pl->crosspos[1];
|
||||||
|
|
||||||
|
pl->insightaimmode = (inmove->ucmd & UCMD_AIMMODE) != 0;
|
||||||
|
if (pl->insightaimmode) {
|
||||||
|
pl->gunzoomfovs[0] = pl->gunzoomfovs[1] = pl->gunzoomfovs[2] = inmove->zoomfov;
|
||||||
|
}
|
||||||
|
|
||||||
|
f32 zoomfov = 0.f;
|
||||||
|
if (pl->insightaimmode) {
|
||||||
|
zoomfov = currentPlayerGetGunZoomFov();
|
||||||
|
}
|
||||||
|
if (bgunGetWeaponNum(HAND_RIGHT) == WEAPON_AR34 && pl->hands[HAND_RIGHT].gset.weaponfunc == FUNC_SECONDARY) {
|
||||||
|
zoomfov = currentPlayerGetGunZoomFov();
|
||||||
|
}
|
||||||
|
if (zoomfov <= 0.f) {
|
||||||
|
zoomfov = pl->client->settings.fovy;
|
||||||
|
}
|
||||||
|
playerTweenFovY(zoomfov);
|
||||||
|
playerUpdateZoom();
|
||||||
|
|
||||||
|
for (s32 h = 0; h < 2; ++h) {
|
||||||
|
pl->hands[h].crosspos[0] = pl->crosspos[0];
|
||||||
|
pl->hands[h].crosspos[1] = pl->crosspos[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inmove->ucmd & UCMD_SELECT) {
|
||||||
|
pl->gunctrl.dualwielding = (inmove->ucmd & UCMD_SELECT_DUAL) != 0;
|
||||||
|
if (inmove->weaponnum >= 0) {
|
||||||
|
bgunEquipWeapon(inmove->weaponnum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((inmove->ucmd & UCMD_SECONDARY) && !bgunIsUsingSecondaryFunction()) {
|
||||||
|
bgunConsiderToggleGunFunction(0, false, false, true);
|
||||||
|
} else if (!(inmove->ucmd & UCMD_SECONDARY) && bgunIsUsingSecondaryFunction()) {
|
||||||
|
// do not switch back to primary if in the process of throwing laptop
|
||||||
|
if (!(bgunGetWeaponNum(HAND_RIGHT) == WEAPON_LAPTOPGUN && pl->hands[HAND_RIGHT].state == HANDSTATE_ATTACK)) {
|
||||||
|
bgunConsiderToggleGunFunction(0, false, false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool fireguns = (inmove->ucmd & UCMD_FIRE) && !pl->waitforzrelease && allowc1buttons;
|
||||||
|
|
||||||
|
bgunTickGameplay(fireguns);
|
||||||
|
|
||||||
|
if (fireguns && g_NetMode == NETMODE_SERVER) {
|
||||||
|
netmsgSvcPlayerStatsWrite(&g_NetMsgRel, pl->client);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!handled && (inmove->ucmd & UCMD_RELOAD)) {
|
||||||
|
pl->bondactivateorreload |= JO_ACTION_RELOAD;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
if (!handled && (inmove->ucmd & UCMD_ACTIVATE)) {
|
||||||
|
pl->bondactivateorreload |= JO_ACTION_ACTIVATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_Vars.bondvisible && (bgunIsFiring(HAND_RIGHT) || bgunIsFiring(HAND_LEFT))) {
|
||||||
|
f32 noiseradius = 0.f;
|
||||||
|
if (bgunIsFiring(HAND_RIGHT) && bgunGetNoiseRadius(HAND_RIGHT) > noiseradius) {
|
||||||
|
noiseradius = bgunGetNoiseRadius(HAND_RIGHT);
|
||||||
|
}
|
||||||
|
if (bgunIsFiring(HAND_LEFT) && bgunGetNoiseRadius(HAND_LEFT) > noiseradius) {
|
||||||
|
noiseradius = bgunGetNoiseRadius(HAND_LEFT);
|
||||||
|
}
|
||||||
|
chrsCheckForNoise(noiseradius);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bgunSetSightVisible(GUNSIGHTREASON_NOTAIMING, pl->insightaimmode);
|
||||||
|
|
||||||
|
const bool forcepos = !inmoveprev->tick || !moveticks || (inmove->ucmd & UCMD_FL_FORCEANGLE);
|
||||||
|
|
||||||
|
// lerp towards the current speeds and angles
|
||||||
|
const f32 dt = (forcepos ? 1.f : (1.f / (f32)moveticks));
|
||||||
|
f32 t = (forcepos ? 1.f : ((f32)pl->client->lerpticks / (f32)moveticks));
|
||||||
|
if (t > 1.f) {
|
||||||
|
t = 1.f;
|
||||||
|
}
|
||||||
|
pl->speedgo = pl->speedforwards = lerpf(inmoveprev->movespeed[0], inmove->movespeed[0], t);
|
||||||
|
pl->speedstrafe = pl->speedsideways = lerpf(inmoveprev->movespeed[1], inmove->movespeed[1], t);
|
||||||
|
pl->vv_theta = lerpanglef(pl->vv_theta, inmove->angles[0], dt);
|
||||||
|
pl->vv_verta = lerpanglef(pl->vv_verta, inmove->angles[1], dt);
|
||||||
|
|
||||||
|
if (pl->bondmovemode == MOVEMODE_GRAB) {
|
||||||
|
bgrabUpdateSpeedTheta();
|
||||||
|
} else if (pl->bondmovemode == MOVEMODE_WALK) {
|
||||||
|
if (bmoveGetCrouchPos() != CROUCHPOS_STAND) {
|
||||||
|
pl->speedmaxtime60 = 0;
|
||||||
|
}
|
||||||
|
bwalkSetSwayTargetf(inmove->leanofs);
|
||||||
|
} else if (pl->bondmovemode == MOVEMODE_BIKE) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inmove->movespeed[0] > 0.95f) {
|
||||||
|
pl->speedmaxtime60 += g_Vars.lvupdate60;
|
||||||
|
} else {
|
||||||
|
pl->speedmaxtime60 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // PLATFORM_N64
|
#endif // PLATFORM_N64
|
||||||
|
|
||||||
void bmoveSetControlDef(u32 controldef)
|
void bmoveSetControlDef(u32 controldef)
|
||||||
@@ -313,6 +470,39 @@ void bmoveApplyMoveData(struct movedata *data)
|
|||||||
} else if (g_Vars.currentplayer->bondmovemode == MOVEMODE_WALK) {
|
} else if (g_Vars.currentplayer->bondmovemode == MOVEMODE_WALK) {
|
||||||
bwalkApplyMoveData(data);
|
bwalkApplyMoveData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
// record some inputs if this is a local player
|
||||||
|
if (g_NetMode && !g_Vars.currentplayer->isremote) {
|
||||||
|
g_Vars.currentplayer->ucmd = 0;
|
||||||
|
if (g_Vars.currentplayer->isdead) {
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
if (joyGetButtons(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000)) {
|
||||||
|
g_Vars.currentplayer->ucmd |= UCMD_RESPAWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (data->triggeron) {
|
||||||
|
g_Vars.currentplayer->ucmd |= UCMD_FIRE;
|
||||||
|
}
|
||||||
|
if (data->aiming) {
|
||||||
|
g_Vars.currentplayer->ucmd |= UCMD_AIMMODE;
|
||||||
|
}
|
||||||
|
if (g_Vars.currentplayer->bondactivateorreload & JO_ACTION_ACTIVATE) {
|
||||||
|
g_Vars.currentplayer->ucmd |= UCMD_ACTIVATE;
|
||||||
|
}
|
||||||
|
if (g_Vars.currentplayer->bondactivateorreload & JO_ACTION_RELOAD) {
|
||||||
|
g_Vars.currentplayer->ucmd |= UCMD_RELOAD;
|
||||||
|
}
|
||||||
|
if (data->eyesshut) {
|
||||||
|
g_Vars.currentplayer->ucmd |= UCMD_EYESSHUT;
|
||||||
|
}
|
||||||
|
if (data->weaponbackoffset || data->weaponforwardoffset) {
|
||||||
|
g_Vars.currentplayer->ucmd |= UCMD_SELECT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void bmoveUpdateSpeedTheta(void)
|
void bmoveUpdateSpeedTheta(void)
|
||||||
@@ -718,6 +908,14 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
controlmode = optionsGetControlMode(g_Vars.currentplayerstats->mpindex);
|
controlmode = optionsGetControlMode(g_Vars.currentplayerstats->mpindex);
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_Vars.currentplayer->isremote || controlmode == CONTROLMODE_NA) {
|
||||||
|
bmoveProcessRemoteInput(allowc1buttons);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
weaponnum = bgunGetWeaponNum(HAND_RIGHT);
|
weaponnum = bgunGetWeaponNum(HAND_RIGHT);
|
||||||
canmanualzoom = weaponHasAimFlag(weaponnum, INVAIMFLAG_MANUALZOOM);
|
canmanualzoom = weaponHasAimFlag(weaponnum, INVAIMFLAG_MANUALZOOM);
|
||||||
contpad1 = optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex);
|
contpad1 = optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex);
|
||||||
@@ -1025,7 +1223,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle B button activation
|
// Handle B button activation
|
||||||
if (allowc1buttons && controlmode != CONTROLMODE_PC) {
|
if (allowc1buttons && controlmode < CONTROLMODE_PC) {
|
||||||
for (i = 0; i < numsamples; i++) {
|
for (i = 0; i < numsamples; i++) {
|
||||||
if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & B_BUTTON)
|
if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & B_BUTTON)
|
||||||
|| joyGetButtonsOnSample(i, contpad2, c2allowedbuttons & B_BUTTON)) {
|
|| joyGetButtonsOnSample(i, contpad2, c2allowedbuttons & B_BUTTON)) {
|
||||||
@@ -1232,6 +1430,9 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
|||||||
aimoffhist[i] = !aimonhist[i];
|
aimoffhist[i] = !aimonhist[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
if (numsamples)
|
||||||
|
#endif
|
||||||
g_Vars.currentplayer->insightaimmode = aimonhist[numsamples - 1];
|
g_Vars.currentplayer->insightaimmode = aimonhist[numsamples - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1493,7 +1694,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
|||||||
for (i = 0; i < numsamples; i++) {
|
for (i = 0; i < numsamples; i++) {
|
||||||
if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & usemask)) {
|
if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & usemask)) {
|
||||||
if (g_Vars.currentplayer->usedowntime >= -1) {
|
if (g_Vars.currentplayer->usedowntime >= -1) {
|
||||||
if (controlmode != CONTROLMODE_PC) {
|
if (controlmode < CONTROLMODE_PC) {
|
||||||
if (joyGetButtonsPressedOnSample(i, contpad1, shootbuttons & c1allowedbuttons)
|
if (joyGetButtonsPressedOnSample(i, contpad1, shootbuttons & c1allowedbuttons)
|
||||||
&& g_Vars.currentplayer->usedowntime >= 0
|
&& g_Vars.currentplayer->usedowntime >= 0
|
||||||
&& bgunConsiderToggleGunFunction(g_Vars.currentplayer->usedowntime, true, false, 0) != USETIMER_CONTINUE) {
|
&& bgunConsiderToggleGunFunction(g_Vars.currentplayer->usedowntime, true, false, 0) != USETIMER_CONTINUE) {
|
||||||
@@ -1518,7 +1719,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((controlmode != CONTROLMODE_PC) && g_Vars.currentplayer->usedowntime >= -2) {
|
if ((controlmode < CONTROLMODE_PC) && g_Vars.currentplayer->usedowntime >= -2) {
|
||||||
bgunConsiderToggleGunFunction(g_Vars.currentplayer->usedowntime, false, false, 0);
|
bgunConsiderToggleGunFunction(g_Vars.currentplayer->usedowntime, false, false, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1664,7 +1865,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
|||||||
#ifdef PLATFORM_N64
|
#ifdef PLATFORM_N64
|
||||||
if (allowc1buttons) {
|
if (allowc1buttons) {
|
||||||
#else
|
#else
|
||||||
if (allowc1buttons && (controlmode != CONTROLMODE_PC || (PLAYER_EXTCFG().crouchmode & CROUCHMODE_ANALOG))) {
|
if (allowc1buttons && (controlmode < CONTROLMODE_PC || (PLAYER_EXTCFG().crouchmode & CROUCHMODE_ANALOG))) {
|
||||||
#endif
|
#endif
|
||||||
for (i = 0; i < numsamples; i++) {
|
for (i = 0; i < numsamples; i++) {
|
||||||
if (!canmanualzoom && aimonhist[i]) {
|
if (!canmanualzoom && aimonhist[i]) {
|
||||||
@@ -1748,7 +1949,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle mine detonation
|
// Handle mine detonation
|
||||||
if (controlmode != CONTROLMODE_PC) {
|
if (controlmode < CONTROLMODE_PC) {
|
||||||
if ((((c1buttons & invbuttons) && (c1buttonsthisframe & B_BUTTON))
|
if ((((c1buttons & invbuttons) && (c1buttonsthisframe & B_BUTTON))
|
||||||
|| ((c1buttons & B_BUTTON) && (c1buttonsthisframe & invbuttons)))
|
|| ((c1buttons & B_BUTTON) && (c1buttonsthisframe & invbuttons)))
|
||||||
&& weaponnum == WEAPON_REMOTEMINE) {
|
&& weaponnum == WEAPON_REMOTEMINE) {
|
||||||
@@ -1781,7 +1982,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
|||||||
movedata.triggeron = g_Vars.currentplayer->waitforzrelease == false
|
movedata.triggeron = g_Vars.currentplayer->waitforzrelease == false
|
||||||
&& (c1buttons & shootbuttons)
|
&& (c1buttons & shootbuttons)
|
||||||
&& g_Vars.currentplayer->pausemode == PAUSEMODE_UNPAUSED;
|
&& g_Vars.currentplayer->pausemode == PAUSEMODE_UNPAUSED;
|
||||||
if (controlmode != CONTROLMODE_PC) {
|
if (controlmode < CONTROLMODE_PC) {
|
||||||
movedata.triggeron = movedata.triggeron && ((c1buttons & invbuttons) == 0);
|
movedata.triggeron = movedata.triggeron && ((c1buttons & invbuttons) == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2494,7 +2695,13 @@ void bmoveUpdateHead(f32 arg0, f32 arg1, f32 arg2, Mtxf *arg3, f32 arg4)
|
|||||||
bheadUpdate(sp244, arg2);
|
bheadUpdate(sp244, arg2);
|
||||||
mtx4LoadXRotation(BADDEG2RAD(360 - g_Vars.currentplayer->vv_verta360), &sp180);
|
mtx4LoadXRotation(BADDEG2RAD(360 - g_Vars.currentplayer->vv_verta360), &sp180);
|
||||||
|
|
||||||
|
#ifdef PLATFORM_N64
|
||||||
if (optionsGetHeadRoll(g_Vars.currentplayerstats->mpindex)) {
|
if (optionsGetHeadRoll(g_Vars.currentplayerstats->mpindex)) {
|
||||||
|
#else
|
||||||
|
// in net games only allow headroll in the death animation
|
||||||
|
// TODO: figure out how to deal with headroll in other situations
|
||||||
|
if (optionsGetHeadRoll(g_Vars.currentplayerstats->mpindex) && (!g_NetMode || g_Vars.currentplayer->isdead)) {
|
||||||
|
#endif
|
||||||
mtx00016d58(&sp116,
|
mtx00016d58(&sp116,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
-g_Vars.currentplayer->headlook.x, -g_Vars.currentplayer->headlook.y, -g_Vars.currentplayer->headlook.z,
|
-g_Vars.currentplayer->headlook.x, -g_Vars.currentplayer->headlook.y, -g_Vars.currentplayer->headlook.z,
|
||||||
|
|||||||
+72
-3
@@ -27,7 +27,69 @@
|
|||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
extern f32 fabsf(f32);
|
#include "net/net.h"
|
||||||
|
#include "system.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
static inline void lerpcoord(struct coord *c, const struct coord *a, const struct coord *b, const f32 t) {
|
||||||
|
c->x = lerpf(a->x, b->x, t);
|
||||||
|
c->y = lerpf(a->y, b->y, t);
|
||||||
|
c->z = lerpf(a->z, b->z, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void bwalkUpdateRemote(void)
|
||||||
|
{
|
||||||
|
struct player *pl = g_Vars.currentplayer;
|
||||||
|
const struct netplayermove *inmove = &pl->client->inmove[0];
|
||||||
|
const struct netplayermove *inmoveprev = &pl->client->inmove[1];
|
||||||
|
struct coord delta;
|
||||||
|
u16 cdtype = CDTYPE_ALL;
|
||||||
|
s32 moveticks = inmove->tick - inmoveprev->tick;
|
||||||
|
if (moveticks > g_NetInterpTicks) {
|
||||||
|
moveticks = g_NetInterpTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
pl->client->inmovetick = inmove->tick;
|
||||||
|
|
||||||
|
pl->bondshotspeed.x = 0.f;
|
||||||
|
pl->bondshotspeed.y = 0.f;
|
||||||
|
pl->bondshotspeed.z = 0.f;
|
||||||
|
pl->bondbreathing = 0.f;
|
||||||
|
|
||||||
|
const bool forcepos = !inmoveprev->tick ||
|
||||||
|
(inmove->ucmd & UCMD_FL_FORCEPOS) ||
|
||||||
|
(fabsf(pl->prop->pos.x - inmove->pos.x) > 512.f) ||
|
||||||
|
(fabsf(pl->prop->pos.y - inmove->pos.y) > 512.f) ||
|
||||||
|
(fabsf(pl->prop->pos.z - inmove->pos.z) > 512.f);
|
||||||
|
|
||||||
|
delta.x = 0.f;
|
||||||
|
delta.y = 0.f;
|
||||||
|
delta.z = 0.f;
|
||||||
|
|
||||||
|
// extrapolate
|
||||||
|
bwalk0f0c69b8();
|
||||||
|
|
||||||
|
if (forcepos) {
|
||||||
|
// no interpolation, set position and lock the lad in place
|
||||||
|
pl->prop->pos = inmove->pos;
|
||||||
|
pl->client->lerpticks = g_NetInterpTicks + 1;
|
||||||
|
cdtype = CDTYPE_PLAYERS; // don't get stuck in the local client
|
||||||
|
} else if (!moveticks) {
|
||||||
|
// duplicate move, reposition to correct coords
|
||||||
|
delta.x = inmove->pos.x - pl->prop->pos.x;
|
||||||
|
delta.x = inmove->pos.y - pl->prop->pos.y;
|
||||||
|
delta.x = inmove->pos.z - pl->prop->pos.z;
|
||||||
|
bwalk0f0c63bc(&delta, pl->swaytarget == 0.0f, cdtype);
|
||||||
|
} else if (pl->client->lerpticks <= moveticks) {
|
||||||
|
// lerp towards the correct position
|
||||||
|
const f32 dt = (f32)1.f / (f32)moveticks;
|
||||||
|
delta.x = g_Vars.lvupdate60freal * (inmove->pos.x - pl->prop->pos.x) * dt;
|
||||||
|
delta.y = g_Vars.lvupdate60freal * (inmove->pos.y - pl->prop->pos.y) * dt;
|
||||||
|
delta.z = g_Vars.lvupdate60freal * (inmove->pos.z - pl->prop->pos.z) * dt;
|
||||||
|
bwalk0f0c63bc(&delta, pl->swaytarget == 0.0f, cdtype);
|
||||||
|
pl->client->lerpticks += g_Vars.lvupdate60;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void bwalkInit(void)
|
void bwalkInit(void)
|
||||||
@@ -413,7 +475,7 @@ bool bwalkCalculateNewPositionWithPush(struct coord *delta, f32 rotateamount, bo
|
|||||||
}
|
}
|
||||||
} else if (chr->chrflags & CHRCFLAG_PUSHABLE) {
|
} else if (chr->chrflags & CHRCFLAG_PUSHABLE) {
|
||||||
if (g_Vars.antiplayernum < 0
|
if (g_Vars.antiplayernum < 0
|
||||||
|| g_Vars.currentplayer != g_Vars.anti
|
|| PLAYER_IS_NOT_ANTI(g_Vars.currentplayer)
|
||||||
|| (chr->hidden & CHRHFLAG_ANTINONINTERACTABLE) == 0) {
|
|| (chr->hidden & CHRHFLAG_ANTINONINTERACTABLE) == 0) {
|
||||||
canpush = true;
|
canpush = true;
|
||||||
}
|
}
|
||||||
@@ -747,7 +809,7 @@ void bwalkUpdateVertical(void)
|
|||||||
// Maybe reset counter-op's radius - not sure why
|
// Maybe reset counter-op's radius - not sure why
|
||||||
// Maybe it gets set to 0 when they die?
|
// Maybe it gets set to 0 when they die?
|
||||||
if (g_Vars.antiplayernum >= 0
|
if (g_Vars.antiplayernum >= 0
|
||||||
&& g_Vars.currentplayer == g_Vars.anti
|
&& PLAYER_IS_ANTI(g_Vars.currentplayer)
|
||||||
&& g_Vars.currentplayer->bond2.radius != 30
|
&& g_Vars.currentplayer->bond2.radius != 30
|
||||||
&& cdTestVolume(&g_Vars.currentplayer->prop->pos, 30, g_Vars.currentplayer->prop->rooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y)) {
|
&& cdTestVolume(&g_Vars.currentplayer->prop->pos, 30, g_Vars.currentplayer->prop->rooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y)) {
|
||||||
g_Vars.currentplayer->prop->chr->radius = 30;
|
g_Vars.currentplayer->prop->chr->radius = 30;
|
||||||
@@ -1767,7 +1829,14 @@ void bwalkTick(void)
|
|||||||
bwalkUpdatePrevPos();
|
bwalkUpdatePrevPos();
|
||||||
bwalkUpdateTheta();
|
bwalkUpdateTheta();
|
||||||
bmoveUpdateVerta();
|
bmoveUpdateVerta();
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_Vars.currentplayer->isremote) {
|
||||||
|
bwalkUpdateRemote();
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
bwalk0f0c69b8();
|
bwalk0f0c69b8();
|
||||||
|
|
||||||
bwalkUpdateVertical();
|
bwalkUpdateVertical();
|
||||||
|
|
||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
|
|||||||
+10
-4
@@ -136,7 +136,7 @@ void challengeDetermineUnlockedFeatures(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now same as above, but per player
|
// Now same as above, but per player
|
||||||
for (j = 0; j < MAX_PLAYERS; j++) {
|
for (j = 0; j < MAX_LOCAL_PLAYERS; j++) {
|
||||||
numgifted = 0;
|
numgifted = 0;
|
||||||
|
|
||||||
for (challengeindex = 0; challengeindex < ARRAYCOUNT(g_MpChallenges); challengeindex++) {
|
for (challengeindex = 0; challengeindex < ARRAYCOUNT(g_MpChallenges); challengeindex++) {
|
||||||
@@ -197,7 +197,7 @@ void challengeDetermineUnlockedFeatures(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (challengeindex = 0; challengeindex < ARRAYCOUNT(g_MpChallenges); challengeindex++) {
|
for (challengeindex = 0; challengeindex < ARRAYCOUNT(g_MpChallenges); challengeindex++) {
|
||||||
for (prev = 0; prev < MAX_PLAYERS; prev++) {
|
for (prev = 0; prev < MAX_LOCAL_PLAYERS; prev++) {
|
||||||
if (challengeIsAvailableToPlayer(prev, challengeindex)) {
|
if (challengeIsAvailableToPlayer(prev, challengeindex)) {
|
||||||
for (i = 0; i < ARRAYCOUNT(g_MpChallenges[challengeindex].unlockfeatures); i++) {
|
for (i = 0; i < ARRAYCOUNT(g_MpChallenges[challengeindex].unlockfeatures); i++) {
|
||||||
if (g_MpChallenges[challengeindex].unlockfeatures[i] == j) {
|
if (g_MpChallenges[challengeindex].unlockfeatures[i] == j) {
|
||||||
@@ -249,7 +249,7 @@ void challengePerformSanityChecks(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Turn off all simulants and turn them on if enabled
|
// Turn off all simulants (and players 5-8 if supported) and turn them on if enabled
|
||||||
// for this number of players
|
// for this number of players
|
||||||
g_MpSetup.chrslots &= 0x000f;
|
g_MpSetup.chrslots &= 0x000f;
|
||||||
|
|
||||||
@@ -265,8 +265,14 @@ void challengePerformSanityChecks(void)
|
|||||||
g_Vars.mphilltime = 10;
|
g_Vars.mphilltime = 10;
|
||||||
}
|
}
|
||||||
} else if (!challengeIsFeatureUnlocked(MPFEATURE_8BOTS)) {
|
} else if (!challengeIsFeatureUnlocked(MPFEATURE_8BOTS)) {
|
||||||
// Limit to 4 players and 4 simulants
|
// Limit to 4 players and 4 simulants in local games
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
g_MpSetup.chrslots &= (g_NetMode ? 0x0fff : 0x0f0f);
|
||||||
|
#elif MAX_PLAYERS > 4
|
||||||
|
g_MpSetup.chrslots &= 0x0f0f;
|
||||||
|
#else
|
||||||
g_MpSetup.chrslots &= 0x00ff;
|
g_MpSetup.chrslots &= 0x00ff;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-1
@@ -49,6 +49,8 @@
|
|||||||
#include "types.h"
|
#include "types.h"
|
||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
|
#include "net/net.h"
|
||||||
|
#include "net/netmsg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void rng2SetSeed(u32 seed);
|
void rng2SetSeed(u32 seed);
|
||||||
@@ -4660,7 +4662,7 @@ void chrHit(struct shotdata *shotdata, struct hit *hit)
|
|||||||
hit->model, hit->hitthing.unk28 / 2, sp90);
|
hit->model, hit->hitthing.unk28 / 2, sp90);
|
||||||
|
|
||||||
if (g_Vars.antiplayernum >= 0
|
if (g_Vars.antiplayernum >= 0
|
||||||
&& g_Vars.currentplayer == g_Vars.anti
|
&& PLAYER_IS_ANTI(g_Vars.currentplayer)
|
||||||
&& (chr->hidden & CHRHFLAG_ANTINONINTERACTABLE)) {
|
&& (chr->hidden & CHRHFLAG_ANTINONINTERACTABLE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4691,9 +4693,17 @@ void chrHit(struct shotdata *shotdata, struct hit *hit)
|
|||||||
|| weapon->weaponnum == WEAPON_TIMEDMINE
|
|| weapon->weaponnum == WEAPON_TIMEDMINE
|
||||||
|| weapon->weaponnum == WEAPON_REMOTEMINE
|
|| weapon->weaponnum == WEAPON_REMOTEMINE
|
||||||
|| weapon->weaponnum == WEAPON_PROXIMITYMINE) {
|
|| weapon->weaponnum == WEAPON_PROXIMITYMINE) {
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
netmsgSvcChrDisarmWrite(&g_NetMsgRel, chr, g_Vars.currentplayer->prop, weapon->weaponnum, gsetGetDamage(&shotdata->gset), &sp98);
|
||||||
|
}
|
||||||
|
if (g_NetMode != NETMODE_CLIENT)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
objSetDropped(hit->prop, DROPTYPE_DEFAULT);
|
objSetDropped(hit->prop, DROPTYPE_DEFAULT);
|
||||||
chr->hidden |= CHRHFLAG_DROPPINGITEM;
|
chr->hidden |= CHRHFLAG_DROPPINGITEM;
|
||||||
objDamage(&weapon->base, gsetGetDamage(&shotdata->gset), &sp98, shotdata->gset.weaponnum, g_Vars.currentplayernum);
|
objDamage(&weapon->base, gsetGetDamage(&shotdata->gset), &sp98, shotdata->gset.weaponnum, g_Vars.currentplayernum);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+131
-6
@@ -56,6 +56,10 @@
|
|||||||
#include "lib/vi.h"
|
#include "lib/vi.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
#include "net/net.h"
|
||||||
|
#include "net/netmsg.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
s32 g_RecentQuipsPlayed[5];
|
s32 g_RecentQuipsPlayed[5];
|
||||||
u32 var8009cd84;
|
u32 var8009cd84;
|
||||||
@@ -4038,7 +4042,7 @@ void chrChoke(struct chrdata *chr, s32 choketype)
|
|||||||
if (soundnum >= 0) {
|
if (soundnum >= 0) {
|
||||||
if (chr->prop->type == PROPTYPE_PLAYER) {
|
if (chr->prop->type == PROPTYPE_PLAYER) {
|
||||||
if (g_Vars.players[playernum]->chokehandle == NULL) {
|
if (g_Vars.players[playernum]->chokehandle == NULL) {
|
||||||
sndStart(var80095200, soundnum, &g_Vars.players[playernum]->chokehandle, -1, -1, -1, -1, -1);
|
playerSndStart(var80095200, soundnum, &g_Vars.players[playernum]->chokehandle, playernum, -1, -1, -1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
psStopSound(chr->prop, PSTYPE_CHRTALK, 0);
|
psStopSound(chr->prop, PSTYPE_CHRTALK, 0);
|
||||||
@@ -4101,6 +4105,12 @@ bool func0f034080(struct chrdata *chr, struct modelnode *node, struct prop *prop
|
|||||||
*/
|
*/
|
||||||
void chrDamageByMisc(struct chrdata *chr, f32 damage, struct coord *vector, struct gset *gset, struct prop *prop)
|
void chrDamageByMisc(struct chrdata *chr, f32 damage, struct coord *vector, struct gset *gset, struct prop *prop)
|
||||||
{
|
{
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
// don't do anything if we're not the authority
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
chrDamage(chr, damage, vector, gset, prop, HITPART_GENERAL,
|
chrDamage(chr, damage, vector, gset, prop, HITPART_GENERAL,
|
||||||
false, // damageshield
|
false, // damageshield
|
||||||
NULL, // prop2
|
NULL, // prop2
|
||||||
@@ -4114,6 +4124,12 @@ void chrDamageByMisc(struct chrdata *chr, f32 damage, struct coord *vector, stru
|
|||||||
|
|
||||||
void chrDamageByLaser(struct chrdata *chr, f32 damage, struct coord *vector, struct gset *gset, struct prop *prop)
|
void chrDamageByLaser(struct chrdata *chr, f32 damage, struct coord *vector, struct gset *gset, struct prop *prop)
|
||||||
{
|
{
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
// don't do anything if we're not the authority
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
chrDamage(chr, damage, vector, gset, prop, HITPART_GENERAL,
|
chrDamage(chr, damage, vector, gset, prop, HITPART_GENERAL,
|
||||||
true, // damageshield
|
true, // damageshield
|
||||||
chr->prop, // prop2
|
chr->prop, // prop2
|
||||||
@@ -4127,6 +4143,12 @@ void chrDamageByLaser(struct chrdata *chr, f32 damage, struct coord *vector, str
|
|||||||
|
|
||||||
void func0f0341dc(struct chrdata *chr, f32 damage, struct coord *vector, struct gset *gset, struct prop *prop, s32 hitpart, struct prop *prop2, struct modelnode *node, struct model *model, s32 side, s16 *arg10)
|
void func0f0341dc(struct chrdata *chr, f32 damage, struct coord *vector, struct gset *gset, struct prop *prop, s32 hitpart, struct prop *prop2, struct modelnode *node, struct model *model, s32 side, s16 *arg10)
|
||||||
{
|
{
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
// don't do anything if we're not the authority
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
chrDamage(chr, damage, vector, gset, prop, hitpart,
|
chrDamage(chr, damage, vector, gset, prop, hitpart,
|
||||||
true, // damageshield
|
true, // damageshield
|
||||||
prop2, // prop2
|
prop2, // prop2
|
||||||
@@ -4148,6 +4170,13 @@ void func0f034248(struct chrdata *chr, f32 damage, struct coord *vector, struct
|
|||||||
s32 side = 0;
|
s32 side = 0;
|
||||||
s32 hitpart = HITPART_GENERAL;
|
s32 hitpart = HITPART_GENERAL;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
// don't do anything if we're not the authority
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (chrGetShield(chr) >= 0 && chr->model) {
|
if (chrGetShield(chr) >= 0 && chr->model) {
|
||||||
chrCalculateShieldHit(chr, &chr->prop->pos, vector, &node, &hitpart, &model, &side);
|
chrCalculateShieldHit(chr, &chr->prop->pos, vector, &node, &hitpart, &model, &side);
|
||||||
}
|
}
|
||||||
@@ -4172,6 +4201,13 @@ void chrDamageByImpact(struct chrdata *chr, f32 damage, struct coord *vector, st
|
|||||||
struct model *model = NULL;
|
struct model *model = NULL;
|
||||||
s32 side = 0;
|
s32 side = 0;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
// don't do anything if we're not the authority
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (chrGetShield(chr) >= 0 && chr->model) {
|
if (chrGetShield(chr) >= 0 && chr->model) {
|
||||||
chrCalculateShieldHit(chr, &chr->prop->pos, vector, &node, &hitpart, &model, &side);
|
chrCalculateShieldHit(chr, &chr->prop->pos, vector, &node, &hitpart, &model, &side);
|
||||||
}
|
}
|
||||||
@@ -4189,6 +4225,12 @@ void chrDamageByImpact(struct chrdata *chr, f32 damage, struct coord *vector, st
|
|||||||
|
|
||||||
void chrDamageByExplosion(struct chrdata *chr, f32 damage, struct coord *vector, struct prop *prop, struct coord *explosionpos)
|
void chrDamageByExplosion(struct chrdata *chr, f32 damage, struct coord *vector, struct prop *prop, struct coord *explosionpos)
|
||||||
{
|
{
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
// don't do anything if we're not the authority
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
chrDamage(chr, damage, vector, NULL, prop, HITPART_GENERAL,
|
chrDamage(chr, damage, vector, NULL, prop, HITPART_GENERAL,
|
||||||
true, // damageshield
|
true, // damageshield
|
||||||
chr->prop, // prop2
|
chr->prop, // prop2
|
||||||
@@ -4272,6 +4314,13 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse
|
|||||||
s32 aplayernum = -1;
|
s32 aplayernum = -1;
|
||||||
s32 choketype = CHOKETYPE_NONE;
|
s32 choketype = CHOKETYPE_NONE;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
netmsgSvcChrDamageWrite(&g_NetMsgRel, chr, damage, vector, gset, aprop, hitpart,
|
||||||
|
damageshield, prop2, side, arg11, explosion, explosionpos);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (hitpart == HITPART_HEAD) {
|
if (hitpart == HITPART_HEAD) {
|
||||||
choketype = CHOKETYPE_GURGLE;
|
choketype = CHOKETYPE_GURGLE;
|
||||||
}
|
}
|
||||||
@@ -4302,7 +4351,7 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse
|
|||||||
// Don't damage if attacker was anti and chr is non-interactable by anti
|
// Don't damage if attacker was anti and chr is non-interactable by anti
|
||||||
if (g_Vars.antiplayernum >= 0
|
if (g_Vars.antiplayernum >= 0
|
||||||
&& aprop
|
&& aprop
|
||||||
&& aprop == g_Vars.anti->prop
|
&& PROP_IS_FOR_ANTI_PLAYER(aprop)
|
||||||
&& (chr->hidden & CHRHFLAG_ANTINONINTERACTABLE)) {
|
&& (chr->hidden & CHRHFLAG_ANTINONINTERACTABLE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4453,7 +4502,9 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Anti shooting other enemies is lethal
|
// Anti shooting other enemies is lethal
|
||||||
if (aprop && aprop == g_Vars.anti->prop && vprop != g_Vars.bond->prop) {
|
if (aprop
|
||||||
|
&& PROP_IS_FOR_ANTI_PLAYER(aprop)
|
||||||
|
&& vprop != g_Vars.bond->prop) {
|
||||||
damage *= 100;
|
damage *= 100;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -4854,6 +4905,12 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER && g_Vars.currentplayer->client) {
|
||||||
|
netmsgSvcPlayerStatsWrite(&g_NetMsgRel, g_Vars.currentplayer->client);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
setCurrentPlayerNum(prevplayernum);
|
setCurrentPlayerNum(prevplayernum);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -8278,7 +8335,7 @@ void chrAlertOthersOfInjury(struct chrdata *chr, bool dying)
|
|||||||
s32 numinrange = 0;
|
s32 numinrange = 0;
|
||||||
s32 numchrs = chrsGetNumSlots();
|
s32 numchrs = chrsGetNumSlots();
|
||||||
|
|
||||||
if (g_Vars.antiplayernum >= 0 && chr->prop == g_Vars.anti->prop) {
|
if (g_Vars.antiplayernum >= 0 && PROP_IS_FOR_ANTI_PLAYER(chr->prop)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13513,7 +13570,7 @@ void chraTickBg(void)
|
|||||||
|
|
||||||
if (targetprop && (targetprop->type == PROPTYPE_CHR || targetprop->type == PROPTYPE_PLAYER)) {
|
if (targetprop && (targetprop->type == PROPTYPE_CHR || targetprop->type == PROPTYPE_PLAYER)) {
|
||||||
if ((targetprop->type == PROPTYPE_PLAYER
|
if ((targetprop->type == PROPTYPE_PLAYER
|
||||||
&& !(g_Vars.antiplayernum >= 0 && g_Vars.anti && g_Vars.anti->prop == targetprop)
|
&& !(g_Vars.antiplayernum >= 0 && g_Vars.anti && PROP_IS_FOR_ANTI_PLAYER(targetprop))
|
||||||
&& chrCompareTeams(chr, targetprop->chr, COMPARE_ENEMIES))
|
&& chrCompareTeams(chr, targetprop->chr, COMPARE_ENEMIES))
|
||||||
|| CHRRACE(targetprop->chr) == RACE_EYESPY) {
|
|| CHRRACE(targetprop->chr) == RACE_EYESPY) {
|
||||||
s32 time60;
|
s32 time60;
|
||||||
@@ -15299,6 +15356,68 @@ void func0f04b740(void)
|
|||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool chrSetPos(struct chrdata *chr, struct coord *pos, RoomNum *rooms, f32 theta, bool findground)
|
||||||
|
{
|
||||||
|
const f32 angle = BADDEG2RAD(360.f - theta);
|
||||||
|
|
||||||
|
if (findground) {
|
||||||
|
const u32 oldhidden = chr->hidden;
|
||||||
|
chr->hidden |= CHRHFLAG_WARPONSCREEN;
|
||||||
|
const bool ret = chrMoveToPos(chr, pos, rooms, angle, true);
|
||||||
|
if ((oldhidden & CHRHFLAG_WARPONSCREEN) == 0) {
|
||||||
|
chr->hidden &= ~CHRHFLAG_WARPONSCREEN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool newrooms = false;
|
||||||
|
for (s32 i = 0; i < ARRAYCOUNT(chr->prop->rooms) && rooms[i] >= 0; ++i) {
|
||||||
|
if (chr->prop->rooms[i] != rooms[i]) {
|
||||||
|
newrooms = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
propSetPerimEnabled(chr->prop, false);
|
||||||
|
|
||||||
|
chr->prop->pos = *pos;
|
||||||
|
|
||||||
|
const f32 ground = cdFindGroundInfoAtCyl(pos, chr->radius, rooms, &chr->floorcol,
|
||||||
|
&chr->floortype, NULL, &chr->floorroom, NULL, NULL);
|
||||||
|
|
||||||
|
chr->ground = ground;
|
||||||
|
chr->manground = ground;
|
||||||
|
chr->sumground = ground * (PAL ? 8.4175090789795f : 9.999998f);
|
||||||
|
|
||||||
|
if (newrooms) {
|
||||||
|
propDeregisterRooms(chr->prop);
|
||||||
|
roomsCopy(rooms, chr->prop->rooms);
|
||||||
|
chr0f0220ac(chr);
|
||||||
|
}
|
||||||
|
|
||||||
|
modelSetRootPosition(chr->model, pos);
|
||||||
|
|
||||||
|
const u16 nodetype = chr->model->definition->rootnode->type;
|
||||||
|
|
||||||
|
if ((nodetype & 0xff) == MODELNODETYPE_CHRINFO) {
|
||||||
|
union modelrwdata *rwdata = modelGetNodeRwData(chr->model, chr->model->definition->rootnode);
|
||||||
|
rwdata->chrinfo.ground = ground;
|
||||||
|
}
|
||||||
|
|
||||||
|
chrSetLookAngle(chr, angle);
|
||||||
|
|
||||||
|
if (chr->prop->type == PROPTYPE_PLAYER) {
|
||||||
|
struct player *player = g_Vars.players[playermgrGetPlayerNumByProp(chr->prop)];
|
||||||
|
player->vv_manground = ground;
|
||||||
|
player->vv_ground = ground;
|
||||||
|
player->vv_theta = theta;
|
||||||
|
player->unk1c64 = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
propSetPerimEnabled(chr->prop, true);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool chrMoveToPos(struct chrdata *chr, struct coord *pos, RoomNum *rooms, f32 angle, bool force)
|
bool chrMoveToPos(struct chrdata *chr, struct coord *pos, RoomNum *rooms, f32 angle, bool force)
|
||||||
{
|
{
|
||||||
struct coord pos2;
|
struct coord pos2;
|
||||||
@@ -15306,7 +15425,7 @@ bool chrMoveToPos(struct chrdata *chr, struct coord *pos, RoomNum *rooms, f32 an
|
|||||||
bool result = false;
|
bool result = false;
|
||||||
u32 nodetype;
|
u32 nodetype;
|
||||||
union modelrwdata *rwdata;
|
union modelrwdata *rwdata;
|
||||||
struct player *player;
|
struct player *player = NULL;
|
||||||
f32 ground;
|
f32 ground;
|
||||||
|
|
||||||
pos2.x = pos->x;
|
pos2.x = pos->x;
|
||||||
@@ -15356,6 +15475,12 @@ bool chrMoveToPos(struct chrdata *chr, struct coord *pos, RoomNum *rooms, f32 an
|
|||||||
player->unk1c64 = 1;
|
player->unk1c64 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER && player && player->isremote) {
|
||||||
|
player->ucmd |= UCMD_FL_FORCEPOS | UCMD_FL_FORCEANGLE | UCMD_FL_FORCEGROUND;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,10 @@
|
|||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
#include "game/mplayer/mplayer.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @cmd 0000
|
* @cmd 0000
|
||||||
*/
|
*/
|
||||||
@@ -6035,11 +6039,35 @@ bool aiSetChrPresetToChrNearPad(void)
|
|||||||
bool aiChrSetTeam(void)
|
bool aiChrSetTeam(void)
|
||||||
{
|
{
|
||||||
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
|
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
|
||||||
|
#ifdef PLATFORM_N64
|
||||||
struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]);
|
struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]);
|
||||||
|
|
||||||
if (chr) {
|
if (chr) {
|
||||||
chr->team = cmd[3];
|
chr->team = cmd[3];
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
u32 playernum;
|
||||||
|
if (cmd[2] == CHR_ANTI && g_Vars.antiplayernum >= 0) {
|
||||||
|
// There can be multiple counter-op players, so set this for all.
|
||||||
|
for (playernum = 0; playernum < PLAYERCOUNT(); playernum++) {
|
||||||
|
struct player *player = g_Vars.players[playernum];
|
||||||
|
|
||||||
|
if (player && PLAYER_IS_ANTI(player)) {
|
||||||
|
struct chrdata *chr = player->prop->chr;
|
||||||
|
|
||||||
|
if (chr) {
|
||||||
|
chr->team = cmd[3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]);
|
||||||
|
|
||||||
|
if (chr) {
|
||||||
|
chr->team = cmd[3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
g_Vars.aioffset += 4;
|
g_Vars.aioffset += 4;
|
||||||
|
|
||||||
|
|||||||
+57
-12
@@ -292,6 +292,27 @@ char *endscreenMenuTextAccuracy(struct menuitem *item)
|
|||||||
return g_StringPointer;
|
return g_StringPointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MAX_COOPCHRS > 2
|
||||||
|
static bool enscreenAnyAntiAborted(void) {
|
||||||
|
size_t num;
|
||||||
|
|
||||||
|
if (g_Vars.antiplayernum < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (num = 0; num < PLAYERCOUNT(); num++) {
|
||||||
|
if (PLAYERNUM_IS_ANTI(num) && g_Vars.players[num] && g_Vars.players[num]->aborted) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#define ANTI_ABORTED() (enscreenAnyAntiAborted())
|
||||||
|
#else
|
||||||
|
#define ANTI_ABORTED() (g_Vars.anti->aborted)
|
||||||
|
#endif
|
||||||
|
|
||||||
char *endscreenMenuTextMissionStatus(struct menuitem *item)
|
char *endscreenMenuTextMissionStatus(struct menuitem *item)
|
||||||
{
|
{
|
||||||
if (g_CheatsActiveBank0 || g_CheatsActiveBank1) {
|
if (g_CheatsActiveBank0 || g_CheatsActiveBank1) {
|
||||||
@@ -312,7 +333,7 @@ char *endscreenMenuTextMissionStatus(struct menuitem *item)
|
|||||||
return langGet(L_OPTIONS_295); // "Aborted"
|
return langGet(L_OPTIONS_295); // "Aborted"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_Vars.anti->aborted) {
|
if (ANTI_ABORTED()) {
|
||||||
return langGet(L_OPTIONS_295); // "Aborted"
|
return langGet(L_OPTIONS_295); // "Aborted"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,7 +341,7 @@ char *endscreenMenuTextMissionStatus(struct menuitem *item)
|
|||||||
return langGet(L_OPTIONS_293); // "Failed"
|
return langGet(L_OPTIONS_293); // "Failed"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (g_Vars.anti->aborted) {
|
if (ANTI_ABORTED()) {
|
||||||
return langGet(L_OPTIONS_295); // "Aborted"
|
return langGet(L_OPTIONS_295); // "Aborted"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1700,14 +1721,22 @@ void endscreenPushCoop(void)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// Failed or aborted
|
// Failed or aborted
|
||||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
|| LOCALPLAYERCOUNT() >= 3
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
menuPushRootDialog(&g_2PMissionEndscreenFailedVMenuDialog, MENUROOT_MPENDSCREEN);
|
menuPushRootDialog(&g_2PMissionEndscreenFailedVMenuDialog, MENUROOT_MPENDSCREEN);
|
||||||
} else {
|
} else {
|
||||||
menuPushRootDialog(&g_2PMissionEndscreenFailedHMenuDialog, MENUROOT_MPENDSCREEN);
|
menuPushRootDialog(&g_2PMissionEndscreenFailedHMenuDialog, MENUROOT_MPENDSCREEN);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Completed
|
// Completed
|
||||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
|| LOCALPLAYERCOUNT() >= 3
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
menuPushRootDialog(&g_2PMissionEndscreenCompletedVMenuDialog, MENUROOT_MPENDSCREEN);
|
menuPushRootDialog(&g_2PMissionEndscreenCompletedVMenuDialog, MENUROOT_MPENDSCREEN);
|
||||||
} else {
|
} else {
|
||||||
menuPushRootDialog(&g_2PMissionEndscreenCompletedHMenuDialog, MENUROOT_MPENDSCREEN);
|
menuPushRootDialog(&g_2PMissionEndscreenCompletedHMenuDialog, MENUROOT_MPENDSCREEN);
|
||||||
@@ -1787,20 +1816,28 @@ void endscreenPushAnti(void)
|
|||||||
|
|
||||||
if (g_Vars.currentplayer == g_Vars.bond) {
|
if (g_Vars.currentplayer == g_Vars.bond) {
|
||||||
#if VERSION >= VERSION_NTSC_1_0 && defined(DEBUG)
|
#if VERSION >= VERSION_NTSC_1_0 && defined(DEBUG)
|
||||||
if (!g_Vars.anti->aborted && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()) && !debugIsSetCompleteEnabled())
|
if (!ANTI_ABORTED() && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()) && !debugIsSetCompleteEnabled())
|
||||||
#else
|
#else
|
||||||
if (!g_Vars.anti->aborted && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()))
|
if (!ANTI_ABORTED() && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// Bond - failed or aborted
|
// Bond - failed or aborted
|
||||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
|| LOCALPLAYERCOUNT() >= 3
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
menuPushRootDialog(&g_2PMissionEndscreenFailedVMenuDialog, MENUROOT_MPENDSCREEN);
|
menuPushRootDialog(&g_2PMissionEndscreenFailedVMenuDialog, MENUROOT_MPENDSCREEN);
|
||||||
} else {
|
} else {
|
||||||
menuPushRootDialog(&g_2PMissionEndscreenFailedHMenuDialog, MENUROOT_MPENDSCREEN);
|
menuPushRootDialog(&g_2PMissionEndscreenFailedHMenuDialog, MENUROOT_MPENDSCREEN);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Bond - completed
|
// Bond - completed
|
||||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
|| LOCALPLAYERCOUNT() >= 3
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
menuPushRootDialog(&g_2PMissionEndscreenCompletedVMenuDialog, MENUROOT_MPENDSCREEN);
|
menuPushRootDialog(&g_2PMissionEndscreenCompletedVMenuDialog, MENUROOT_MPENDSCREEN);
|
||||||
} else {
|
} else {
|
||||||
menuPushRootDialog(&g_2PMissionEndscreenCompletedHMenuDialog, MENUROOT_MPENDSCREEN);
|
menuPushRootDialog(&g_2PMissionEndscreenCompletedHMenuDialog, MENUROOT_MPENDSCREEN);
|
||||||
@@ -1810,20 +1847,28 @@ void endscreenPushAnti(void)
|
|||||||
filemgrSaveOrLoad(&g_GameFileGuid, FILEOP_SAVE_GAME_000, 0);
|
filemgrSaveOrLoad(&g_GameFileGuid, FILEOP_SAVE_GAME_000, 0);
|
||||||
} else {
|
} else {
|
||||||
#if VERSION >= VERSION_NTSC_1_0 && defined(DEBUG)
|
#if VERSION >= VERSION_NTSC_1_0 && defined(DEBUG)
|
||||||
if (!g_Vars.anti->aborted && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()) && !debugIsSetCompleteEnabled())
|
if (!ANTI_ABORTED() && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()) && !debugIsSetCompleteEnabled())
|
||||||
#else
|
#else
|
||||||
if (!g_Vars.anti->aborted && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()))
|
if (!ANTI_ABORTED() && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// Anti - completed
|
// Anti - completed
|
||||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
|| LOCALPLAYERCOUNT() >= 3
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
menuPushRootDialog(&g_2PMissionEndscreenCompletedVMenuDialog, MENUROOT_MPENDSCREEN);
|
menuPushRootDialog(&g_2PMissionEndscreenCompletedVMenuDialog, MENUROOT_MPENDSCREEN);
|
||||||
} else {
|
} else {
|
||||||
menuPushRootDialog(&g_2PMissionEndscreenCompletedHMenuDialog, MENUROOT_MPENDSCREEN);
|
menuPushRootDialog(&g_2PMissionEndscreenCompletedHMenuDialog, MENUROOT_MPENDSCREEN);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Anti - failed or aborted
|
// Anti - failed or aborted
|
||||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
|| LOCALPLAYERCOUNT() >= 3
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
menuPushRootDialog(&g_2PMissionEndscreenFailedVMenuDialog, MENUROOT_MPENDSCREEN);
|
menuPushRootDialog(&g_2PMissionEndscreenFailedVMenuDialog, MENUROOT_MPENDSCREEN);
|
||||||
} else {
|
} else {
|
||||||
menuPushRootDialog(&g_2PMissionEndscreenFailedHMenuDialog, MENUROOT_MPENDSCREEN);
|
menuPushRootDialog(&g_2PMissionEndscreenFailedHMenuDialog, MENUROOT_MPENDSCREEN);
|
||||||
|
|||||||
+15
-3
@@ -847,7 +847,7 @@ void explosionInflictDamage(struct prop *expprop)
|
|||||||
minfrac = (minfrac * 0.7f + 0.3f) * type->damage;
|
minfrac = (minfrac * 0.7f + 0.3f) * type->damage;
|
||||||
|
|
||||||
if (g_Vars.antiplayernum >= 0
|
if (g_Vars.antiplayernum >= 0
|
||||||
&& g_Vars.antiplayernum == exp->owner
|
&& EXPLOSION_OWNER_IS_ANTI_PLAYER(exp->owner)
|
||||||
&& (obj->flags2 & OBJFLAG2_IMMUNETOANTI)) {
|
&& (obj->flags2 & OBJFLAG2_IMMUNETOANTI)) {
|
||||||
// anti cannot damage this obj
|
// anti cannot damage this obj
|
||||||
} else if (isfirstframe) {
|
} else if (isfirstframe) {
|
||||||
@@ -997,8 +997,16 @@ void explosionInflictDamage(struct prop *expprop)
|
|||||||
ownerprop = g_Vars.bond->prop;
|
ownerprop = g_Vars.bond->prop;
|
||||||
} else if (g_Vars.coopplayernum >= 0 && exp->owner == g_Vars.coopplayernum) {
|
} else if (g_Vars.coopplayernum >= 0 && exp->owner == g_Vars.coopplayernum) {
|
||||||
ownerprop = g_Vars.coop->prop;
|
ownerprop = g_Vars.coop->prop;
|
||||||
} else if (g_Vars.antiplayernum >= 0 && exp->owner == g_Vars.antiplayernum) {
|
} else if (g_Vars.antiplayernum >= 0 && EXPLOSION_OWNER_IS_ANTI_PLAYER(exp->owner)) {
|
||||||
|
#if PLATFORM_N64
|
||||||
ownerprop = g_Vars.anti->prop;
|
ownerprop = g_Vars.anti->prop;
|
||||||
|
#else
|
||||||
|
struct chrdata *ownerchr = mpGetChrFromPlayerIndex(exp->owner);
|
||||||
|
|
||||||
|
if (ownerchr) {
|
||||||
|
ownerprop = ownerchr->prop;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
chrDamageByExplosion(chr, minfrac, &spa0, ownerprop, &expprop->pos);
|
chrDamageByExplosion(chr, minfrac, &spa0, ownerprop, &expprop->pos);
|
||||||
@@ -1212,8 +1220,12 @@ u32 explosionTick(struct prop *prop)
|
|||||||
|
|
||||||
if (g_Vars.normmplayerisrunning) {
|
if (g_Vars.normmplayerisrunning) {
|
||||||
chr = mpGetChrFromPlayerIndex(exp->owner);
|
chr = mpGetChrFromPlayerIndex(exp->owner);
|
||||||
} else if (g_Vars.antiplayernum >= 0 && exp->owner == g_Vars.antiplayernum) {
|
} else if (g_Vars.antiplayernum >= 0 && EXPLOSION_OWNER_IS_ANTI_PLAYER(exp->owner)) {
|
||||||
|
#if PLATFORM_N64
|
||||||
chr = g_Vars.anti->prop->chr;
|
chr = g_Vars.anti->prop->chr;
|
||||||
|
#else
|
||||||
|
chr = mpGetChrFromPlayerIndex(exp->owner);
|
||||||
|
#endif
|
||||||
} else if (g_Vars.coopplayernum >= 0 && exp->owner == g_Vars.coopplayernum) {
|
} else if (g_Vars.coopplayernum >= 0 && exp->owner == g_Vars.coopplayernum) {
|
||||||
chr = g_Vars.coop->prop->chr;
|
chr = g_Vars.coop->prop->chr;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
s32 g_FilelistKnownPlugCounts[5];
|
s32 g_FilelistKnownPlugCounts[5];
|
||||||
|
|
||||||
struct filelist *g_FileLists[MAX_PLAYERS] = { NULL };
|
struct filelist *g_FileLists[MAX_LOCAL_PLAYERS] = { NULL };
|
||||||
bool var80075bd0[] = { true, true, true, true };
|
bool var80075bd0[] = { true, true, true, true };
|
||||||
bool var80075be0[] = { false, false, false, false };
|
bool var80075be0[] = { false, false, false, false };
|
||||||
u32 var80075bf0 = false;
|
u32 var80075bf0 = false;
|
||||||
|
|||||||
+8
-8
@@ -25,7 +25,7 @@ struct fileguid g_FilemgrFileToCopy;
|
|||||||
struct fileguid var800a21e8;
|
struct fileguid var800a21e8;
|
||||||
|
|
||||||
#if VERSION >= VERSION_JPN_FINAL
|
#if VERSION >= VERSION_JPN_FINAL
|
||||||
struct fileguid g_FilemgrFileToDelete[MAX_PLAYERS];
|
struct fileguid g_FilemgrFileToDelete[MAX_LOCAL_PLAYERS];
|
||||||
#else
|
#else
|
||||||
struct fileguid g_FilemgrFileToDelete;
|
struct fileguid g_FilemgrFileToDelete;
|
||||||
#endif
|
#endif
|
||||||
@@ -986,7 +986,7 @@ void filemgrDeleteCurrentFile(void)
|
|||||||
filemgrPushErrorDialog(FILEERROR_DELETEFAILED);
|
filemgrPushErrorDialog(FILEERROR_DELETEFAILED);
|
||||||
} else {
|
} else {
|
||||||
// If deleting a loaded MP player, reset them to default
|
// If deleting a loaded MP player, reset them to default
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
if (g_FilemgrFileToDelete[g_MpPlayerNum].fileid == g_PlayerConfigsArray[i].fileguid.fileid
|
if (g_FilemgrFileToDelete[g_MpPlayerNum].fileid == g_PlayerConfigsArray[i].fileguid.fileid
|
||||||
&& g_FilemgrFileToDelete[g_MpPlayerNum].deviceserial == g_PlayerConfigsArray[i].fileguid.deviceserial) {
|
&& g_FilemgrFileToDelete[g_MpPlayerNum].deviceserial == g_PlayerConfigsArray[i].fileguid.deviceserial) {
|
||||||
mpPlayerSetDefaults(i, true);
|
mpPlayerSetDefaults(i, true);
|
||||||
@@ -1013,7 +1013,7 @@ void filemgrDeleteCurrentFile(void)
|
|||||||
filemgrPushErrorDialog(FILEERROR_DELETEFAILED);
|
filemgrPushErrorDialog(FILEERROR_DELETEFAILED);
|
||||||
} else {
|
} else {
|
||||||
// If deleting a loaded MP player, reset them to default
|
// If deleting a loaded MP player, reset them to default
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
if (g_FilemgrFileToDelete.fileid == g_PlayerConfigsArray[i].fileguid.fileid
|
if (g_FilemgrFileToDelete.fileid == g_PlayerConfigsArray[i].fileguid.fileid
|
||||||
&& g_FilemgrFileToDelete.deviceserial == g_PlayerConfigsArray[i].fileguid.deviceserial) {
|
&& g_FilemgrFileToDelete.deviceserial == g_PlayerConfigsArray[i].fileguid.deviceserial) {
|
||||||
mpPlayerSetDefaults(i, true);
|
mpPlayerSetDefaults(i, true);
|
||||||
@@ -1860,7 +1860,7 @@ bool filemgrIsFileInUse(struct filelistfile *file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
if ((g_MpSetup.chrslots & (1 << i))
|
if ((g_MpSetup.chrslots & (1 << i))
|
||||||
&& g_PlayerConfigsArray[i].fileguid.fileid == file->fileid
|
&& g_PlayerConfigsArray[i].fileguid.fileid == file->fileid
|
||||||
&& g_PlayerConfigsArray[i].fileguid.deviceserial == file->deviceserial) {
|
&& g_PlayerConfigsArray[i].fileguid.deviceserial == file->deviceserial) {
|
||||||
@@ -1998,7 +1998,7 @@ bool filemgrIsFileInUse(struct filelistfile *file)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
if ((g_MpSetup.chrslots & (1 << i))
|
if ((g_MpSetup.chrslots & (1 << i))
|
||||||
&& g_PlayerConfigsArray[i].fileguid.fileid == file->fileid
|
&& g_PlayerConfigsArray[i].fileguid.fileid == file->fileid
|
||||||
&& g_PlayerConfigsArray[i].fileguid.deviceserial == file->deviceserial) {
|
&& g_PlayerConfigsArray[i].fileguid.deviceserial == file->deviceserial) {
|
||||||
@@ -2436,7 +2436,7 @@ MenuDialogHandlerResult pakChoosePakMenuDialog(s32 operation, struct menudialogd
|
|||||||
if (g_Vars.stagenum != STAGE_BOOTPAKMENU) {
|
if (g_Vars.stagenum != STAGE_BOOTPAKMENU) {
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
if (g_Menus[g_MpPlayerNum].fm.unke24 & (1 << i)) {
|
if (g_Menus[g_MpPlayerNum].fm.unke24 & (1 << i)) {
|
||||||
g_Vars.pakstocheck &= 0xfff0;
|
g_Vars.pakstocheck &= 0xfff0;
|
||||||
g_Vars.pakstocheck |= 0x0008;
|
g_Vars.pakstocheck |= 0x0008;
|
||||||
@@ -2461,7 +2461,7 @@ MenuDialogHandlerResult pakChoosePakMenuDialog(s32 operation, struct menudialogd
|
|||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
if (g_Menus[g_MpPlayerNum].fm.unke24 & (1 << i)) {
|
if (g_Menus[g_MpPlayerNum].fm.unke24 & (1 << i)) {
|
||||||
pak0f1169c8(i, STAGE_BOOTPAKMENU == g_Vars.stagenum);
|
pak0f1169c8(i, STAGE_BOOTPAKMENU == g_Vars.stagenum);
|
||||||
}
|
}
|
||||||
@@ -2783,7 +2783,7 @@ MenuDialogHandlerResult filemgrMainMenuDialog(s32 operation, struct menudialogde
|
|||||||
mpInit();
|
mpInit();
|
||||||
|
|
||||||
// Set MP player names to "Player 1" through 4 if blank
|
// Set MP player names to "Player 1" through 4 if blank
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
if (g_PlayerConfigsArray[i].base.name[0] == '\0') {
|
if (g_PlayerConfigsArray[i].base.name[0] == '\0') {
|
||||||
sprintf(g_PlayerConfigsArray[i].base.name, "%s %d\n", langGet(L_MISC_437), i + 1);
|
sprintf(g_PlayerConfigsArray[i].base.name, "%s %d\n", langGet(L_MISC_437), i + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ f32 func0f0b131c(s32 hand)
|
|||||||
weapon = weaponFindById(bgunGetWeaponNum2(0));
|
weapon = weaponFindById(bgunGetWeaponNum2(0));
|
||||||
x = weapon->posx;
|
x = weapon->posx;
|
||||||
|
|
||||||
if (PLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
if (LOCALPLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||||
x -= 3.5f;
|
x -= 3.5f;
|
||||||
|
|
||||||
if (g_Vars.currentplayernum == 0) {
|
if (g_Vars.currentplayernum == 0) {
|
||||||
@@ -178,7 +178,7 @@ f32 func0f0b131c(s32 hand)
|
|||||||
weapon = weaponFindById(bgunGetWeaponNum2(1));
|
weapon = weaponFindById(bgunGetWeaponNum2(1));
|
||||||
x = -weapon->posx;
|
x = -weapon->posx;
|
||||||
|
|
||||||
if (PLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
if (LOCALPLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||||
x += 3.5f;
|
x += 3.5f;
|
||||||
|
|
||||||
if (g_Vars.currentplayernum == 0) {
|
if (g_Vars.currentplayernum == 0) {
|
||||||
|
|||||||
@@ -2183,7 +2183,7 @@ Gfx *text0f156a24(Gfx *gdl, s32 x, s32 y, struct fontchar *char1, s32 arg4, s32
|
|||||||
if (y + char1->baseline >= arg5) {
|
if (y + char1->baseline >= arg5) {
|
||||||
if (arg5 + arg7 >= y + char1->baseline + char1->height + 2) {
|
if (arg5 + arg7 >= y + char1->baseline + char1->height + 2) {
|
||||||
if (g_TextRotated90) {
|
if (g_TextRotated90) {
|
||||||
gSPTextureRectangleFlip(gdl++,
|
gSPTextureRectangleFlipEXT(gdl++,
|
||||||
((y - char1->baseline) - ((char1->height + 2) * var8007fad0)) * 4,
|
((y - char1->baseline) - ((char1->height + 2) * var8007fad0)) * 4,
|
||||||
x * 4,
|
x * 4,
|
||||||
(y - char1->baseline) * 4,
|
(y - char1->baseline) * 4,
|
||||||
@@ -2194,7 +2194,7 @@ Gfx *text0f156a24(Gfx *gdl, s32 x, s32 y, struct fontchar *char1, s32 arg4, s32
|
|||||||
1024 / var8007fad0,
|
1024 / var8007fad0,
|
||||||
-1024);
|
-1024);
|
||||||
} else {
|
} else {
|
||||||
gSPTextureRectangle(gdl++,
|
gSPTextureRectangleEXT(gdl++,
|
||||||
x * 4,
|
x * 4,
|
||||||
(y + char1->baseline) * 4,
|
(y + char1->baseline) * 4,
|
||||||
(x + char1->width * var8007fad0 + 2) * 4,
|
(x + char1->width * var8007fad0 + 2) * 4,
|
||||||
@@ -2207,7 +2207,7 @@ Gfx *text0f156a24(Gfx *gdl, s32 x, s32 y, struct fontchar *char1, s32 arg4, s32
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (arg5 + arg7 >= y + char1->baseline) {
|
if (arg5 + arg7 >= y + char1->baseline) {
|
||||||
gSPTextureRectangle(gdl++,
|
gSPTextureRectangleEXT(gdl++,
|
||||||
x * 4,
|
x * 4,
|
||||||
(y + char1->baseline) * 4,
|
(y + char1->baseline) * 4,
|
||||||
(x + char1->width * var8007fad0 + 2) * 4,
|
(x + char1->width * var8007fad0 + 2) * 4,
|
||||||
@@ -2221,7 +2221,7 @@ Gfx *text0f156a24(Gfx *gdl, s32 x, s32 y, struct fontchar *char1, s32 arg4, s32
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (y + char1->baseline + char1->height + 2 >= arg5) {
|
if (y + char1->baseline + char1->height + 2 >= arg5) {
|
||||||
gSPTextureRectangle(gdl++,
|
gSPTextureRectangleEXT(gdl++,
|
||||||
x * 4,
|
x * 4,
|
||||||
arg5 * 4,
|
arg5 * 4,
|
||||||
(x + char1->width * var8007fad0 + 2) * 4,
|
(x + char1->width * var8007fad0 + 2) * 4,
|
||||||
|
|||||||
+4
-4
@@ -258,7 +258,7 @@ void gamefileLoadDefaults(struct gamefile *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
||||||
for (j = 1; j < MAX_PLAYERS + 1; j++) {
|
for (j = 1; j < MAX_LOCAL_PLAYERS + 1; j++) {
|
||||||
challengeSetCompletedByAnyPlayerWithNumPlayers(i, j, false);
|
challengeSetCompletedByAnyPlayerWithNumPlayers(i, j, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -362,7 +362,7 @@ s32 gamefileLoad(s32 device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
||||||
for (j = 1; j < MAX_PLAYERS + 1; j++) {
|
for (j = 1; j < MAX_LOCAL_PLAYERS + 1; j++) {
|
||||||
challengeSetCompletedByAnyPlayerWithNumPlayers(i, j, savebufferReadBits(&buffer, 1));
|
challengeSetCompletedByAnyPlayerWithNumPlayers(i, j, savebufferReadBits(&buffer, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -539,7 +539,7 @@ s32 gamefileSave(s32 device, s32 fileid, u16 deviceserial)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
||||||
for (j = 1; j < MAX_PLAYERS + 1; j++) {
|
for (j = 1; j < MAX_LOCAL_PLAYERS + 1; j++) {
|
||||||
savebufferOr(&buffer, challengeIsCompletedByAnyPlayerWithNumPlayers(i, j), 1);
|
savebufferOr(&buffer, challengeIsCompletedByAnyPlayerWithNumPlayers(i, j), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -602,7 +602,7 @@ void gamefileUnlockEverything(void)
|
|||||||
|
|
||||||
// unlock all challenges
|
// unlock all challenges
|
||||||
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); ++i) {
|
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); ++i) {
|
||||||
for (j = 0; j < MAX_PLAYERS; ++j) {
|
for (j = 0; j < MAX_LOCAL_PLAYERS; ++j) {
|
||||||
g_MpChallenges[i].completions[j] = 0xff;
|
g_MpChallenges[i].completions[j] = 0xff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ u32 g_GfxSizesByPlayerCount[] = {
|
|||||||
0x00018000,
|
0x00018000,
|
||||||
0x00020000,
|
0x00020000,
|
||||||
0x00028000,
|
0x00028000,
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
0x00030000,
|
||||||
|
0x00038000,
|
||||||
|
0x00040000,
|
||||||
|
0x00048000,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
u32 g_VtxSizesByPlayerCount[] = {
|
u32 g_VtxSizesByPlayerCount[] = {
|
||||||
@@ -54,6 +60,12 @@ u32 g_VtxSizesByPlayerCount[] = {
|
|||||||
0x00018000,
|
0x00018000,
|
||||||
0x00020000,
|
0x00020000,
|
||||||
0x00028000,
|
0x00028000,
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
0x00030000,
|
||||||
|
0x00038000,
|
||||||
|
0x00040000,
|
||||||
|
0x00048000,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
s32 g_GfxNumSwapsPerBuffer[NUM_GFXTASKS] = {0, 1};
|
s32 g_GfxNumSwapsPerBuffer[NUM_GFXTASKS] = {0, 1};
|
||||||
@@ -94,11 +106,21 @@ void gfxReset(void)
|
|||||||
// ******** Extra Amount required = %dK ber buffer\n
|
// ******** Extra Amount required = %dK ber buffer\n
|
||||||
// ******** Total of %dK (Double Buffered)\n
|
// ******** Total of %dK (Double Buffered)\n
|
||||||
g_GfxSizesByPlayerCount[PLAYERCOUNT() - 1] = gfx + gfxtra;
|
g_GfxSizesByPlayerCount[PLAYERCOUNT() - 1] = gfx + gfxtra;
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (PLAYERCOUNT() > MAX_LOCAL_PLAYERS) {
|
||||||
|
g_GfxSizesByPlayerCount[PLAYERCOUNT() - 1] *= MAX_PLAYERS / MAX_LOCAL_PLAYERS;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argFindByPrefix(1, "-mvtx")) {
|
if (argFindByPrefix(1, "-mvtx")) {
|
||||||
// Argument specified mtxvtx_size\n
|
// Argument specified mtxvtx_size\n
|
||||||
g_VtxSizesByPlayerCount[PLAYERCOUNT() - 1] = strtol(argFindByPrefix(1, "-mvtx"), NULL, 0) * 1024;
|
g_VtxSizesByPlayerCount[PLAYERCOUNT() - 1] = strtol(argFindByPrefix(1, "-mvtx"), NULL, 0) * 1024;
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (PLAYERCOUNT() > MAX_LOCAL_PLAYERS) {
|
||||||
|
g_VtxSizesByPlayerCount[PLAYERCOUNT() - 1] *= MAX_PLAYERS / MAX_LOCAL_PLAYERS;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// %d Players : Allocating %d bytes for master dl's\n
|
// %d Players : Allocating %d bytes for master dl's\n
|
||||||
|
|||||||
+22
-15
@@ -86,7 +86,7 @@ u8 hudmsgsAreActive(void)
|
|||||||
s32 hudmsgIsZoomRangeVisible(void)
|
s32 hudmsgIsZoomRangeVisible(void)
|
||||||
{
|
{
|
||||||
return optionsGetShowZoomRange(g_Vars.currentplayerstats->mpindex)
|
return optionsGetShowZoomRange(g_Vars.currentplayerstats->mpindex)
|
||||||
&& (PLAYERCOUNT() == 1
|
&& (LOCALPLAYERCOUNT() == 1
|
||||||
|| !g_Vars.mplayerisrunning
|
|| !g_Vars.mplayerisrunning
|
||||||
|| g_Vars.coopplayernum >= 0
|
|| g_Vars.coopplayernum >= 0
|
||||||
|| g_Vars.antiplayernum >= 0)
|
|| g_Vars.antiplayernum >= 0)
|
||||||
@@ -131,7 +131,7 @@ Gfx *hudmsgRenderMissionTimer(Gfx *gdl, u32 alpha)
|
|||||||
viewleft = viGetViewLeft() / g_ScaleX;
|
viewleft = viGetViewLeft() / g_ScaleX;
|
||||||
viewtop = viGetViewTop();
|
viewtop = viGetViewTop();
|
||||||
viewheight = viGetViewHeight();
|
viewheight = viGetViewHeight();
|
||||||
playercount = PLAYERCOUNT();
|
playercount = LOCALPLAYERCOUNT();
|
||||||
playernum = g_Vars.currentplayernum;
|
playernum = g_Vars.currentplayernum;
|
||||||
|
|
||||||
timery = viewheight;
|
timery = viewheight;
|
||||||
@@ -234,7 +234,7 @@ Gfx *hudmsgRenderZoomRange(Gfx *gdl, u32 alpha)
|
|||||||
texty = viewheight + viewtop - 1;
|
texty = viewheight + viewtop - 1;
|
||||||
maxzoom = 1.0f;
|
maxzoom = 1.0f;
|
||||||
weaponnum = g_Vars.currentplayer->hands[0].gset.weaponnum;
|
weaponnum = g_Vars.currentplayer->hands[0].gset.weaponnum;
|
||||||
playercount = PLAYERCOUNT();
|
playercount = LOCALPLAYERCOUNT();
|
||||||
|
|
||||||
texty -= 17;
|
texty -= 17;
|
||||||
|
|
||||||
@@ -374,7 +374,7 @@ s32 hudmsg0f0ddb1c(s32 *arg0, s32 arg1)
|
|||||||
|
|
||||||
*arg0 = 24;
|
*arg0 = 24;
|
||||||
|
|
||||||
if (PLAYERCOUNT() == 2
|
if (LOCALPLAYERCOUNT() == 2
|
||||||
&& optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
&& optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||||
&& (!g_InCutscene || g_MainIsEndscreen)) {
|
&& (!g_InCutscene || g_MainIsEndscreen)) {
|
||||||
result -= *arg0 * 2 / 3;
|
result -= *arg0 * 2 / 3;
|
||||||
@@ -388,7 +388,7 @@ s32 hudmsg0f0ddb1c(s32 *arg0, s32 arg1)
|
|||||||
|
|
||||||
result = result + viewwidth - *arg0 - arg1 - 11;
|
result = result + viewwidth - *arg0 - arg1 - 11;
|
||||||
|
|
||||||
if (PLAYERCOUNT() == 1 || (PLAYERCOUNT() == 2 && g_InCutscene && !g_MainIsEndscreen)) {
|
if (LOCALPLAYERCOUNT() == 1 || (LOCALPLAYERCOUNT() == 2 && g_InCutscene && !g_MainIsEndscreen)) {
|
||||||
result -= 16;
|
result -= 16;
|
||||||
|
|
||||||
#if VERSION < VERSION_JPN_FINAL
|
#if VERSION < VERSION_JPN_FINAL
|
||||||
@@ -403,7 +403,7 @@ s32 hudmsg0f0ddb1c(s32 *arg0, s32 arg1)
|
|||||||
|
|
||||||
*arg0 = 24;
|
*arg0 = 24;
|
||||||
|
|
||||||
if (PLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
if (LOCALPLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||||
result -= *arg0 * 2 / 3;
|
result -= *arg0 * 2 / 3;
|
||||||
|
|
||||||
if (g_Vars.currentplayernum == 0) {
|
if (g_Vars.currentplayernum == 0) {
|
||||||
@@ -415,7 +415,7 @@ s32 hudmsg0f0ddb1c(s32 *arg0, s32 arg1)
|
|||||||
|
|
||||||
result = result + viewwidth - *arg0 - arg1 - 11;
|
result = result + viewwidth - *arg0 - arg1 - 11;
|
||||||
|
|
||||||
if (PLAYERCOUNT() == 1) {
|
if (LOCALPLAYERCOUNT() == 1) {
|
||||||
result -= 16;
|
result -= 16;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -857,7 +857,7 @@ void hudmsgCalculatePosition(struct hudmessage *msg)
|
|||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
s32 offset = (msg->alignh == HUDMSGALIGN_XMIDDLE) ? 10 : 0;
|
s32 offset = (msg->alignh == HUDMSGALIGN_XMIDDLE) ? 10 : 0;
|
||||||
|
|
||||||
if (PLAYERCOUNT() >= 3) {
|
if (LOCALPLAYERCOUNT() >= 3) {
|
||||||
viewwidth -= offset;
|
viewwidth -= offset;
|
||||||
|
|
||||||
if (g_Vars.currentplayernum == 0 || g_Vars.currentplayernum == 2) {
|
if (g_Vars.currentplayernum == 0 || g_Vars.currentplayernum == 2) {
|
||||||
@@ -865,7 +865,7 @@ void hudmsgCalculatePosition(struct hudmessage *msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PLAYERCOUNT() == 2 && (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || IS4MB())) {
|
if (LOCALPLAYERCOUNT() == 2 && (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || IS4MB())) {
|
||||||
#if VERSION >= VERSION_PAL_FINAL
|
#if VERSION >= VERSION_PAL_FINAL
|
||||||
if (!g_InCutscene || g_MainIsEndscreen)
|
if (!g_InCutscene || g_MainIsEndscreen)
|
||||||
#endif
|
#endif
|
||||||
@@ -888,7 +888,7 @@ void hudmsgCalculatePosition(struct hudmessage *msg)
|
|||||||
|
|
||||||
x = viewleft + v0 + msg->xmargin + 3;
|
x = viewleft + v0 + msg->xmargin + 3;
|
||||||
|
|
||||||
if (PLAYERCOUNT() == 2
|
if (LOCALPLAYERCOUNT() == 2
|
||||||
&& (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || IS4MB())
|
&& (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || IS4MB())
|
||||||
&& (!g_InCutscene || g_MainIsEndscreen)) {
|
&& (!g_InCutscene || g_MainIsEndscreen)) {
|
||||||
if (IS4MB()) {
|
if (IS4MB()) {
|
||||||
@@ -904,7 +904,7 @@ void hudmsgCalculatePosition(struct hudmessage *msg)
|
|||||||
x += 4;
|
x += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (PLAYERCOUNT() >= 3) {
|
} else if (LOCALPLAYERCOUNT() >= 3) {
|
||||||
if ((msg->playernum % 2) == 0) {
|
if ((msg->playernum % 2) == 0) {
|
||||||
x--;
|
x--;
|
||||||
} else {
|
} else {
|
||||||
@@ -933,13 +933,13 @@ void hudmsgCalculatePosition(struct hudmessage *msg)
|
|||||||
case HUDMSGALIGN_BOTTOM:
|
case HUDMSGALIGN_BOTTOM:
|
||||||
y = viewtop + viewheight - msg->height - msg->ymargin - 14;
|
y = viewtop + viewheight - msg->height - msg->ymargin - 14;
|
||||||
|
|
||||||
if (PLAYERCOUNT() == 2 && (g_InCutscene == 0 || g_MainIsEndscreen)) {
|
if (LOCALPLAYERCOUNT() == 2 && (g_InCutscene == 0 || g_MainIsEndscreen)) {
|
||||||
if (IS4MB() || (optionsGetScreenSplit() != SCREENSPLIT_VERTICAL && msg->playernum == 0)) {
|
if (IS4MB() || (optionsGetScreenSplit() != SCREENSPLIT_VERTICAL && msg->playernum == 0)) {
|
||||||
y += 8;
|
y += 8;
|
||||||
} else {
|
} else {
|
||||||
y += 3;
|
y += 3;
|
||||||
}
|
}
|
||||||
} else if (PLAYERCOUNT() >= 3) {
|
} else if (LOCALPLAYERCOUNT() >= 3) {
|
||||||
if (msg->playernum <= 1) {
|
if (msg->playernum <= 1) {
|
||||||
y += 8;
|
y += 8;
|
||||||
} else {
|
} else {
|
||||||
@@ -987,6 +987,13 @@ void hudmsgCreateFromArgs(char *text, s32 type, s32 conf00, s32 conf01, s32 conf
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode && g_Vars.currentplayernum != 0) {
|
||||||
|
// do not create hudmsgs for other net players
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (j = 0; text[j] != '\0'; j++) {
|
for (j = 0; text[j] != '\0'; j++) {
|
||||||
hash = hash + text[j];
|
hash = hash + text[j];
|
||||||
}
|
}
|
||||||
@@ -1284,7 +1291,7 @@ void hudmsgsTick(void)
|
|||||||
&& msg->type != HUDMSGTYPE_CUTSCENESUBTITLE
|
&& msg->type != HUDMSGTYPE_CUTSCENESUBTITLE
|
||||||
&& msg->type != HUDMSGTYPE_INGAMESUBTITLE
|
&& msg->type != HUDMSGTYPE_INGAMESUBTITLE
|
||||||
#endif
|
#endif
|
||||||
&& PLAYERCOUNT() == 1) {
|
&& LOCALPLAYERCOUNT() == 1) {
|
||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
sndStart(var80095200, SFX_HUDMSG, NULL, -1, -1, -1, -1, -1);
|
sndStart(var80095200, SFX_HUDMSG, NULL, -1, -1, -1, -1, -1);
|
||||||
#else
|
#else
|
||||||
@@ -1383,7 +1390,7 @@ Gfx *hudmsgsRender(Gfx *gdl)
|
|||||||
s32 timerthing = 255;
|
s32 timerthing = 255;
|
||||||
s32 spdc = true;
|
s32 spdc = true;
|
||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
const s32 playercount = PLAYERCOUNT();
|
const s32 playercount = LOCALPLAYERCOUNT();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PAL
|
#if PAL
|
||||||
|
|||||||
+48
-3
@@ -96,6 +96,10 @@
|
|||||||
#include "lib/vars.h"
|
#include "lib/vars.h"
|
||||||
#include "lib/vi.h"
|
#include "lib/vi.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
#include "net/net.h"
|
||||||
|
#include "net/netmsg.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
struct sndstate *g_MiscSfxAudioHandles[3];
|
struct sndstate *g_MiscSfxAudioHandles[3];
|
||||||
u32 var800aa5bc;
|
u32 var800aa5bc;
|
||||||
@@ -319,6 +323,16 @@ void lvReset(s32 stagenum)
|
|||||||
s32 i;
|
s32 i;
|
||||||
s32 j;
|
s32 j;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
// if we're a server, signal to clients that the level is changing
|
||||||
|
netServerStageStart();
|
||||||
|
} else if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
// if we're a client, now is the time to apply the server's RNG seeds
|
||||||
|
netClientSyncRng();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
tilesReset();
|
tilesReset();
|
||||||
bgReset(g_Vars.stagenum);
|
bgReset(g_Vars.stagenum);
|
||||||
bgBuildTables(g_Vars.stagenum);
|
bgBuildTables(g_Vars.stagenum);
|
||||||
@@ -335,9 +349,9 @@ void lvReset(s32 stagenum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (g_Vars.mplayerisrunning == false) {
|
if (g_Vars.mplayerisrunning == false) {
|
||||||
g_Vars.playerstats[0].mpindex = 4;
|
g_Vars.playerstats[0].mpindex = MAX_PLAYERS;
|
||||||
g_PlayerConfigsArray[4].contpad1 = 0;
|
g_PlayerConfigsArray[MAX_PLAYERS].contpad1 = 0;
|
||||||
g_PlayerConfigsArray[4].contpad2 = 1;
|
g_PlayerConfigsArray[MAX_PLAYERS].contpad2 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i != ARRAYCOUNT(g_Vars.playerstats); i++) {
|
for (i = 0; i != ARRAYCOUNT(g_Vars.playerstats); i++) {
|
||||||
@@ -460,6 +474,12 @@ void lvReset(s32 stagenum)
|
|||||||
pheadReset();
|
pheadReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode) {
|
||||||
|
netSyncIdsAllocate();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
modelmgrSetLvResetting(false);
|
modelmgrSetLvResetting(false);
|
||||||
var80084018 = 1;
|
var80084018 = 1;
|
||||||
schedResetArtifacts();
|
schedResetArtifacts();
|
||||||
@@ -1083,6 +1103,13 @@ Gfx *lvRender(Gfx *gdl)
|
|||||||
struct player *player;
|
struct player *player;
|
||||||
struct chrdata *chr;
|
struct chrdata *chr;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode) {
|
||||||
|
// tick all players, we'll skip the rendering
|
||||||
|
forcesingleplayer = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
playercount = forcesingleplayer ? 1 : PLAYERCOUNT();
|
playercount = forcesingleplayer ? 1 : PLAYERCOUNT();
|
||||||
|
|
||||||
gSPClipRatio(gdl++, FRUSTRATIO_2);
|
gSPClipRatio(gdl++, FRUSTRATIO_2);
|
||||||
@@ -1675,12 +1702,21 @@ Gfx *lvRender(Gfx *gdl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (g_Vars.currentplayer->dostartnewlife) {
|
if (g_Vars.currentplayer->dostartnewlife) {
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode != NETMODE_CLIENT)
|
||||||
|
#endif
|
||||||
playerStartNewLife();
|
playerStartNewLife();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
artifactsTick();
|
artifactsTick();
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if ((g_NetMode && i) || i >= MAX_LOCAL_PLAYERS) {
|
||||||
|
gdl = savedgdl;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
|
if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
|
||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
&& playerHasSharedViewport()
|
&& playerHasSharedViewport()
|
||||||
@@ -2227,6 +2263,9 @@ void lvTick(void)
|
|||||||
|
|
||||||
if (elapsed < TICKS(g_MpTimeLimit60) && nexttime >= TICKS(g_MpTimeLimit60)) {
|
if (elapsed < TICKS(g_MpTimeLimit60) && nexttime >= TICKS(g_MpTimeLimit60)) {
|
||||||
// Match is ending due to time limit reached
|
// Match is ending due to time limit reached
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode != NETMODE_CLIENT)
|
||||||
|
#endif
|
||||||
mainEndStage();
|
mainEndStage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2280,6 +2319,12 @@ void lvTick(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
g_NumReasonsToEndMpMatch = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (g_NumReasonsToEndMpMatch > 0 && numdying == 0) {
|
if (g_NumReasonsToEndMpMatch > 0 && numdying == 0) {
|
||||||
mainEndStage();
|
mainEndStage();
|
||||||
}
|
}
|
||||||
|
|||||||
+212
-59
@@ -33,6 +33,9 @@
|
|||||||
#include "lib/str.h"
|
#include "lib/str.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
#include "net/net.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
u8 g_InventoryWeapon;
|
u8 g_InventoryWeapon;
|
||||||
|
|
||||||
@@ -41,6 +44,11 @@ struct menudialogdef g_CiControlPlayer2MenuDialog;
|
|||||||
struct menudialogdef g_CinemaMenuDialog;
|
struct menudialogdef g_CinemaMenuDialog;
|
||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
extern struct menudialogdef g_ExtendedMenuDialog;
|
extern struct menudialogdef g_ExtendedMenuDialog;
|
||||||
|
extern struct menudialogdef g_NetMenuDialog;
|
||||||
|
extern MenuItemHandlerResult menuhandlerJoinGame(s32 operation, struct menuitem *item, union handlerdata *data);
|
||||||
|
extern MenuItemHandlerResult menuhandlerJoinStart(s32 operation, struct menuitem *item, union handlerdata *data);
|
||||||
|
extern MenuItemHandlerResult menuhandlerHostGame(s32 operation, struct menuitem *item, union handlerdata *data);
|
||||||
|
extern MenuItemHandlerResult menuhandlerHostStart(s32 operation, struct menuitem *item, union handlerdata *data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *menuTextCurrentStageName(struct menuitem *item)
|
char *menuTextCurrentStageName(struct menuitem *item)
|
||||||
@@ -740,6 +748,7 @@ MenuItemHandlerResult menuhandlerAcceptMission(s32 operation, struct menuitem *i
|
|||||||
setNumPlayers(1);
|
setNumPlayers(1);
|
||||||
}
|
}
|
||||||
} else if (g_MissionConfig.isanti) {
|
} else if (g_MissionConfig.isanti) {
|
||||||
|
#ifdef PLATFORM_N64
|
||||||
if (g_Vars.pendingantiplayernum == 1) {
|
if (g_Vars.pendingantiplayernum == 1) {
|
||||||
g_Vars.bondplayernum = 0;
|
g_Vars.bondplayernum = 0;
|
||||||
g_Vars.antiplayernum = 1;
|
g_Vars.antiplayernum = 1;
|
||||||
@@ -749,7 +758,27 @@ MenuItemHandlerResult menuhandlerAcceptMission(s32 operation, struct menuitem *i
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_Vars.coopplayernum = -1;
|
g_Vars.coopplayernum = -1;
|
||||||
|
|
||||||
setNumPlayers(2);
|
setNumPlayers(2);
|
||||||
|
#else
|
||||||
|
u32 contmask = joyGetConnectedControllers();
|
||||||
|
u32 plrcount = 0;
|
||||||
|
u32 tmpmask;
|
||||||
|
|
||||||
|
// Count all players
|
||||||
|
tmpmask = contmask;
|
||||||
|
while (tmpmask) {
|
||||||
|
plrcount += (tmpmask & 0x1);
|
||||||
|
tmpmask >>= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_Vars.bondplayernum = g_Vars.pendingantiplayernum ^ 1;
|
||||||
|
g_Vars.antiplayernum = (g_Vars.bondplayernum == 0 ? 1 : 0);
|
||||||
|
g_Vars.coopplayernum = -1;
|
||||||
|
|
||||||
|
setNumPlayers(plrcount);
|
||||||
|
g_MpSetup.chrslots = contmask;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
// Solo
|
// Solo
|
||||||
g_Vars.bondplayernum = 0;
|
g_Vars.bondplayernum = 0;
|
||||||
@@ -1537,6 +1566,8 @@ MenuItemHandlerResult menuhandlerAntiRadar(s32 operation, struct menuitem *item,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PLATFORM_N64
|
||||||
|
|
||||||
MenuItemHandlerResult menuhandlerAntiPlayer(s32 operation, struct menuitem *item, union handlerdata *data)
|
MenuItemHandlerResult menuhandlerAntiPlayer(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||||
{
|
{
|
||||||
const u16 labels[] = {L_OPTIONS_271, L_OPTIONS_272};
|
const u16 labels[] = {L_OPTIONS_271, L_OPTIONS_272};
|
||||||
@@ -1603,6 +1634,100 @@ struct menuitem g_AntiOptionsMenuItems[] = {
|
|||||||
{ MENUITEMTYPE_END },
|
{ MENUITEMTYPE_END },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
MenuItemHandlerResult menuhandlerAntiMainPlayer(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||||
|
{
|
||||||
|
static const char *labels[] = {
|
||||||
|
"Player 1",
|
||||||
|
"Player 2",
|
||||||
|
"Player 3",
|
||||||
|
"Player 4",
|
||||||
|
};
|
||||||
|
|
||||||
|
// For consistency with the main save format,
|
||||||
|
// the main player is (pendingantiplayernum XOR 1)
|
||||||
|
|
||||||
|
// g_Vars.(bond|anti|coop)playernum is based on the n'th player slot, not the n'th controller;
|
||||||
|
// that is, it's not based on g_MpSetup.chrslots.
|
||||||
|
// Because of this, it's easier just to change the label.
|
||||||
|
|
||||||
|
u32 tmpmask = joyGetConnectedControllers();
|
||||||
|
u32 plrcount = 0;
|
||||||
|
u32 labelidx = 0;
|
||||||
|
while (tmpmask) {
|
||||||
|
plrcount += (tmpmask & 0x1);
|
||||||
|
if (plrcount <= data->dropdown.value) {
|
||||||
|
labelidx += 1;
|
||||||
|
}
|
||||||
|
tmpmask >>= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (operation) {
|
||||||
|
case MENUOP_GETOPTIONCOUNT:
|
||||||
|
data->dropdown.value = plrcount;
|
||||||
|
break;
|
||||||
|
case MENUOP_GETOPTIONTEXT:
|
||||||
|
return (s32) (labels[labelidx]);
|
||||||
|
case MENUOP_SET:
|
||||||
|
g_Vars.pendingantiplayernum = data->dropdown.value ^ 1;
|
||||||
|
g_Vars.modifiedfiles |= MODFILE_GAME;
|
||||||
|
break;
|
||||||
|
case MENUOP_GETSELECTEDINDEX:
|
||||||
|
data->dropdown.value = g_Vars.pendingantiplayernum ^ 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct menuitem g_AntiOptionsMenuItems[] = {
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_CHECKBOX,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
L_OPTIONS_267, // "Radar On"
|
||||||
|
0,
|
||||||
|
menuhandlerAntiRadar,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_DROPDOWN,
|
||||||
|
0,
|
||||||
|
MENUITEMFLAG_LITERAL_TEXT,
|
||||||
|
(uintptr_t)"Main Player",
|
||||||
|
0,
|
||||||
|
menuhandlerAntiMainPlayer,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SEPARATOR,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SELECTABLE,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
L_OPTIONS_269, // "Continue"
|
||||||
|
0,
|
||||||
|
menuhandlerBuddyOptionsContinue,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SELECTABLE,
|
||||||
|
0,
|
||||||
|
MENUITEMFLAG_SELECTABLE_CLOSESDIALOG,
|
||||||
|
L_OPTIONS_270, // "Cancel"
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
|
{ MENUITEMTYPE_END },
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
struct menudialogdef g_AntiOptionsMenuDialog = {
|
struct menudialogdef g_AntiOptionsMenuDialog = {
|
||||||
MENUDIALOGTYPE_DEFAULT,
|
MENUDIALOGTYPE_DEFAULT,
|
||||||
L_OPTIONS_266, // "Counter-Operative Options"
|
L_OPTIONS_266, // "Counter-Operative Options"
|
||||||
@@ -2682,7 +2807,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_205, // "Sight on Screen"
|
L_OPTIONS_205, // "Sight on Screen"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerSightOnScreen,
|
menuhandlerSightOnScreen,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2690,7 +2815,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_206, // "Always Show Target"
|
L_OPTIONS_206, // "Always Show Target"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerAlwaysShowTarget,
|
menuhandlerAlwaysShowTarget,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2698,7 +2823,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_207, // "Show Zoom Range"
|
L_OPTIONS_207, // "Show Zoom Range"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerShowZoomRange,
|
menuhandlerShowZoomRange,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2706,7 +2831,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_208, // "Ammo on Screen"
|
L_OPTIONS_208, // "Ammo on Screen"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerAmmoOnScreen,
|
menuhandlerAmmoOnScreen,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2714,7 +2839,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_209, // "Show Gun Function"
|
L_OPTIONS_209, // "Show Gun Function"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerShowGunFunction,
|
menuhandlerShowGunFunction,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2722,7 +2847,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_210, // "Paintball"
|
L_OPTIONS_210, // "Paintball"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerPaintball,
|
menuhandlerPaintball,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2730,7 +2855,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_169, // "In-Game Subtitles"
|
L_MPWEAPONS_169, // "In-Game Subtitles"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerInGameSubtitles,
|
menuhandlerInGameSubtitles,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2738,7 +2863,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_168, // "Cutscene Subtitles"
|
L_MPWEAPONS_168, // "Cutscene Subtitles"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerCutsceneSubtitles,
|
menuhandlerCutsceneSubtitles,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2746,7 +2871,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_212, // "Show Mission Time"
|
L_OPTIONS_212, // "Show Mission Time"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerShowMissionTime,
|
menuhandlerShowMissionTime,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2783,7 +2908,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_145, // "Sight on Screen"
|
L_MPWEAPONS_145, // "Sight on Screen"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerSightOnScreen,
|
menuhandlerSightOnScreen,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2791,7 +2916,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_146, // "Target"
|
L_MPWEAPONS_146, // "Target"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerAlwaysShowTarget,
|
menuhandlerAlwaysShowTarget,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2799,7 +2924,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_147, // "Zoom Range"
|
L_MPWEAPONS_147, // "Zoom Range"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerShowZoomRange,
|
menuhandlerShowZoomRange,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2807,7 +2932,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_148, // "Show Ammo"
|
L_MPWEAPONS_148, // "Show Ammo"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerAmmoOnScreen,
|
menuhandlerAmmoOnScreen,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2815,7 +2940,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_149, // "Gun Function"
|
L_MPWEAPONS_149, // "Gun Function"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerShowGunFunction,
|
menuhandlerShowGunFunction,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2823,7 +2948,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_150, // "Paintball"
|
L_MPWEAPONS_150, // "Paintball"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerPaintball,
|
menuhandlerPaintball,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2835,7 +2960,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
|||||||
#else
|
#else
|
||||||
L_MPWEAPONS_169, // "In-Game Subtitles"
|
L_MPWEAPONS_169, // "In-Game Subtitles"
|
||||||
#endif
|
#endif
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerInGameSubtitles,
|
menuhandlerInGameSubtitles,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2847,7 +2972,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
|||||||
#else
|
#else
|
||||||
L_MPWEAPONS_168, // "Cutscene Subtitles"
|
L_MPWEAPONS_168, // "Cutscene Subtitles"
|
||||||
#endif
|
#endif
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerCutsceneSubtitles,
|
menuhandlerCutsceneSubtitles,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2855,7 +2980,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_152, // "Mission Time"
|
L_MPWEAPONS_152, // "Mission Time"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerShowMissionTime,
|
menuhandlerShowMissionTime,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2892,7 +3017,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_205, // "Sight on Screen"
|
L_OPTIONS_205, // "Sight on Screen"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerSightOnScreen,
|
menuhandlerSightOnScreen,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2900,7 +3025,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_206, // "Always Show Target"
|
L_OPTIONS_206, // "Always Show Target"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerAlwaysShowTarget,
|
menuhandlerAlwaysShowTarget,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2908,7 +3033,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_207, // "Show Zoom Range"
|
L_OPTIONS_207, // "Show Zoom Range"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerShowZoomRange,
|
menuhandlerShowZoomRange,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2916,7 +3041,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_208, // "Ammo on Screen"
|
L_OPTIONS_208, // "Ammo on Screen"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerAmmoOnScreen,
|
menuhandlerAmmoOnScreen,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2924,7 +3049,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_209, // "Show Gun Function"
|
L_OPTIONS_209, // "Show Gun Function"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerShowGunFunction,
|
menuhandlerShowGunFunction,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2932,7 +3057,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_210, // "Paintball"
|
L_OPTIONS_210, // "Paintball"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerPaintball,
|
menuhandlerPaintball,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2940,7 +3065,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_169, // "In-Game Subtitles"
|
L_MPWEAPONS_169, // "In-Game Subtitles"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerInGameSubtitles,
|
menuhandlerInGameSubtitles,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2948,7 +3073,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_168, // "Cutscene Subtitles"
|
L_MPWEAPONS_168, // "Cutscene Subtitles"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerCutsceneSubtitles,
|
menuhandlerCutsceneSubtitles,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2956,7 +3081,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_212, // "Show Mission Time"
|
L_OPTIONS_212, // "Show Mission Time"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerShowMissionTime,
|
menuhandlerShowMissionTime,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2995,7 +3120,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_205, // "Sight on Screen"
|
L_OPTIONS_205, // "Sight on Screen"
|
||||||
0x00000005,
|
MAX_PLAYERS + 1,
|
||||||
menuhandlerSightOnScreen,
|
menuhandlerSightOnScreen,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3003,7 +3128,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_206, // "Always Show Target"
|
L_OPTIONS_206, // "Always Show Target"
|
||||||
0x00000005,
|
MAX_PLAYERS + 1,
|
||||||
menuhandlerAlwaysShowTarget,
|
menuhandlerAlwaysShowTarget,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3011,7 +3136,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_207, // "Show Zoom Range"
|
L_OPTIONS_207, // "Show Zoom Range"
|
||||||
0x00000005,
|
MAX_PLAYERS + 1,
|
||||||
menuhandlerShowZoomRange,
|
menuhandlerShowZoomRange,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3019,7 +3144,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_208, // "Ammo on Screen"
|
L_OPTIONS_208, // "Ammo on Screen"
|
||||||
0x00000005,
|
MAX_PLAYERS + 1,
|
||||||
menuhandlerAmmoOnScreen,
|
menuhandlerAmmoOnScreen,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3027,7 +3152,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_209, // "Show Gun Function"
|
L_OPTIONS_209, // "Show Gun Function"
|
||||||
0x00000005,
|
MAX_PLAYERS + 1,
|
||||||
menuhandlerShowGunFunction,
|
menuhandlerShowGunFunction,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3035,7 +3160,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_210, // "Paintball"
|
L_OPTIONS_210, // "Paintball"
|
||||||
0x00000005,
|
MAX_PLAYERS + 1,
|
||||||
menuhandlerPaintball,
|
menuhandlerPaintball,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3043,7 +3168,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_169, // "In-Game Subtitles"
|
L_MPWEAPONS_169, // "In-Game Subtitles"
|
||||||
0x00000005,
|
MAX_PLAYERS + 1,
|
||||||
menuhandlerInGameSubtitles,
|
menuhandlerInGameSubtitles,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3051,7 +3176,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_168, // "Cutscene Subtitles"
|
L_MPWEAPONS_168, // "Cutscene Subtitles"
|
||||||
0x00000005,
|
MAX_PLAYERS + 1,
|
||||||
menuhandlerCutsceneSubtitles,
|
menuhandlerCutsceneSubtitles,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3059,7 +3184,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_212, // "Show Mission Time"
|
L_OPTIONS_212, // "Show Mission Time"
|
||||||
0x00000005,
|
MAX_PLAYERS + 1,
|
||||||
menuhandlerShowMissionTime,
|
menuhandlerShowMissionTime,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3104,7 +3229,7 @@ struct menuitem g_MissionControlOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_195, // "Reverse Pitch"
|
L_OPTIONS_195, // "Reverse Pitch"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerReversePitch,
|
menuhandlerReversePitch,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3112,7 +3237,7 @@ struct menuitem g_MissionControlOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_196, // "Look Ahead"
|
L_OPTIONS_196, // "Look Ahead"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerLookAhead,
|
menuhandlerLookAhead,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3120,7 +3245,7 @@ struct menuitem g_MissionControlOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_197, // "Head Roll"
|
L_OPTIONS_197, // "Head Roll"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerHeadRoll,
|
menuhandlerHeadRoll,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3128,7 +3253,7 @@ struct menuitem g_MissionControlOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_198, // "Auto-Aim"
|
L_OPTIONS_198, // "Auto-Aim"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerAutoAim,
|
menuhandlerAutoAim,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3136,7 +3261,7 @@ struct menuitem g_MissionControlOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_199, // "Aim Control"
|
L_OPTIONS_199, // "Aim Control"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerAimControl,
|
menuhandlerAimControl,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3182,7 +3307,7 @@ struct menuitem g_CiControlOptionsMenuItems2[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_271, // ""
|
L_MPWEAPONS_271, // ""
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerReversePitch,
|
menuhandlerReversePitch,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3190,7 +3315,7 @@ struct menuitem g_CiControlOptionsMenuItems2[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_272, // ""
|
L_MPWEAPONS_272, // ""
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerLookAhead,
|
menuhandlerLookAhead,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3198,7 +3323,7 @@ struct menuitem g_CiControlOptionsMenuItems2[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_273, // ""
|
L_MPWEAPONS_273, // ""
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerHeadRoll,
|
menuhandlerHeadRoll,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3206,7 +3331,7 @@ struct menuitem g_CiControlOptionsMenuItems2[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_274, // ""
|
L_MPWEAPONS_274, // ""
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerAutoAim,
|
menuhandlerAutoAim,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3214,7 +3339,7 @@ struct menuitem g_CiControlOptionsMenuItems2[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_MPWEAPONS_275, // ""
|
L_MPWEAPONS_275, // ""
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerAimControl,
|
menuhandlerAimControl,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3260,7 +3385,7 @@ struct menuitem g_CiControlOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_195, // "Reverse Pitch"
|
L_OPTIONS_195, // "Reverse Pitch"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerReversePitch,
|
menuhandlerReversePitch,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3268,7 +3393,7 @@ struct menuitem g_CiControlOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_196, // "Look Ahead"
|
L_OPTIONS_196, // "Look Ahead"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerLookAhead,
|
menuhandlerLookAhead,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3276,7 +3401,7 @@ struct menuitem g_CiControlOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_197, // "Head Roll"
|
L_OPTIONS_197, // "Head Roll"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerHeadRoll,
|
menuhandlerHeadRoll,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3284,7 +3409,7 @@ struct menuitem g_CiControlOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_198, // "Auto-Aim"
|
L_OPTIONS_198, // "Auto-Aim"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerAutoAim,
|
menuhandlerAutoAim,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3292,7 +3417,7 @@ struct menuitem g_CiControlOptionsMenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_199, // "Aim Control"
|
L_OPTIONS_199, // "Aim Control"
|
||||||
0x00000004,
|
MAX_PLAYERS,
|
||||||
menuhandlerAimControl,
|
menuhandlerAimControl,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3337,7 +3462,7 @@ struct menuitem g_CiControlPlayer2MenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_195, // "Reverse Pitch"
|
L_OPTIONS_195, // "Reverse Pitch"
|
||||||
0x00000005,
|
MAX_PLAYERS + 1,
|
||||||
menuhandlerReversePitch,
|
menuhandlerReversePitch,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3345,7 +3470,7 @@ struct menuitem g_CiControlPlayer2MenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_196, // "Look Ahead"
|
L_OPTIONS_196, // "Look Ahead"
|
||||||
0x00000005,
|
MAX_PLAYERS + 1,
|
||||||
menuhandlerLookAhead,
|
menuhandlerLookAhead,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3353,7 +3478,7 @@ struct menuitem g_CiControlPlayer2MenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_197, // "Head Roll"
|
L_OPTIONS_197, // "Head Roll"
|
||||||
0x00000005,
|
MAX_PLAYERS + 1,
|
||||||
menuhandlerHeadRoll,
|
menuhandlerHeadRoll,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3361,7 +3486,7 @@ struct menuitem g_CiControlPlayer2MenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_198, // "Auto-Aim"
|
L_OPTIONS_198, // "Auto-Aim"
|
||||||
0x00000005,
|
MAX_PLAYERS + 1,
|
||||||
menuhandlerAutoAim,
|
menuhandlerAutoAim,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3369,7 +3494,7 @@ struct menuitem g_CiControlPlayer2MenuItems[] = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
L_OPTIONS_199, // "Aim Control"
|
L_OPTIONS_199, // "Aim Control"
|
||||||
0x00000005,
|
MAX_PLAYERS + 1,
|
||||||
menuhandlerAimControl,
|
menuhandlerAimControl,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -4846,7 +4971,7 @@ MenuItemHandlerResult menuhandlerMainMenuCooperative(s32 operation, struct menui
|
|||||||
MenuItemHandlerResult menuhandlerMainMenuCounterOperative(s32 operation, struct menuitem *item, union handlerdata *data)
|
MenuItemHandlerResult menuhandlerMainMenuCounterOperative(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||||
{
|
{
|
||||||
if (operation == MENUOP_CHECKDISABLED) {
|
if (operation == MENUOP_CHECKDISABLED) {
|
||||||
if ((joyGetConnectedControllers() & 2) == 0) {
|
if ((joyGetConnectedControllers() & ~0x1) == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4865,6 +4990,11 @@ MenuDialogHandlerResult menudialogMainMenu(s32 operation, struct menudialogdef *
|
|||||||
switch (operation) {
|
switch (operation) {
|
||||||
case MENUOP_OPEN:
|
case MENUOP_OPEN:
|
||||||
g_Menus[g_MpPlayerNum].main.unke2c = 0;
|
g_Menus[g_MpPlayerNum].main.unke2c = 0;
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode) {
|
||||||
|
netDisconnect();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case MENUOP_TICK:
|
case MENUOP_TICK:
|
||||||
if (g_Menus[g_MpPlayerNum].curdialog &&
|
if (g_Menus[g_MpPlayerNum].curdialog &&
|
||||||
@@ -4872,6 +5002,17 @@ MenuDialogHandlerResult menudialogMainMenu(s32 operation, struct menudialogdef *
|
|||||||
g_MissionConfig.iscoop = false;
|
g_MissionConfig.iscoop = false;
|
||||||
g_MissionConfig.isanti = false;
|
g_MissionConfig.isanti = false;
|
||||||
}
|
}
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetJoinLatch) {
|
||||||
|
menuhandlerJoinGame(MENUOP_SET, NULL, NULL);
|
||||||
|
menuhandlerJoinStart(MENUOP_SET, NULL, NULL);
|
||||||
|
g_NetJoinLatch = false;
|
||||||
|
} else if (g_NetHostLatch) {
|
||||||
|
menuhandlerHostGame(MENUOP_SET, NULL, NULL);
|
||||||
|
menuhandlerHostStart(MENUOP_SET, NULL, NULL);
|
||||||
|
g_NetHostLatch = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4942,24 +5083,36 @@ struct menuitem g_MainMenuMenuItems[] = {
|
|||||||
0x00000005,
|
0x00000005,
|
||||||
menuhandlerMainMenuCounterOperative,
|
menuhandlerMainMenuCounterOperative,
|
||||||
},
|
},
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SELECTABLE,
|
||||||
|
4,
|
||||||
|
MENUITEMFLAG_SELECTABLE_OPENSDIALOG | MENUITEMFLAG_BIGFONT | MENUITEMFLAG_LITERAL_TEXT,
|
||||||
|
(uintptr_t)"Network Game",
|
||||||
|
0x00000006,
|
||||||
|
(void *)&g_NetMenuDialog,
|
||||||
|
},
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
MENUITEMTYPE_SELECTABLE,
|
MENUITEMTYPE_SELECTABLE,
|
||||||
0,
|
0,
|
||||||
MENUITEMFLAG_SELECTABLE_OPENSDIALOG | MENUITEMFLAG_BIGFONT,
|
MENUITEMFLAG_SELECTABLE_OPENSDIALOG | MENUITEMFLAG_BIGFONT,
|
||||||
L_OPTIONS_187, // "Change Agent..."
|
L_OPTIONS_187, // "Change Agent..."
|
||||||
0x00000006,
|
0x00000007,
|
||||||
(void *)&g_ChangeAgentMenuDialog,
|
(void *)&g_ChangeAgentMenuDialog,
|
||||||
},
|
},
|
||||||
|
/*
|
||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
{
|
{
|
||||||
MENUITEMTYPE_SELECTABLE,
|
MENUITEMTYPE_SELECTABLE,
|
||||||
0,
|
0,
|
||||||
MENUITEMFLAG_SELECTABLE_OPENSDIALOG | MENUITEMFLAG_BIGFONT | MENUITEMFLAG_LITERAL_TEXT,
|
MENUITEMFLAG_SELECTABLE_OPENSDIALOG | MENUITEMFLAG_BIGFONT | MENUITEMFLAG_LITERAL_TEXT,
|
||||||
(uintptr_t)"Exit Game",
|
(uintptr_t)"Exit Game",
|
||||||
0x00000007,
|
0x00000008,
|
||||||
(void *)&g_ExitGameMenuDialog,
|
(void *)&g_ExitGameMenuDialog,
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
{ MENUITEMTYPE_END },
|
{ MENUITEMTYPE_END },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+17
-6
@@ -50,6 +50,7 @@
|
|||||||
#include "types.h"
|
#include "types.h"
|
||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
|
#include "net/net.h"
|
||||||
#define BLUR_OFS 10
|
#define BLUR_OFS 10
|
||||||
#else
|
#else
|
||||||
#define BLUR_OFS 30
|
#define BLUR_OFS 30
|
||||||
@@ -3436,7 +3437,7 @@ void menuClose(void)
|
|||||||
void func0f0f8120(void)
|
void func0f0f8120(void)
|
||||||
{
|
{
|
||||||
#ifdef AVOID_UB
|
#ifdef AVOID_UB
|
||||||
u32 mpindex = g_MpPlayerNum % MAX_PLAYERS;
|
u32 mpindex = g_MpPlayerNum % MAX_LOCAL_PLAYERS;
|
||||||
struct menudialog *prev = g_Menus[mpindex].curdialog;
|
struct menudialog *prev = g_Menus[mpindex].curdialog;
|
||||||
s32 i;
|
s32 i;
|
||||||
#else
|
#else
|
||||||
@@ -3451,9 +3452,6 @@ void func0f0f8120(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef AVOID_UB
|
#ifdef AVOID_UB
|
||||||
mpindex = g_MpPlayerNum;
|
|
||||||
if (mpindex >= MAX_PLAYERS)
|
|
||||||
mpindex -= MAX_PLAYERS;
|
|
||||||
if (g_Menus[mpindex].curdialog == prev) {
|
if (g_Menus[mpindex].curdialog == prev) {
|
||||||
while (g_Menus[mpindex].depth > 0) {
|
while (g_Menus[mpindex].depth > 0) {
|
||||||
menuPopDialog();
|
menuPopDialog();
|
||||||
@@ -5345,7 +5343,7 @@ Gfx *menuRender(Gfx *gdl)
|
|||||||
} else {
|
} else {
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
g_MpPlayerNum = i;
|
g_MpPlayerNum = i;
|
||||||
gdl = menuRenderDialogs(gdl);
|
gdl = menuRenderDialogs(gdl);
|
||||||
}
|
}
|
||||||
@@ -5378,7 +5376,20 @@ Gfx *menuRender(Gfx *gdl)
|
|||||||
|
|
||||||
gdl = text0f153628(gdl);
|
gdl = text0f153628(gdl);
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode) {
|
||||||
|
if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
sprintf(text, "Server: %d/%d %04x", g_NetNumClients, g_NetMaxClients, g_MpSetup.chrslots);
|
||||||
|
} else {
|
||||||
|
sprintf(text, "Client: ID %u", g_NetLocalClient->id);
|
||||||
|
}
|
||||||
|
x = viewleft + 2;
|
||||||
|
y = viewbottom - 9;
|
||||||
|
colour = 0x00ff00ff;
|
||||||
|
gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, viGetWidth(), viGetHeight(), 0, 0);
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
// Figure out what text will be displayed. The text calculated
|
// Figure out what text will be displayed. The text calculated
|
||||||
// here is for measuring purposes only and isn't rendered.
|
// here is for measuring purposes only and isn't rendered.
|
||||||
// Amusingly, there's a %d placeholder in the text which isn't
|
// Amusingly, there's a %d placeholder in the text which isn't
|
||||||
|
|||||||
+2
-2
@@ -4147,7 +4147,7 @@ Gfx *menuitemControllerRenderText(Gfx *gdl, s32 curmode, struct menurendercontex
|
|||||||
// during development the second player in the 2.x styles had to
|
// during development the second player in the 2.x styles had to
|
||||||
// choose their control style separately to player 1, in which case
|
// choose their control style separately to player 1, in which case
|
||||||
// there would have been 2.5, 2.6, 2.7 and 2.8 for player 2.
|
// there would have been 2.5, 2.6, 2.7 and 2.8 for player 2.
|
||||||
if (curmode > CONTROLMODE_24 && curmode != CONTROLMODE_PC) {
|
if (curmode > CONTROLMODE_24 && curmode < CONTROLMODE_PC) {
|
||||||
if (textnum == menuitemControllerGetButtonAction(prevmode + 4, i)) {
|
if (textnum == menuitemControllerGetButtonAction(prevmode + 4, i)) {
|
||||||
colour = labelcolour;
|
colour = labelcolour;
|
||||||
}
|
}
|
||||||
@@ -4232,7 +4232,7 @@ Gfx *menuitemControllerRender(Gfx *gdl, struct menurendercontext *context)
|
|||||||
data->prevmode = -1;
|
data->prevmode = -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (g_Menus[g_MpPlayerNum].main.controlmode >= CONTROLMODE_21 && g_Menus[g_MpPlayerNum].main.controlmode != CONTROLMODE_PC) {
|
if (g_Menus[g_MpPlayerNum].main.controlmode >= CONTROLMODE_21 && g_Menus[g_MpPlayerNum].main.controlmode < CONTROLMODE_PC) {
|
||||||
data->controlgroup = 1;
|
data->controlgroup = 1;
|
||||||
data->contfadetimer = 0;
|
data->contfadetimer = 0;
|
||||||
data->prevmode = -1;
|
data->prevmode = -1;
|
||||||
|
|||||||
+52
-9
@@ -27,6 +27,9 @@
|
|||||||
#include "lib/snd.h"
|
#include "lib/snd.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
#include "net/net.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
u8 g_FileState = 0;
|
u8 g_FileState = 0;
|
||||||
u8 var80062944 = 0;
|
u8 var80062944 = 0;
|
||||||
@@ -218,13 +221,19 @@ void menuTick(void)
|
|||||||
viBlack(false);
|
viBlack(false);
|
||||||
g_MpNumJoined = 0;
|
g_MpNumJoined = 0;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode) {
|
||||||
|
g_Vars.mpsetupmenu = MPSETUPMENU_ADVSETUP;
|
||||||
|
g_MpSetup.chrslots = 1;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
if (g_Vars.usingadvsetup) {
|
if (g_Vars.usingadvsetup) {
|
||||||
g_Vars.mpsetupmenu = MPSETUPMENU_ADVSETUP;
|
g_Vars.mpsetupmenu = MPSETUPMENU_ADVSETUP;
|
||||||
} else {
|
} else {
|
||||||
g_Vars.mpsetupmenu = MPSETUPMENU_GENERAL;
|
g_Vars.mpsetupmenu = MPSETUPMENU_GENERAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
g_Vars.waitingtojoin[i] = false;
|
g_Vars.waitingtojoin[i] = false;
|
||||||
|
|
||||||
if (g_MpSetup.chrslots & (1 << i)) {
|
if (g_MpSetup.chrslots & (1 << i)) {
|
||||||
@@ -233,6 +242,13 @@ void menuTick(void)
|
|||||||
if (g_Vars.mpsetupmenu == MPSETUPMENU_ADVSETUP) {
|
if (g_Vars.mpsetupmenu == MPSETUPMENU_ADVSETUP) {
|
||||||
g_MpNumJoined++;
|
g_MpNumJoined++;
|
||||||
func0f17fcb0(true);
|
func0f17fcb0(true);
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
// autodump client into waiting screen while host is changing settings
|
||||||
|
extern struct menudialogdef g_NetJoiningDialog;
|
||||||
|
menuPushDialog(&g_NetJoiningDialog);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else if (g_MpNumJoined == 0) {
|
} else if (g_MpNumJoined == 0) {
|
||||||
g_MpNumJoined++;
|
g_MpNumJoined++;
|
||||||
|
|
||||||
@@ -286,7 +302,11 @@ void menuTick(void)
|
|||||||
|
|
||||||
if (g_MenuData.root == MENUROOT_MPSETUP || g_MenuData.root == MENUROOT_4MBMAINMENU) {
|
if (g_MenuData.root == MENUROOT_MPSETUP || g_MenuData.root == MENUROOT_4MBMAINMENU) {
|
||||||
if (g_MenuData.unk008 == -1) {
|
if (g_MenuData.unk008 == -1) {
|
||||||
|
#if MAX_PLAYERS > 4
|
||||||
|
g_MpSetup.chrslots &= 0xff00;
|
||||||
|
#else
|
||||||
g_MpSetup.chrslots &= 0xfff0;
|
g_MpSetup.chrslots &= 0xfff0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
g_MpNumJoined = 0;
|
g_MpNumJoined = 0;
|
||||||
@@ -301,11 +321,23 @@ void menuTick(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER && g_MenuData.unk008 == -1) {
|
||||||
|
s32 slot = 1;
|
||||||
|
for (i = 1; i < g_NetMaxClients; ++i) {
|
||||||
|
if (g_NetClients[i].state >= CLSTATE_LOBBY) {
|
||||||
|
g_MpSetup.chrslots |= (1 << slot);
|
||||||
|
++slot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mpCalculateLockIfLastWinnerOrLoser();
|
mpCalculateLockIfLastWinnerOrLoser();
|
||||||
challengePerformSanityChecks();
|
challengePerformSanityChecks();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
g_MpPlayerNum = i;
|
g_MpPlayerNum = i;
|
||||||
|
|
||||||
if (g_Menus[g_MpPlayerNum].curdialog) {
|
if (g_Menus[g_MpPlayerNum].curdialog) {
|
||||||
@@ -317,7 +349,7 @@ void menuTick(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
g_MpPlayerNum = i;
|
g_MpPlayerNum = i;
|
||||||
|
|
||||||
if (g_Menus[g_MpPlayerNum].curdialog) {
|
if (g_Menus[g_MpPlayerNum].curdialog) {
|
||||||
@@ -341,7 +373,7 @@ void menuTick(void)
|
|||||||
// Limit to 2 players? But in a roundabout kind of way
|
// Limit to 2 players? But in a roundabout kind of way
|
||||||
canjoin = true;
|
canjoin = true;
|
||||||
|
|
||||||
for (j = 0; j < MAX_PLAYERS; j++) {
|
for (j = 0; j < MAX_LOCAL_PLAYERS; j++) {
|
||||||
if (g_Vars.waitingtojoin[j]) {
|
if (g_Vars.waitingtojoin[j]) {
|
||||||
canjoin = false;
|
canjoin = false;
|
||||||
}
|
}
|
||||||
@@ -355,6 +387,12 @@ void menuTick(void)
|
|||||||
canjoin = true;
|
canjoin = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode) {
|
||||||
|
canjoin = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (g_BossFile.locktype == MPLOCKTYPE_CHALLENGE) {
|
if (g_BossFile.locktype == MPLOCKTYPE_CHALLENGE) {
|
||||||
g_PlayerConfigsArray[i].base.team = 0;
|
g_PlayerConfigsArray[i].base.team = 0;
|
||||||
}
|
}
|
||||||
@@ -527,7 +565,12 @@ void menuTick(void)
|
|||||||
func0f0fd548(4);
|
func0f0fd548(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
#ifdef PLATFORM_N64
|
||||||
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
|
#else
|
||||||
|
const s32 maxplayers = g_NetMode ? 1 : MAX_LOCAL_PLAYERS;
|
||||||
|
for (i = 0; i < maxplayers; i++) {
|
||||||
|
#endif
|
||||||
if (g_MpSetup.chrslots & (1 << i)) {
|
if (g_MpSetup.chrslots & (1 << i)) {
|
||||||
if (g_Vars.coopplayernum >= 0) {
|
if (g_Vars.coopplayernum >= 0) {
|
||||||
if (g_Vars.stagenum == STAGE_DEEPSEA) {
|
if (g_Vars.stagenum == STAGE_DEEPSEA) {
|
||||||
@@ -617,12 +660,12 @@ void menuTick(void)
|
|||||||
} else if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
|
} else if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
|
||||||
struct mpplayerconfig tmp;
|
struct mpplayerconfig tmp;
|
||||||
|
|
||||||
tmp = g_PlayerConfigsArray[4];
|
tmp = g_PlayerConfigsArray[MAX_PLAYERS];
|
||||||
g_PlayerConfigsArray[4] = g_PlayerConfigsArray[0];
|
g_PlayerConfigsArray[MAX_PLAYERS] = g_PlayerConfigsArray[0];
|
||||||
g_PlayerConfigsArray[0] = tmp;
|
g_PlayerConfigsArray[0] = tmp;
|
||||||
|
|
||||||
tmp = g_PlayerConfigsArray[5];
|
tmp = g_PlayerConfigsArray[MAX_PLAYERS + 1];
|
||||||
g_PlayerConfigsArray[5] = g_PlayerConfigsArray[1];
|
g_PlayerConfigsArray[MAX_PLAYERS + 1] = g_PlayerConfigsArray[1];
|
||||||
g_PlayerConfigsArray[1] = tmp;
|
g_PlayerConfigsArray[1] = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,9 @@
|
|||||||
#include "lib/main.h"
|
#include "lib/main.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
#include "net/net.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
struct menudialogdef g_MpEndscreenChallengeCompletedMenuDialog;
|
struct menudialogdef g_MpEndscreenChallengeCompletedMenuDialog;
|
||||||
struct menudialogdef g_MpEndscreenIndGameOverMenuDialog;
|
struct menudialogdef g_MpEndscreenIndGameOverMenuDialog;
|
||||||
@@ -102,6 +105,11 @@ MenuItemHandlerResult menuhandlerMpEndGame(s32 operation, struct menuitem *item,
|
|||||||
{
|
{
|
||||||
if (operation == MENUOP_SET) {
|
if (operation == MENUOP_SET) {
|
||||||
g_Vars.currentplayer->aborted = true;
|
g_Vars.currentplayer->aborted = true;
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
netDisconnect();
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
mainEndStage();
|
mainEndStage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,6 +173,11 @@ MenuItemHandlerResult menuhandlerMpPause(s32 operation, struct menuitem *item, u
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (operation == MENUOP_CHECKHIDDEN) {
|
if (operation == MENUOP_CHECKHIDDEN) {
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (PLAYERCOUNT() == 1) {
|
if (PLAYERCOUNT() == 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -787,7 +800,11 @@ void mpPushPauseDialog(void)
|
|||||||
menuPushRootDialog(&g_MpPausePlayerRankingMenuDialog, MENUROOT_MPPAUSE);
|
menuPushRootDialog(&g_MpPausePlayerRankingMenuDialog, MENUROOT_MPPAUSE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
|| LOCALPLAYERCOUNT() >= 3
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
menuPushRootDialog(&g_2PMissionPauseVMenuDialog, MENUROOT_MPPAUSE);
|
menuPushRootDialog(&g_2PMissionPauseVMenuDialog, MENUROOT_MPPAUSE);
|
||||||
} else {
|
} else {
|
||||||
menuPushRootDialog(&g_2PMissionPauseHMenuDialog, MENUROOT_MPPAUSE);
|
menuPushRootDialog(&g_2PMissionPauseHMenuDialog, MENUROOT_MPPAUSE);
|
||||||
@@ -831,6 +848,9 @@ void mpPushEndscreenDialog(u32 arg0, u32 playernum)
|
|||||||
&& g_PlayerConfigsArray[g_MpPlayerNum].fileguid.fileid == 0
|
&& g_PlayerConfigsArray[g_MpPlayerNum].fileguid.fileid == 0
|
||||||
&& g_PlayerConfigsArray[g_MpPlayerNum].fileguid.deviceserial == 0) {
|
&& g_PlayerConfigsArray[g_MpPlayerNum].fileguid.deviceserial == 0) {
|
||||||
g_PlayerConfigsArray[g_MpPlayerNum].options |= OPTION_ASKEDSAVEPLAYER;
|
g_PlayerConfigsArray[g_MpPlayerNum].options |= OPTION_ASKEDSAVEPLAYER;
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (!g_NetMode)
|
||||||
|
#endif
|
||||||
menuPushDialog(&g_MpEndscreenSavePlayerMenuDialog);
|
menuPushDialog(&g_MpEndscreenSavePlayerMenuDialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+81
-37
@@ -28,6 +28,9 @@
|
|||||||
#include "lib/lib_317f0.h"
|
#include "lib/lib_317f0.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
#include "net/net.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// bss
|
// bss
|
||||||
struct chrdata *g_MpAllChrPtrs[MAX_MPCHRS];
|
struct chrdata *g_MpAllChrPtrs[MAX_MPCHRS];
|
||||||
@@ -35,7 +38,7 @@ struct mpchrconfig *g_MpAllChrConfigPtrs[MAX_MPCHRS];
|
|||||||
s32 g_MpNumChrs;
|
s32 g_MpNumChrs;
|
||||||
u32 var800ac534;
|
u32 var800ac534;
|
||||||
struct mpbotconfig g_BotConfigsArray[MAX_BOTS];
|
struct mpbotconfig g_BotConfigsArray[MAX_BOTS];
|
||||||
u8 g_MpSimulantDifficultiesPerNumPlayers[MAX_BOTS][MAX_PLAYERS];
|
u8 g_MpSimulantDifficultiesPerNumPlayers[MAX_BOTS][MAX_LOCAL_PLAYERS];
|
||||||
struct mpplayerconfig g_PlayerConfigsArray[MAX_MPPLAYERCONFIGS];
|
struct mpplayerconfig g_PlayerConfigsArray[MAX_MPPLAYERCONFIGS];
|
||||||
u8 g_AmBotCommands[9];
|
u8 g_AmBotCommands[9];
|
||||||
struct mpsetup g_MpSetup;
|
struct mpsetup g_MpSetup;
|
||||||
@@ -132,7 +135,7 @@ struct mpweapon g_MpWeapons[NUM_MPWEAPONS] = {
|
|||||||
.crosshairhealth = CROSSHAIR_HEALTH_OFF, \
|
.crosshairhealth = CROSSHAIR_HEALTH_OFF, \
|
||||||
}
|
}
|
||||||
|
|
||||||
struct extplayerconfig g_PlayerExtCfg[MAX_PLAYERS] = {
|
struct extplayerconfig g_PlayerExtCfg[MAX_LOCAL_PLAYERS] = {
|
||||||
PLAYER_EXT_CFG_DEFAULT,
|
PLAYER_EXT_CFG_DEFAULT,
|
||||||
PLAYER_EXT_CFG_DEFAULT,
|
PLAYER_EXT_CFG_DEFAULT,
|
||||||
PLAYER_EXT_CFG_DEFAULT,
|
PLAYER_EXT_CFG_DEFAULT,
|
||||||
@@ -147,11 +150,18 @@ struct extplayerconfig g_PlayerExtCfg[MAX_PLAYERS] = {
|
|||||||
* value 0 will return 0.1
|
* value 0 will return 0.1
|
||||||
* value 127 will return 1
|
* value 127 will return 1
|
||||||
* value 255 will return 10
|
* value 255 will return 10
|
||||||
|
* in a netgame it's always 1
|
||||||
*/
|
*/
|
||||||
f32 mpHandicapToDamageScale(u8 value)
|
f32 mpHandicapToDamageScale(u8 value)
|
||||||
{
|
{
|
||||||
f32 tmp;
|
f32 tmp;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode) {
|
||||||
|
return 1.f;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (value < 127) {
|
if (value < 127) {
|
||||||
return (value / 127.0f) * (value / 127.0f) * 0.9f + 0.1f;
|
return (value / 127.0f) * (value / 127.0f) * 0.9f + 0.1f;
|
||||||
}
|
}
|
||||||
@@ -184,10 +194,25 @@ void mpStartMatch(void)
|
|||||||
s32 numplayers = 0;
|
s32 numplayers = 0;
|
||||||
s32 stagenum;
|
s32 stagenum;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
g_MpSetup.chrslots &= 0xff00;
|
||||||
|
g_MpSetup.chrslots |= 1;
|
||||||
|
s32 slot = 1;
|
||||||
|
for (s32 i = 1; i < g_NetMaxClients; ++i) {
|
||||||
|
if (g_NetClients[i].state >= CLSTATE_LOBBY) {
|
||||||
|
g_MpSetup.chrslots |= (1 << slot);
|
||||||
|
++slot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_NetMode != NETMODE_CLIENT)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
if (g_MpSetup.options & MPOPTION_AUTORANDOMWEAPON_START) {
|
if (g_MpSetup.options & MPOPTION_AUTORANDOMWEAPON_START) {
|
||||||
if (g_MpWeaponSetNum == WEAPONSET_RANDOM
|
if (g_MpWeaponSetNum == WEAPONSET_RANDOM || g_MpWeaponSetNum == WEAPONSET_RANDOMFIVE) {
|
||||||
|| g_MpWeaponSetNum == WEAPONSET_RANDOMFIVE) {
|
|
||||||
mpApplyWeaponSet();
|
mpApplyWeaponSet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,6 +227,7 @@ void mpStartMatch(void)
|
|||||||
if (!challengeIsFeatureUnlocked(MPFEATURE_SLOWMOTION)) {
|
if (!challengeIsFeatureUnlocked(MPFEATURE_SLOWMOTION)) {
|
||||||
g_MpSetup.options &= ~(MPOPTION_SLOWMOTION_ON | MPOPTION_SLOWMOTION_SMART);
|
g_MpSetup.options &= ~(MPOPTION_SLOWMOTION_ON | MPOPTION_SLOWMOTION_SMART);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (g_MpSetup.chrslots & (1 << i)) {
|
if (g_MpSetup.chrslots & (1 << i)) {
|
||||||
@@ -243,7 +269,15 @@ void mpReset(void)
|
|||||||
g_Vars.lvmpbotlevel = true;
|
g_Vars.lvmpbotlevel = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
|
#ifdef PLATFORM_N64
|
||||||
|
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
|
||||||
|
#else
|
||||||
|
// Counter-Operative now uses a different approach which allows more than 2 players.
|
||||||
|
// Co-Operative, on the other hand, is currently limited to 2 players.
|
||||||
|
// Due to the change in approach, it's better to ignore 2.x controls for Counter-Operative.
|
||||||
|
if (g_Vars.coopplayernum >= 0)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
struct mpplayerconfig tmp;
|
struct mpplayerconfig tmp;
|
||||||
|
|
||||||
tmp = g_PlayerConfigsArray[MAX_PLAYERS];
|
tmp = g_PlayerConfigsArray[MAX_PLAYERS];
|
||||||
@@ -426,7 +460,7 @@ void mpPlayerSetDefaults(s32 playernum, bool autonames)
|
|||||||
g_PlayerConfigsArray[playernum].controlmode = CONTROLMODE_11;
|
g_PlayerConfigsArray[playernum].controlmode = CONTROLMODE_11;
|
||||||
|
|
||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
if (g_PlayerExtCfg[playernum % MAX_PLAYERS].extcontrols) {
|
if (g_PlayerExtCfg[playernum % MAX_LOCAL_PLAYERS].extcontrols) {
|
||||||
g_PlayerConfigsArray[playernum].controlmode = CONTROLMODE_PC;
|
g_PlayerConfigsArray[playernum].controlmode = CONTROLMODE_PC;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -494,9 +528,9 @@ void mpPlayerSetDefaults(s32 playernum, bool autonames)
|
|||||||
g_PlayerConfigsArray[playernum].survivormedals = 0;
|
g_PlayerConfigsArray[playernum].survivormedals = 0;
|
||||||
g_PlayerConfigsArray[playernum].title = MPPLAYERTITLE_BEGINNER;
|
g_PlayerConfigsArray[playernum].title = MPPLAYERTITLE_BEGINNER;
|
||||||
|
|
||||||
if (playernum < MAX_PLAYERS) {
|
if (playernum < MAX_LOCAL_PLAYERS) {
|
||||||
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
||||||
for (j = 1; j <= MAX_PLAYERS; j++) {
|
for (j = 1; j <= MAX_LOCAL_PLAYERS; j++) {
|
||||||
challengeSetCompletedByPlayerWithNumPlayers(playernum, i, j, false);
|
challengeSetCompletedByPlayerWithNumPlayers(playernum, i, j, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1324,7 +1358,7 @@ Gfx *mpRenderModalText(Gfx *gdl)
|
|||||||
&& g_Vars.currentplayer->redbloodfinished
|
&& g_Vars.currentplayer->redbloodfinished
|
||||||
&& g_Vars.currentplayer->deathanimfinished
|
&& g_Vars.currentplayer->deathanimfinished
|
||||||
&& !(g_Vars.coopplayernum >= 0 && ((g_Vars.bond->isdead && g_Vars.coop->isdead) || !g_Vars.currentplayer->coopcanrestart || g_InCutscene))
|
&& !(g_Vars.coopplayernum >= 0 && ((g_Vars.bond->isdead && g_Vars.coop->isdead) || !g_Vars.currentplayer->coopcanrestart || g_InCutscene))
|
||||||
&& !(g_Vars.antiplayernum >= 0 && ((g_Vars.currentplayer != g_Vars.anti || g_InCutscene)))
|
&& !(g_Vars.antiplayernum >= 0 && ((PLAYER_IS_NOT_ANTI(g_Vars.currentplayer) || g_InCutscene)))
|
||||||
&& g_NumReasonsToEndMpMatch == 0) {
|
&& g_NumReasonsToEndMpMatch == 0) {
|
||||||
// Render "Press START" text
|
// Render "Press START" text
|
||||||
gdl = text0f153628(gdl);
|
gdl = text0f153628(gdl);
|
||||||
@@ -2472,12 +2506,14 @@ void mpEndMatch(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode != NETMODE_CLIENT) {
|
||||||
if (g_MpSetup.options & MPOPTION_AUTORANDOMWEAPON_END) {
|
if (g_MpSetup.options & MPOPTION_AUTORANDOMWEAPON_END) {
|
||||||
if (g_MpWeaponSetNum == WEAPONSET_RANDOM
|
if (g_MpWeaponSetNum == WEAPONSET_RANDOM
|
||||||
|| g_MpWeaponSetNum == WEAPONSET_RANDOMFIVE) {
|
|| g_MpWeaponSetNum == WEAPONSET_RANDOMFIVE) {
|
||||||
mpApplyWeaponSet();
|
mpApplyWeaponSet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
func0f0f820c(NULL, -6);
|
func0f0f820c(NULL, -6);
|
||||||
@@ -2637,10 +2673,10 @@ void mpFindUnusedHeadAndBody(u8 *mpheadnum, u8 *mpbodynum)
|
|||||||
|
|
||||||
s32 mpChooseRandomLockPlayer(void)
|
s32 mpChooseRandomLockPlayer(void)
|
||||||
{
|
{
|
||||||
s32 start = random() % 4;
|
s32 start = random() % MAX_PLAYERS;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = (start + 1) % 4;; i = (i + 1) % 4) {
|
for (i = (start + 1) % MAX_PLAYERS;; i = (i + 1) % MAX_PLAYERS) {
|
||||||
if ((g_MpSetup.chrslots & (1 << i)) || i == start) {
|
if ((g_MpSetup.chrslots & (1 << i)) || i == start) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3084,11 +3120,11 @@ void mpCreateBotFromProfile(s32 botnum, u8 profilenum)
|
|||||||
g_BotConfigsArray[botnum].type = g_BotProfiles[profilenum].type;
|
g_BotConfigsArray[botnum].type = g_BotProfiles[profilenum].type;
|
||||||
g_BotConfigsArray[botnum].difficulty = g_BotProfiles[profilenum].difficulty;
|
g_BotConfigsArray[botnum].difficulty = g_BotProfiles[profilenum].difficulty;
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
g_MpSimulantDifficultiesPerNumPlayers[botnum][i] = g_BotConfigsArray[botnum].difficulty;
|
g_MpSimulantDifficultiesPerNumPlayers[botnum][i] = g_BotConfigsArray[botnum].difficulty;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_MpSetup.chrslots |= 1 << (botnum + 4);
|
g_MpSetup.chrslots |= 1 << (botnum + MAX_PLAYERS);
|
||||||
strcpy(g_BotConfigsArray[botnum].base.name, "Sim\n");
|
strcpy(g_BotConfigsArray[botnum].base.name, "Sim\n");
|
||||||
g_BotConfigsArray[botnum].base.team = team;
|
g_BotConfigsArray[botnum].base.team = team;
|
||||||
|
|
||||||
@@ -3117,7 +3153,7 @@ void mpSetBotDifficulty(s32 botnum, s32 difficulty)
|
|||||||
|
|
||||||
g_BotConfigsArray[botnum].difficulty = difficulty;
|
g_BotConfigsArray[botnum].difficulty = difficulty;
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
g_MpSimulantDifficultiesPerNumPlayers[botnum][i] = g_BotConfigsArray[botnum].difficulty;
|
g_MpSimulantDifficultiesPerNumPlayers[botnum][i] = g_BotConfigsArray[botnum].difficulty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3131,7 +3167,7 @@ s32 mpGetSlotForNewBot(void)
|
|||||||
{
|
{
|
||||||
s32 i = 0;
|
s32 i = 0;
|
||||||
|
|
||||||
while (i < MAX_BOTS - 1 && g_MpSetup.chrslots & (1 << (i + 4))) {
|
while (i < MAX_BOTS - 1 && g_MpSetup.chrslots & (1 << (i + MAX_PLAYERS))) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3140,7 +3176,7 @@ s32 mpGetSlotForNewBot(void)
|
|||||||
|
|
||||||
void mpRemoveSimulant(s32 index)
|
void mpRemoveSimulant(s32 index)
|
||||||
{
|
{
|
||||||
g_MpSetup.chrslots &= ~(1 << (index + 4));
|
g_MpSetup.chrslots &= ~(1 << (index + MAX_PLAYERS));
|
||||||
g_BotConfigsArray[index].base.name[0] = '\0';
|
g_BotConfigsArray[index].base.name[0] = '\0';
|
||||||
func0f1881d4(index);
|
func0f1881d4(index);
|
||||||
mpGenerateBotNames();
|
mpGenerateBotNames();
|
||||||
@@ -3148,7 +3184,11 @@ void mpRemoveSimulant(s32 index)
|
|||||||
|
|
||||||
bool mpHasSimulants(void)
|
bool mpHasSimulants(void)
|
||||||
{
|
{
|
||||||
|
#if MAX_PLAYERS > 4
|
||||||
|
if ((g_MpSetup.chrslots & 0xff00) != 0) {
|
||||||
|
#else
|
||||||
if ((g_MpSetup.chrslots & 0xfff0) != 0) {
|
if ((g_MpSetup.chrslots & 0xfff0) != 0) {
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3160,7 +3200,7 @@ bool mpHasUnusedBotSlots(void)
|
|||||||
s32 numvacant = challengeIsFeatureUnlocked(MPFEATURE_8BOTS) ? MAX_BOTS : 4;
|
s32 numvacant = challengeIsFeatureUnlocked(MPFEATURE_8BOTS) ? MAX_BOTS : 4;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 4; i < MAX_MPCHRS; i++) {
|
for (i = MAX_PLAYERS; i < MAX_MPCHRS; i++) {
|
||||||
if (g_MpSetup.chrslots & (1 << i)) {
|
if (g_MpSetup.chrslots & (1 << i)) {
|
||||||
numvacant--;
|
numvacant--;
|
||||||
}
|
}
|
||||||
@@ -3178,9 +3218,9 @@ bool mpIsSimSlotEnabled(s32 slot)
|
|||||||
s32 numfree = MAX_BOTS;
|
s32 numfree = MAX_BOTS;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
if ((g_MpSetup.chrslots & (1 << (slot + 4))) == 0) {
|
if ((g_MpSetup.chrslots & (1 << (slot + MAX_PLAYERS))) == 0) {
|
||||||
for (i = 0; i < MAX_BOTS; i++) {
|
for (i = 0; i < MAX_BOTS; i++) {
|
||||||
if (g_MpSetup.chrslots & (1 << (i + 4))) {
|
if (g_MpSetup.chrslots & (1 << (i + MAX_PLAYERS))) {
|
||||||
numfree--;
|
numfree--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3232,9 +3272,9 @@ void mpGenerateBotNames(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Count the number of bots using each profile (MeatSim, TurtleSim etc)
|
// Count the number of bots using each profile (MeatSim, TurtleSim etc)
|
||||||
for (i = 4; i < MAX_MPCHRS; i++) {
|
for (i = MAX_PLAYERS; i < MAX_MPCHRS; i++) {
|
||||||
if (g_MpSetup.chrslots & (1 << i)) {
|
if (g_MpSetup.chrslots & (1 << i)) {
|
||||||
profilenum = mpFindBotProfile(g_BotConfigsArray[i - 4].type, g_BotConfigsArray[i - 4].difficulty);
|
profilenum = mpFindBotProfile(g_BotConfigsArray[i - MAX_PLAYERS].type, g_BotConfigsArray[i - MAX_PLAYERS].difficulty);
|
||||||
|
|
||||||
if (profilenum >= 0 && profilenum < ARRAYCOUNT(g_BotProfiles)) {
|
if (profilenum >= 0 && profilenum < ARRAYCOUNT(g_BotProfiles)) {
|
||||||
counts[profilenum]++;
|
counts[profilenum]++;
|
||||||
@@ -3253,20 +3293,20 @@ void mpGenerateBotNames(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 4; i < MAX_MPCHRS; i++) {
|
for (i = MAX_PLAYERS; i < MAX_MPCHRS; i++) {
|
||||||
if (g_MpSetup.chrslots & (1 << i)) {
|
if (g_MpSetup.chrslots & (1 << i)) {
|
||||||
profilenum = mpFindBotProfile(g_BotConfigsArray[i - 4].type, g_BotConfigsArray[i - 4].difficulty);
|
profilenum = mpFindBotProfile(g_BotConfigsArray[i - MAX_PLAYERS].type, g_BotConfigsArray[i - MAX_PLAYERS].difficulty);
|
||||||
|
|
||||||
if (profilenum >= 0 && profilenum < ARRAYCOUNT(g_BotProfiles)) {
|
if (profilenum >= 0 && profilenum < ARRAYCOUNT(g_BotProfiles)) {
|
||||||
if (counts[profilenum] >= 0) {
|
if (counts[profilenum] >= 0) {
|
||||||
// Multiple bots using this profile - append the number
|
// Multiple bots using this profile - append the number
|
||||||
counts[profilenum]++;
|
counts[profilenum]++;
|
||||||
sprintf(name, "%s:%d\n", langGet(g_BotProfiles[profilenum].name), counts[profilenum]);
|
sprintf(name, "%s:%d\n", langGet(g_BotProfiles[profilenum].name), counts[profilenum]);
|
||||||
strcpy(g_BotConfigsArray[i - 4].base.name, name);
|
strcpy(g_BotConfigsArray[i - MAX_PLAYERS].base.name, name);
|
||||||
} else {
|
} else {
|
||||||
// One bots using this profile - just use the profile name
|
// One bots using this profile - just use the profile name
|
||||||
sprintf(name, "%s\n", langGet(g_BotProfiles[profilenum].name));
|
sprintf(name, "%s\n", langGet(g_BotProfiles[profilenum].name));
|
||||||
strcpy(g_BotConfigsArray[i - 4].base.name, name);
|
strcpy(g_BotConfigsArray[i - MAX_PLAYERS].base.name, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3315,7 +3355,7 @@ s32 func0f18d074(s32 index)
|
|||||||
|
|
||||||
for (i = 0; i < MAX_BOTS; i++) {
|
for (i = 0; i < MAX_BOTS; i++) {
|
||||||
if (&g_BotConfigsArray[i].base == g_MpAllChrConfigPtrs[index]) {
|
if (&g_BotConfigsArray[i].base == g_MpAllChrConfigPtrs[index]) {
|
||||||
return i + 4;
|
return i + MAX_PLAYERS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3437,13 +3477,13 @@ void mpplayerfileLoadWad(s32 playernum, struct savebuffer *buffer, s32 arg2)
|
|||||||
|
|
||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
// override with PC controls if enabled in the config
|
// override with PC controls if enabled in the config
|
||||||
if (g_PlayerExtCfg[playernum % MAX_PLAYERS].extcontrols) {
|
if (g_PlayerExtCfg[playernum % MAX_LOCAL_PLAYERS].extcontrols) {
|
||||||
g_PlayerConfigsArray[playernum].controlmode = CONTROLMODE_PC;
|
g_PlayerConfigsArray[playernum].controlmode = CONTROLMODE_PC;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
||||||
for (j = 1; j < MAX_PLAYERS + 1; j++) {
|
for (j = 1; j < MAX_LOCAL_PLAYERS + 1; j++) {
|
||||||
challengeSetCompletedByPlayerWithNumPlayers(playernum, i, j, savebufferReadBits(buffer, 1));
|
challengeSetCompletedByPlayerWithNumPlayers(playernum, i, j, savebufferReadBits(buffer, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3583,7 +3623,7 @@ void mpplayerfileSaveWad(s32 playernum, struct savebuffer *buffer)
|
|||||||
savebufferOr(buffer, g_PlayerConfigsArray[playernum].options, 12);
|
savebufferOr(buffer, g_PlayerConfigsArray[playernum].options, 12);
|
||||||
|
|
||||||
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
||||||
for (j = 1; j < MAX_PLAYERS + 1; j++) {
|
for (j = 1; j < MAX_LOCAL_PLAYERS + 1; j++) {
|
||||||
savebufferOr(buffer, challengeIsCompletedByPlayerWithNumPlayers(playernum, i, j), 1);
|
savebufferOr(buffer, challengeIsCompletedByPlayerWithNumPlayers(playernum, i, j), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3772,7 +3812,7 @@ void mpApplyConfig(struct mpconfigfull *config)
|
|||||||
for (i = 0; i < MAX_BOTS; i++) {
|
for (i = 0; i < MAX_BOTS; i++) {
|
||||||
g_BotConfigsArray[i].type = config->config.simulants[i].type;
|
g_BotConfigsArray[i].type = config->config.simulants[i].type;
|
||||||
|
|
||||||
for (j = 0; j < MAX_PLAYERS; j++) {
|
for (j = 0; j < MAX_LOCAL_PLAYERS; j++) {
|
||||||
g_MpSimulantDifficultiesPerNumPlayers[i][j] = config->config.simulants[i].difficulties[j];
|
g_MpSimulantDifficultiesPerNumPlayers[i][j] = config->config.simulants[i].difficulties[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3829,11 +3869,15 @@ void mp0f18dec4(s32 slot)
|
|||||||
mpApplyConfig(config);
|
mpApplyConfig(config);
|
||||||
|
|
||||||
#if VERSION >= VERSION_JPN_FINAL
|
#if VERSION >= VERSION_JPN_FINAL
|
||||||
|
#if MAX_PLAYERS > 4
|
||||||
|
g_MpSetup.chrslots &= 0xff;
|
||||||
|
#else
|
||||||
g_MpSetup.chrslots &= 0x0f;
|
g_MpSetup.chrslots &= 0x0f;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < MAX_BOTS; i++) {
|
for (i = 0; i < MAX_BOTS; i++) {
|
||||||
if (g_BotConfigsArray[i].difficulty != BOTDIFF_DISABLED) {
|
if (g_BotConfigsArray[i].difficulty != BOTDIFF_DISABLED) {
|
||||||
g_MpSetup.chrslots |= 1 << (i + 4);
|
g_MpSetup.chrslots |= 1 << (i + MAX_PLAYERS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -3861,12 +3905,12 @@ void mpsetupfileLoadWad(struct savebuffer *buffer)
|
|||||||
g_BotConfigsArray[i].type = savebufferReadBits(buffer, 5);
|
g_BotConfigsArray[i].type = savebufferReadBits(buffer, 5);
|
||||||
g_BotConfigsArray[i].difficulty = savebufferReadBits(buffer, 3);
|
g_BotConfigsArray[i].difficulty = savebufferReadBits(buffer, 3);
|
||||||
|
|
||||||
for (j = 0; j < MAX_PLAYERS; j++) {
|
for (j = 0; j < MAX_LOCAL_PLAYERS; j++) {
|
||||||
g_MpSimulantDifficultiesPerNumPlayers[i][j] = g_BotConfigsArray[i].difficulty;
|
g_MpSimulantDifficultiesPerNumPlayers[i][j] = g_BotConfigsArray[i].difficulty;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_BotConfigsArray[i].difficulty != BOTDIFF_DISABLED) {
|
if (g_BotConfigsArray[i].difficulty != BOTDIFF_DISABLED) {
|
||||||
g_MpSetup.chrslots |= 1 << (i + 4);
|
g_MpSetup.chrslots |= 1 << (i + MAX_PLAYERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_BotConfigsArray[i].base.mpheadnum = savebufferReadBits(buffer, 7);
|
g_BotConfigsArray[i].base.mpheadnum = savebufferReadBits(buffer, 7);
|
||||||
@@ -3886,7 +3930,7 @@ void mpsetupfileLoadWad(struct savebuffer *buffer)
|
|||||||
g_MpSetup.scorelimit = savebufferReadBits(buffer, 7);
|
g_MpSetup.scorelimit = savebufferReadBits(buffer, 7);
|
||||||
g_MpSetup.teamscorelimit = savebufferReadBits(buffer, 9);
|
g_MpSetup.teamscorelimit = savebufferReadBits(buffer, 9);
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
g_PlayerConfigsArray[i].base.team = savebufferReadBits(buffer, 3);
|
g_PlayerConfigsArray[i].base.team = savebufferReadBits(buffer, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3902,7 +3946,7 @@ void mpsetupfileSaveWad(struct savebuffer *buffer)
|
|||||||
func0f0d55a4(buffer, g_MpSetup.name);
|
func0f0d55a4(buffer, g_MpSetup.name);
|
||||||
|
|
||||||
for (i = 0; i < MAX_BOTS; i++) {
|
for (i = 0; i < MAX_BOTS; i++) {
|
||||||
if (g_MpSetup.chrslots & (1 << (i + 4))) {
|
if (g_MpSetup.chrslots & (1 << (i + MAX_PLAYERS))) {
|
||||||
numsims++;
|
numsims++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3918,7 +3962,7 @@ void mpsetupfileSaveWad(struct savebuffer *buffer)
|
|||||||
for (i = 0; i < MAX_BOTS; i++) {
|
for (i = 0; i < MAX_BOTS; i++) {
|
||||||
savebufferOr(buffer, g_BotConfigsArray[i].type, 5);
|
savebufferOr(buffer, g_BotConfigsArray[i].type, 5);
|
||||||
|
|
||||||
if (g_MpSetup.chrslots & (1 << (i + 4))) {
|
if (g_MpSetup.chrslots & (1 << (i + MAX_PLAYERS))) {
|
||||||
savebufferOr(buffer, g_BotConfigsArray[i].difficulty, 3);
|
savebufferOr(buffer, g_BotConfigsArray[i].difficulty, 3);
|
||||||
} else {
|
} else {
|
||||||
savebufferOr(buffer, BOTDIFF_DISABLED, 3);
|
savebufferOr(buffer, BOTDIFF_DISABLED, 3);
|
||||||
@@ -3950,7 +3994,7 @@ void mpsetupfileSaveWad(struct savebuffer *buffer)
|
|||||||
savebufferOr(buffer, g_MpSetup.scorelimit, 7);
|
savebufferOr(buffer, g_MpSetup.scorelimit, 7);
|
||||||
savebufferOr(buffer, g_MpSetup.teamscorelimit, 9);
|
savebufferOr(buffer, g_MpSetup.teamscorelimit, 9);
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
savebufferOr(buffer, g_PlayerConfigsArray[i].base.team, 3);
|
savebufferOr(buffer, g_PlayerConfigsArray[i].base.team, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1038,7 +1038,7 @@ struct prop *scenarioCreateObj(s32 modelnum, s16 padnum, f32 arg2, u32 flags, u3
|
|||||||
*/
|
*/
|
||||||
void scenarioCreateHudmsg(s32 playernum, char *message)
|
void scenarioCreateHudmsg(s32 playernum, char *message)
|
||||||
{
|
{
|
||||||
if (playernum >= 0 && playernum < PLAYERCOUNT()) {
|
if (playernum >= 0 && playernum < LOCALPLAYERCOUNT()) {
|
||||||
s32 prevplayernum = g_Vars.currentplayernum;
|
s32 prevplayernum = g_Vars.currentplayernum;
|
||||||
|
|
||||||
setCurrentPlayerNum(playernum);
|
setCurrentPlayerNum(playernum);
|
||||||
|
|||||||
@@ -23,6 +23,9 @@
|
|||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "gbiex.h"
|
#include "gbiex.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
#include "net/net.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
struct menuitem g_MpCharacterMenuItems[];
|
struct menuitem g_MpCharacterMenuItems[];
|
||||||
struct menudialogdef g_MpAddSimulantMenuDialog;
|
struct menudialogdef g_MpAddSimulantMenuDialog;
|
||||||
@@ -2226,7 +2229,7 @@ MenuItemHandlerResult mpLoadPlayerMenuHandler(s32 operation, struct menuitem *it
|
|||||||
file = &g_FileLists[0]->files[data->list.value];
|
file = &g_FileLists[0]->files[data->list.value];
|
||||||
available = true;
|
available = true;
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
if (file->fileid == g_PlayerConfigsArray[i].fileguid.fileid
|
if (file->fileid == g_PlayerConfigsArray[i].fileguid.fileid
|
||||||
&& file->deviceserial == g_PlayerConfigsArray[i].fileguid.deviceserial) {
|
&& file->deviceserial == g_PlayerConfigsArray[i].fileguid.deviceserial) {
|
||||||
if ((g_MpSetup.chrslots & (1 << i)) == 0) {
|
if ((g_MpSetup.chrslots & (1 << i)) == 0) {
|
||||||
@@ -2357,6 +2360,15 @@ MenuItemHandlerResult menuhandlerMpHandicapPlayer(s32 operation, struct menuitem
|
|||||||
char *mpMenuTextHandicapPlayerName(struct menuitem *item)
|
char *mpMenuTextHandicapPlayerName(struct menuitem *item)
|
||||||
{
|
{
|
||||||
if (g_MpSetup.chrslots & (1 << item->param)) {
|
if (g_MpSetup.chrslots & (1 << item->param)) {
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode) {
|
||||||
|
// use client names directly, as the config names are not set yet
|
||||||
|
struct netclient *cl = netClientForPlayerNum(item->param);
|
||||||
|
if (cl) {
|
||||||
|
return cl->settings.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return g_PlayerConfigsArray[item->param].base.name;
|
return g_PlayerConfigsArray[item->param].base.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2658,6 +2670,40 @@ struct menuitem g_MpHandicapsMenuItems[] = {
|
|||||||
0x000000ff,
|
0x000000ff,
|
||||||
menuhandlerMpHandicapPlayer,
|
menuhandlerMpHandicapPlayer,
|
||||||
},
|
},
|
||||||
|
#if MAX_PLAYERS > 4
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SLIDER,
|
||||||
|
4,
|
||||||
|
MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_LOCKABLEMINOR,
|
||||||
|
(uintptr_t)&mpMenuTextHandicapPlayerName,
|
||||||
|
0x000000ff,
|
||||||
|
menuhandlerMpHandicapPlayer,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SLIDER,
|
||||||
|
5,
|
||||||
|
MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_LOCKABLEMINOR,
|
||||||
|
(uintptr_t)&mpMenuTextHandicapPlayerName,
|
||||||
|
0x000000ff,
|
||||||
|
menuhandlerMpHandicapPlayer,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SLIDER,
|
||||||
|
6,
|
||||||
|
MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_LOCKABLEMINOR,
|
||||||
|
(uintptr_t)&mpMenuTextHandicapPlayerName,
|
||||||
|
0x000000ff,
|
||||||
|
menuhandlerMpHandicapPlayer,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MENUITEMTYPE_SLIDER,
|
||||||
|
7,
|
||||||
|
MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_LOCKABLEMINOR,
|
||||||
|
(uintptr_t)&mpMenuTextHandicapPlayerName,
|
||||||
|
0x000000ff,
|
||||||
|
menuhandlerMpHandicapPlayer,
|
||||||
|
},
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
MENUITEMTYPE_SEPARATOR,
|
MENUITEMTYPE_SEPARATOR,
|
||||||
0,
|
0,
|
||||||
@@ -2756,7 +2802,7 @@ MenuItemHandlerResult mpAddChangeSimulantMenuHandler(s32 operation, struct menui
|
|||||||
if (botnum < 0) {
|
if (botnum < 0) {
|
||||||
botnum = mpGetSlotForNewBot();
|
botnum = mpGetSlotForNewBot();
|
||||||
creating = 1;
|
creating = 1;
|
||||||
} else if ((g_MpSetup.chrslots & (1 << (botnum + 4))) == 0) {
|
} else if ((g_MpSetup.chrslots & (1 << (botnum + MAX_PLAYERS))) == 0) {
|
||||||
creating = 1;
|
creating = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2996,7 +3042,7 @@ MenuItemHandlerResult menuhandlerMpSimulantSlot(s32 operation, struct menuitem *
|
|||||||
case MENUOP_SET:
|
case MENUOP_SET:
|
||||||
g_Menus[g_MpPlayerNum].mpsetup.slotindex = item->param;
|
g_Menus[g_MpPlayerNum].mpsetup.slotindex = item->param;
|
||||||
|
|
||||||
if ((g_MpSetup.chrslots & (1 << (item->param + 4))) == 0) {
|
if ((g_MpSetup.chrslots & (1 << (item->param + MAX_PLAYERS))) == 0) {
|
||||||
menuPushDialog(&g_MpAddSimulantMenuDialog);
|
menuPushDialog(&g_MpAddSimulantMenuDialog);
|
||||||
} else if (IS4MB()) {
|
} else if (IS4MB()) {
|
||||||
menuPushDialog(&g_MpEditSimulant4MbMenuDialog);
|
menuPushDialog(&g_MpEditSimulant4MbMenuDialog);
|
||||||
@@ -3022,7 +3068,7 @@ char *mpMenuTextSimulantName(struct menuitem *item)
|
|||||||
{
|
{
|
||||||
s32 index = item->param;
|
s32 index = item->param;
|
||||||
|
|
||||||
if (g_BotConfigsArray[index].base.name[0] == '\0' || (g_MpSetup.chrslots & 1 << (index + 4)) == 0) {
|
if (g_BotConfigsArray[index].base.name[0] == '\0' || (g_MpSetup.chrslots & 1 << (index + MAX_PLAYERS)) == 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3034,7 +3080,7 @@ char *func0f17d3dc(struct menuitem *item)
|
|||||||
s32 index = item->param;
|
s32 index = item->param;
|
||||||
|
|
||||||
if (g_BotConfigsArray[index].base.name[0] == '\0'
|
if (g_BotConfigsArray[index].base.name[0] == '\0'
|
||||||
|| ((g_MpSetup.chrslots & 1 << (index + 4)) == 0)) {
|
|| ((g_MpSetup.chrslots & 1 << (index + MAX_PLAYERS)) == 0)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3422,7 +3468,7 @@ MenuItemHandlerResult menuhandlerMpHumansVsSimulants(s32 operation, struct menui
|
|||||||
if (g_MpSetup.chrslots & (1 << i)) {
|
if (g_MpSetup.chrslots & (1 << i)) {
|
||||||
struct mpchrconfig *mpchr = MPCHR(i);
|
struct mpchrconfig *mpchr = MPCHR(i);
|
||||||
|
|
||||||
mpchr->team = i < 4 ? 0 : 1;
|
mpchr->team = i < MAX_PLAYERS ? 0 : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3435,7 +3481,7 @@ MenuItemHandlerResult menuhandlerMpHumansVsSimulants(s32 operation, struct menui
|
|||||||
MenuItemHandlerResult menuhandlerMpHumanSimulantPairs(s32 operation, struct menuitem *item, union handlerdata *data)
|
MenuItemHandlerResult menuhandlerMpHumanSimulantPairs(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||||
{
|
{
|
||||||
if (operation == MENUOP_SET) {
|
if (operation == MENUOP_SET) {
|
||||||
u8 team_ids[4] = {0, 1, 2, 3};
|
u8 team_ids[MAX_PLAYERS] = {0, 1, 2, 3, 4, 5, 6, 7};
|
||||||
s32 i;
|
s32 i;
|
||||||
s32 playerindex = 0;
|
s32 playerindex = 0;
|
||||||
s32 simindex = 0;
|
s32 simindex = 0;
|
||||||
@@ -3444,7 +3490,7 @@ MenuItemHandlerResult menuhandlerMpHumanSimulantPairs(s32 operation, struct menu
|
|||||||
if (g_MpSetup.chrslots & (1 << i)) {
|
if (g_MpSetup.chrslots & (1 << i)) {
|
||||||
struct mpchrconfig *mpchr = MPCHR(i);
|
struct mpchrconfig *mpchr = MPCHR(i);
|
||||||
|
|
||||||
if (i < 4) {
|
if (i < MAX_PLAYERS) {
|
||||||
mpchr->team = team_ids[playerindex++];
|
mpchr->team = team_ids[playerindex++];
|
||||||
} else {
|
} else {
|
||||||
mpchr->team = team_ids[simindex++];
|
mpchr->team = team_ids[simindex++];
|
||||||
@@ -3467,6 +3513,15 @@ char *mpMenuTextChrNameForTeamSetup(struct menuitem *item)
|
|||||||
struct mpchrconfig *mpchr = mpGetChrConfigBySlotNum(item->param);
|
struct mpchrconfig *mpchr = mpGetChrConfigBySlotNum(item->param);
|
||||||
|
|
||||||
if (mpchr) {
|
if (mpchr) {
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode) {
|
||||||
|
// use client names directly, as the config names are not set yet
|
||||||
|
struct netclient *cl = netClientForPlayerNum(item->param);
|
||||||
|
if (cl) {
|
||||||
|
return cl->settings.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return mpchr->name;
|
return mpchr->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5213,7 +5268,7 @@ void mpCloseDialogsForNewSetup(void)
|
|||||||
s32 k;
|
s32 k;
|
||||||
|
|
||||||
// Loop through each player
|
// Loop through each player
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
g_MpPlayerNum = i;
|
g_MpPlayerNum = i;
|
||||||
|
|
||||||
// If they have a menu open
|
// If they have a menu open
|
||||||
|
|||||||
+2
-2
@@ -343,7 +343,7 @@ bool musicIsAnyPlayerInAmbientRoom(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < PLAYERCOUNT(); i++) {
|
for (i = 0; i < LOCALPLAYERCOUNT(); i++) {
|
||||||
if (g_Vars.players[i]->prop
|
if (g_Vars.players[i]->prop
|
||||||
&& g_Vars.players[i]->prop->rooms
|
&& g_Vars.players[i]->prop->rooms
|
||||||
&& g_Vars.players[i]->prop->rooms[0] != -1) {
|
&& g_Vars.players[i]->prop->rooms[0] != -1) {
|
||||||
@@ -521,7 +521,7 @@ void _musicStartMpDeath(f32 arg0)
|
|||||||
void musicStartMpDeath(void)
|
void musicStartMpDeath(void)
|
||||||
{
|
{
|
||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
if (g_MusicDisableMpDeath) {
|
if (g_MusicDisableMpDeath || (g_NetMode && g_Vars.currentplayernum != 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-1
@@ -319,7 +319,7 @@ Gfx *nbombCreateGdl(void)
|
|||||||
Gfx *gdl;
|
Gfx *gdl;
|
||||||
s32 index = 0;
|
s32 index = 0;
|
||||||
|
|
||||||
if (PLAYERCOUNT() >= 2) {
|
if (LOCALPLAYERCOUNT() >= 2) {
|
||||||
index = 1;
|
index = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -234,7 +234,7 @@ struct pak g_Paks[5]; // controller paks + EEPROM
|
|||||||
u32 var800a317c;
|
u32 var800a317c;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OSPfs g_Pfses[MAX_PLAYERS];
|
OSPfs g_Pfses[MAX_LOCAL_PLAYERS];
|
||||||
u32 var800a3320;
|
u32 var800a3320;
|
||||||
u32 var800a3324;
|
u32 var800a3324;
|
||||||
u32 var800a3328;
|
u32 var800a3328;
|
||||||
@@ -4421,7 +4421,7 @@ void pak0f11c6d0(void)
|
|||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
switch (g_Paks[i].state) {
|
switch (g_Paks[i].state) {
|
||||||
case PAKSTATE_PROBE:
|
case PAKSTATE_PROBE:
|
||||||
case PAKSTATE_MEM_DISPATCH:
|
case PAKSTATE_MEM_DISPATCH:
|
||||||
@@ -5437,14 +5437,14 @@ void pakDisableRumbleForAllPlayers(void)
|
|||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
if (g_Paks[i].type == PAKTYPE_RUMBLE) {
|
if (g_Paks[i].type == PAKTYPE_RUMBLE) {
|
||||||
g_Paks[i].rumblestate = RUMBLESTATE_DISABLED_STOPPING;
|
g_Paks[i].rumblestate = RUMBLESTATE_DISABLED_STOPPING;
|
||||||
joyStopRumble(i, true);
|
joyStopRumble(i, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
pakDisableRumbleForPlayer(i);
|
pakDisableRumbleForPlayer(i);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -5455,13 +5455,13 @@ void pakEnableRumbleForAllPlayers(void)
|
|||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
#if VERSION >= VERSION_NTSC_FINAL
|
#if VERSION >= VERSION_NTSC_FINAL
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
if (g_Paks[i].type == PAKTYPE_RUMBLE && g_Paks[i].rumblestate == RUMBLESTATE_DISABLED_STOPPED) {
|
if (g_Paks[i].type == PAKTYPE_RUMBLE && g_Paks[i].rumblestate == RUMBLESTATE_DISABLED_STOPPED) {
|
||||||
g_Paks[i].rumblestate = RUMBLESTATE_ENABLING;
|
g_Paks[i].rumblestate = RUMBLESTATE_ENABLING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
pakEnableRumbleForPlayer(i);
|
pakEnableRumbleForPlayer(i);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -5984,7 +5984,7 @@ bool gbpakIsAnyPerfectDark(void)
|
|||||||
{
|
{
|
||||||
s8 i;
|
s8 i;
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
if (gbpakIdentifyGame(i) == GBGAME_PD) {
|
if (gbpakIdentifyGame(i) == GBGAME_PD) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+138
-16
@@ -73,6 +73,8 @@
|
|||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
#include "net/net.h"
|
||||||
|
#include "net/netmsg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
s32 g_DefaultWeapons[2];
|
s32 g_DefaultWeapons[2];
|
||||||
@@ -182,7 +184,10 @@ u32 var80070748 = 0;
|
|||||||
u32 var8007074c = 0;
|
u32 var8007074c = 0;
|
||||||
|
|
||||||
bool g_PlayersWithControl[] = {
|
bool g_PlayersWithControl[] = {
|
||||||
|
true, true, true, true,
|
||||||
|
#if MAX_PLAYERS > 4
|
||||||
true, true, true, true
|
true, true, true, true
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
bool g_PlayerInvincible = false;
|
bool g_PlayerInvincible = false;
|
||||||
@@ -601,7 +606,7 @@ void playerStartNewLife(void)
|
|||||||
if (cmd);
|
if (cmd);
|
||||||
if (cmd);
|
if (cmd);
|
||||||
|
|
||||||
if (g_Vars.antiplayernum < 0 || g_Vars.currentplayer != g_Vars.anti) {
|
if (g_Vars.antiplayernum < 0 || PLAYER_IS_NOT_ANTI(g_Vars.currentplayer)) {
|
||||||
while (cmd[0] != INTROCMD_END) {
|
while (cmd[0] != INTROCMD_END) {
|
||||||
switch (cmd[0]) {
|
switch (cmd[0]) {
|
||||||
case INTROCMD_SPAWN:
|
case INTROCMD_SPAWN:
|
||||||
@@ -975,7 +980,7 @@ void playerSpawn(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (g_Vars.mplayerisrunning) {
|
if (g_Vars.mplayerisrunning) {
|
||||||
if (g_Vars.antiplayernum >= 0 && g_Vars.currentplayer == g_Vars.anti) {
|
if (g_Vars.antiplayernum >= 0 && PLAYER_IS_ANTI(g_Vars.currentplayer)) {
|
||||||
numsqdists = 0;
|
numsqdists = 0;
|
||||||
force = false;
|
force = false;
|
||||||
|
|
||||||
@@ -1133,6 +1138,12 @@ void playerSpawn(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
playerUpdatePerimInfo();
|
playerUpdatePerimInfo();
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER && g_Vars.currentplayer->client) {
|
||||||
|
netmsgSvcPlayerStatsWrite(&g_NetMsgRel, g_Vars.currentplayer->client);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void playerResetBond(struct playerbond *pb, struct coord *pos)
|
void playerResetBond(struct playerbond *pb, struct coord *pos)
|
||||||
@@ -1175,7 +1186,7 @@ void playerChooseBodyAndHead(s32 *bodynum, s32 *headnum, s32 *arg2)
|
|||||||
bool solo;
|
bool solo;
|
||||||
|
|
||||||
if (g_Vars.antiplayernum >= 0
|
if (g_Vars.antiplayernum >= 0
|
||||||
&& g_Vars.currentplayer == g_Vars.anti
|
&& PLAYER_IS_ANTI(g_Vars.currentplayer)
|
||||||
&& g_Vars.antiheadnum >= 0
|
&& g_Vars.antiheadnum >= 0
|
||||||
&& g_Vars.antibodynum >= 0) {
|
&& g_Vars.antibodynum >= 0) {
|
||||||
*headnum = g_Vars.antiheadnum;
|
*headnum = g_Vars.antiheadnum;
|
||||||
@@ -1507,7 +1518,7 @@ void playerTickChrBody(void)
|
|||||||
|
|
||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
if (g_Vars.antiplayernum >= 0
|
if (g_Vars.antiplayernum >= 0
|
||||||
&& g_Vars.currentplayer == g_Vars.anti
|
&& PLAYER_IS_ANTI(g_Vars.currentplayer)
|
||||||
&& g_Vars.currentplayer->vv_eyeheight > 159) {
|
&& g_Vars.currentplayer->vv_eyeheight > 159) {
|
||||||
g_Vars.currentplayer->vv_eyeheight = 159;
|
g_Vars.currentplayer->vv_eyeheight = 159;
|
||||||
}
|
}
|
||||||
@@ -2062,6 +2073,15 @@ void playerTickCutscene(bool arg0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_Vars.stagenum == STAGE_CITRAINING) {
|
||||||
|
if (g_CutsceneCurTotalFrame60f > 10 && (g_NetHostLatch || g_NetJoinLatch)) {
|
||||||
|
// just booted up and host/join was requested from command line, skip the intro cutscene
|
||||||
|
g_CutsceneSkipRequested = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
f32 playerGetCutsceneBlurFrac(void)
|
f32 playerGetCutsceneBlurFrac(void)
|
||||||
@@ -2832,6 +2852,12 @@ s16 playerGetFbHeight(void)
|
|||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
bool playerHasSharedViewport(void)
|
bool playerHasSharedViewport(void)
|
||||||
{
|
{
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
|
if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
|
||||||
&& menuGetRoot() == MENUROOT_MPENDSCREEN
|
&& menuGetRoot() == MENUROOT_MPENDSCREEN
|
||||||
&& var8009dfc0 == 0) {
|
&& var8009dfc0 == 0) {
|
||||||
@@ -2852,14 +2878,14 @@ s16 playerGetViewportWidth(void)
|
|||||||
if ((!g_InCutscene || g_MainIsEndscreen) && menuGetRoot() != MENUROOT_COOPCONTINUE)
|
if ((!g_InCutscene || g_MainIsEndscreen) && menuGetRoot() != MENUROOT_COOPCONTINUE)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (PLAYERCOUNT() >= 3) {
|
if (LOCALPLAYERCOUNT() >= 3) {
|
||||||
// 3/4 players
|
// 3/4 players
|
||||||
width = g_ViModes[g_ViRes].width / 2;
|
width = g_ViModes[g_ViRes].width / 2;
|
||||||
|
|
||||||
if (g_Vars.currentplayernum == 0 || g_Vars.currentplayernum == 2) {
|
if (g_Vars.currentplayernum == 0 || g_Vars.currentplayernum == 2) {
|
||||||
width--;
|
width--;
|
||||||
}
|
}
|
||||||
} else if (PLAYERCOUNT() == 2) {
|
} else if (LOCALPLAYERCOUNT() == 2) {
|
||||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || g_Vars.fourmeg2player) {
|
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || g_Vars.fourmeg2player) {
|
||||||
// 2 players vsplit
|
// 2 players vsplit
|
||||||
width = g_ViModes[g_ViRes].width / 2;
|
width = g_ViModes[g_ViRes].width / 2;
|
||||||
@@ -2892,7 +2918,7 @@ s16 playerGetViewportLeft(void)
|
|||||||
#endif
|
#endif
|
||||||
s16 left;
|
s16 left;
|
||||||
|
|
||||||
if (PLAYERCOUNT() >= 3 && something != 0) {
|
if (LOCALPLAYERCOUNT() >= 3 && something != 0) {
|
||||||
if (g_Vars.currentplayernum == 1 || g_Vars.currentplayernum == 3) {
|
if (g_Vars.currentplayernum == 1 || g_Vars.currentplayernum == 3) {
|
||||||
// 3/4 players - right side
|
// 3/4 players - right side
|
||||||
left = g_ViModes[g_ViRes].width / 2 + g_ViModes[g_ViRes].fbwidth - g_ViModes[g_ViRes].width;
|
left = g_ViModes[g_ViRes].width / 2 + g_ViModes[g_ViRes].fbwidth - g_ViModes[g_ViRes].width;
|
||||||
@@ -2900,7 +2926,7 @@ s16 playerGetViewportLeft(void)
|
|||||||
// 3/4 players - left side
|
// 3/4 players - left side
|
||||||
left = g_ViModes[g_ViRes].fbwidth - g_ViModes[g_ViRes].width;
|
left = g_ViModes[g_ViRes].fbwidth - g_ViModes[g_ViRes].width;
|
||||||
}
|
}
|
||||||
} else if (PLAYERCOUNT() == 2 && something != 0) {
|
} else if (LOCALPLAYERCOUNT() == 2 && something != 0) {
|
||||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || g_Vars.fourmeg2player) {
|
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || g_Vars.fourmeg2player) {
|
||||||
if (g_Vars.currentplayernum == 1) {
|
if (g_Vars.currentplayernum == 1) {
|
||||||
// 2 players vsplit - right side
|
// 2 players vsplit - right side
|
||||||
@@ -2925,7 +2951,7 @@ s16 playerGetViewportHeight(void)
|
|||||||
{
|
{
|
||||||
s16 height;
|
s16 height;
|
||||||
|
|
||||||
if (PLAYERCOUNT() >= 2
|
if (LOCALPLAYERCOUNT() >= 2
|
||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
&& !playerHasSharedViewport()
|
&& !playerHasSharedViewport()
|
||||||
#else
|
#else
|
||||||
@@ -2940,7 +2966,7 @@ s16 playerGetViewportHeight(void)
|
|||||||
height = tmp / 2;
|
height = tmp / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PLAYERCOUNT() == 2) {
|
if (LOCALPLAYERCOUNT() == 2) {
|
||||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||||
height = tmp;
|
height = tmp;
|
||||||
} else if (g_Vars.currentplayernum == 0 && IS8MB()) {
|
} else if (g_Vars.currentplayernum == 0 && IS8MB()) {
|
||||||
@@ -2976,7 +3002,7 @@ s16 playerGetViewportTop(void)
|
|||||||
{
|
{
|
||||||
s16 top;
|
s16 top;
|
||||||
|
|
||||||
if (PLAYERCOUNT() >= 2
|
if (LOCALPLAYERCOUNT() >= 2
|
||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
&& !playerHasSharedViewport()
|
&& !playerHasSharedViewport()
|
||||||
#else
|
#else
|
||||||
@@ -2987,12 +3013,12 @@ s16 playerGetViewportTop(void)
|
|||||||
top = g_ViModes[g_ViRes].fulltop;
|
top = g_ViModes[g_ViRes].fulltop;
|
||||||
|
|
||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
if (optionsGetScreenSplit() != SCREENSPLIT_VERTICAL || PLAYERCOUNT() != 2)
|
if (optionsGetScreenSplit() != SCREENSPLIT_VERTICAL || LOCALPLAYERCOUNT() != 2)
|
||||||
#else
|
#else
|
||||||
if (optionsGetScreenSplit() != SCREENSPLIT_VERTICAL)
|
if (optionsGetScreenSplit() != SCREENSPLIT_VERTICAL)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (PLAYERCOUNT() == 2
|
if (LOCALPLAYERCOUNT() == 2
|
||||||
&& g_Vars.currentplayernum == 1
|
&& g_Vars.currentplayernum == 1
|
||||||
&& optionsGetScreenSplit() != SCREENSPLIT_VERTICAL
|
&& optionsGetScreenSplit() != SCREENSPLIT_VERTICAL
|
||||||
&& !g_Vars.fourmeg2player) {
|
&& !g_Vars.fourmeg2player) {
|
||||||
@@ -3510,6 +3536,11 @@ void playerTick(bool arg0)
|
|||||||
bool pause = false;
|
bool pause = false;
|
||||||
f32 newspeed;
|
f32 newspeed;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (mode == CONTROLMODE_NA) {
|
||||||
|
// TODO
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
if (mode == CONTROLMODE_23
|
if (mode == CONTROLMODE_23
|
||||||
|| mode == CONTROLMODE_24
|
|| mode == CONTROLMODE_24
|
||||||
|| mode == CONTROLMODE_22
|
|| mode == CONTROLMODE_22
|
||||||
@@ -4678,8 +4709,15 @@ Gfx *playerRenderHud(Gfx *gdl)
|
|||||||
chr->chrflags |= CHRCFLAG_HIDDEN;
|
chr->chrflags |= CHRCFLAG_HIDDEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_Vars.antiplayernum >= 0 && g_Vars.currentplayer == g_Vars.anti) {
|
if (g_Vars.antiplayernum >= 0 && PLAYER_IS_ANTI(g_Vars.currentplayer)) {
|
||||||
// Anti
|
// Anti
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER && g_Vars.currentplayer->isremote) {
|
||||||
|
if (g_Vars.currentplayer->client->inmove[0].ucmd & UCMD_RESPAWN) {
|
||||||
|
g_Vars.currentplayer->dostartnewlife = true;
|
||||||
|
}
|
||||||
|
} else if (g_NetMode != NETMODE_CLIENT)
|
||||||
|
#endif
|
||||||
if (joyGetButtons(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000) && !mpIsPaused()) {
|
if (joyGetButtons(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000) && !mpIsPaused()) {
|
||||||
g_Vars.currentplayer->dostartnewlife = true;
|
g_Vars.currentplayer->dostartnewlife = true;
|
||||||
}
|
}
|
||||||
@@ -4693,8 +4731,12 @@ Gfx *playerRenderHud(Gfx *gdl)
|
|||||||
f32 stealhealth;
|
f32 stealhealth;
|
||||||
f32 shield;
|
f32 shield;
|
||||||
|
|
||||||
canrestart = joyGetButtons(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000)
|
#ifndef PLATFORM_N64
|
||||||
&& !mpIsPaused();
|
if (g_NetMode == NETMODE_SERVER && g_Vars.currentplayer->isremote) {
|
||||||
|
canrestart = (g_Vars.currentplayer->client->inmove[0].ucmd & UCMD_RESPAWN) != 0;
|
||||||
|
} else if (g_NetMode != NETMODE_CLIENT)
|
||||||
|
#endif
|
||||||
|
canrestart = joyGetButtons(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000) && !mpIsPaused();
|
||||||
|
|
||||||
// Get ready to respawn.
|
// Get ready to respawn.
|
||||||
// The other player's health will be halved.
|
// The other player's health will be halved.
|
||||||
@@ -4800,6 +4842,13 @@ Gfx *playerRenderHud(Gfx *gdl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER && g_Vars.currentplayer->isremote) {
|
||||||
|
if (!mpIsPaused() && g_NumReasonsToEndMpMatch == 0 && (g_Vars.currentplayer->client->inmove[0].ucmd & UCMD_RESPAWN)) {
|
||||||
|
canrestart = true;
|
||||||
|
}
|
||||||
|
} else if (g_NetMode != NETMODE_CLIENT)
|
||||||
|
#endif
|
||||||
if (joyGetButtons(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000)
|
if (joyGetButtons(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000)
|
||||||
&& !mpIsPaused()
|
&& !mpIsPaused()
|
||||||
&& g_NumReasonsToEndMpMatch == 0) {
|
&& g_NumReasonsToEndMpMatch == 0) {
|
||||||
@@ -4883,6 +4932,12 @@ void playerDie(bool force)
|
|||||||
struct chrdata *chr = g_Vars.currentplayer->prop->chr;
|
struct chrdata *chr = g_Vars.currentplayer->prop->chr;
|
||||||
s32 shooter;
|
s32 shooter;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (chr->lastshooter >= 0 && chr->timeshooter > 0) {
|
if (chr->lastshooter >= 0 && chr->timeshooter > 0) {
|
||||||
shooter = chr->lastshooter;
|
shooter = chr->lastshooter;
|
||||||
} else {
|
} else {
|
||||||
@@ -4890,6 +4945,12 @@ void playerDie(bool force)
|
|||||||
}
|
}
|
||||||
|
|
||||||
playerDieByShooter(shooter, force);
|
playerDieByShooter(shooter, force);
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER && g_Vars.currentplayer->client) {
|
||||||
|
netmsgSvcPlayerStatsWrite(&g_NetMsgRel, g_Vars.currentplayer->client);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void playerDieByShooter(u32 shooter, bool force)
|
void playerDieByShooter(u32 shooter, bool force)
|
||||||
@@ -5812,3 +5873,64 @@ void player0f0c3320(Mtxf *matrices, s32 count)
|
|||||||
mtxF2L(&sp40, matrices + i);
|
mtxF2L(&sp40, matrices + i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct sndstate *playerSndStart(s32 arg0, s16 sound, struct sndstate **handle, s32 playernum, f32 pitch, s32 fxbus, s32 fxmix)
|
||||||
|
{
|
||||||
|
s32 vol = -1;
|
||||||
|
s32 pan = -1;
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
const struct player *pl = g_Vars.players[playernum];
|
||||||
|
if (g_NetMode && playernum != 0 && pl && pl->prop) {
|
||||||
|
// auto attenuate sounds for remote players
|
||||||
|
psGetTheoreticalVolPan(&pl->prop->pos, pl->prop->rooms, sound, &vol, &pan);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return sndStart(arg0, sound, handle, vol, pan, pitch, fxbus, fxmix);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
|
||||||
|
f32 playerGetDefaultFovY(s32 playernum)
|
||||||
|
{
|
||||||
|
if (g_NetMode) {
|
||||||
|
const struct player *pl = g_Vars.players[playernum % MAX_PLAYERS];
|
||||||
|
if (pl && pl->client) {
|
||||||
|
return pl->client->settings.fovy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return g_PlayerExtCfg[playernum % MAX_LOCAL_PLAYERS].fovy;
|
||||||
|
}
|
||||||
|
|
||||||
|
f32 playerGetZoomFovMult(s32 playernum)
|
||||||
|
{
|
||||||
|
if (g_NetMode) {
|
||||||
|
const struct player *pl = g_Vars.players[playernum % MAX_PLAYERS];
|
||||||
|
if (pl && pl->client) {
|
||||||
|
return pl->client->settings.fovzoommult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return g_PlayerExtCfg[playernum % MAX_LOCAL_PLAYERS].fovzoommult;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 playerGetCount(void)
|
||||||
|
{
|
||||||
|
s32 count = 0;
|
||||||
|
for (s32 i = 0; i < MAX_PLAYERS; ++i) {
|
||||||
|
count += (g_Vars.players[i] != NULL);
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 playerGetLocalCount(void)
|
||||||
|
{
|
||||||
|
if (g_NetMode) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
const s32 playercount = playerGetCount();
|
||||||
|
if (playercount > MAX_LOCAL_PLAYERS) {
|
||||||
|
return MAX_LOCAL_PLAYERS;
|
||||||
|
}
|
||||||
|
return playercount;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
+36
-1
@@ -10,6 +10,9 @@
|
|||||||
#include "lib/rng.h"
|
#include "lib/rng.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
#include "net/net.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
void playermgrInit(void)
|
void playermgrInit(void)
|
||||||
{
|
{
|
||||||
@@ -26,10 +29,16 @@ void playermgrInit(void)
|
|||||||
|
|
||||||
void playermgrReset(void)
|
void playermgrReset(void)
|
||||||
{
|
{
|
||||||
|
#if MAX_PLAYERS > 4
|
||||||
|
for (s32 i = 0; i < MAX_PLAYERS; ++i) {
|
||||||
|
g_Vars.players[i] = NULL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
g_Vars.players[0] = NULL;
|
g_Vars.players[0] = NULL;
|
||||||
g_Vars.players[1] = NULL;
|
g_Vars.players[1] = NULL;
|
||||||
g_Vars.players[2] = NULL;
|
g_Vars.players[2] = NULL;
|
||||||
g_Vars.players[3] = NULL;
|
g_Vars.players[3] = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
g_Vars.currentplayer = NULL;
|
g_Vars.currentplayer = NULL;
|
||||||
g_Vars.currentplayerindex = 0;
|
g_Vars.currentplayerindex = 0;
|
||||||
@@ -48,10 +57,16 @@ void playermgrReset(void)
|
|||||||
|
|
||||||
void playermgrAllocatePlayers(s32 count)
|
void playermgrAllocatePlayers(s32 count)
|
||||||
{
|
{
|
||||||
|
#if MAX_PLAYERS > 4
|
||||||
|
for (s32 i = 0; i < MAX_PLAYERS; ++i) {
|
||||||
|
g_Vars.players[i] = NULL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
g_Vars.players[0] = NULL;
|
g_Vars.players[0] = NULL;
|
||||||
g_Vars.players[1] = NULL;
|
g_Vars.players[1] = NULL;
|
||||||
g_Vars.players[2] = NULL;
|
g_Vars.players[2] = NULL;
|
||||||
g_Vars.players[3] = NULL;
|
g_Vars.players[3] = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
s32 i;
|
s32 i;
|
||||||
@@ -60,6 +75,12 @@ void playermgrAllocatePlayers(s32 count)
|
|||||||
playermgrAllocatePlayer(i);
|
playermgrAllocatePlayer(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode && g_StageNum != STAGE_TITLE && g_StageNum != STAGE_CITRAINING) {
|
||||||
|
netPlayersAllocate();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
setCurrentPlayerNum(0);
|
setCurrentPlayerNum(0);
|
||||||
g_Vars.bond = g_Vars.players[g_Vars.bondplayernum];
|
g_Vars.bond = g_Vars.players[g_Vars.bondplayernum];
|
||||||
|
|
||||||
@@ -591,7 +612,7 @@ void playermgrAllocatePlayer(s32 index)
|
|||||||
g_Vars.players[index]->introanimnum = 0;
|
g_Vars.players[index]->introanimnum = 0;
|
||||||
g_Vars.players[index]->lastsighton = 0;
|
g_Vars.players[index]->lastsighton = 0;
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
for (i = 0; i < ARRAYCOUNT(g_Vars.players[index]->targetset); i++) {
|
||||||
g_Vars.players[index]->targetset[i] = 0;
|
g_Vars.players[index]->targetset[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -643,6 +664,12 @@ void playermgrAllocatePlayer(s32 index)
|
|||||||
g_Vars.players[index]->disguised = false;
|
g_Vars.players[index]->disguised = false;
|
||||||
g_Vars.players[index]->dostartnewlife = false;
|
g_Vars.players[index]->dostartnewlife = false;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
g_Vars.players[index]->client = NULL;
|
||||||
|
g_Vars.players[index]->ucmd = (g_NetMode == NETMODE_SERVER) ? UCMD_FL_FORCEMASK : 0;
|
||||||
|
g_Vars.players[index]->isremote = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
g_Vars.bondvisible = true;
|
g_Vars.bondvisible = true;
|
||||||
g_Vars.bondcollisions = true;
|
g_Vars.bondcollisions = true;
|
||||||
}
|
}
|
||||||
@@ -806,6 +833,14 @@ void playermgrShuffle(void)
|
|||||||
g_Vars.playerorder[i] = i;
|
g_Vars.playerorder[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode) {
|
||||||
|
// don't shuffle in netgames
|
||||||
|
// why is this a thing anyway?
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Randomly swap numbers with later elements
|
// Randomly swap numbers with later elements
|
||||||
for (i = 0; i < MAX_PLAYERS - 1; i++) {
|
for (i = 0; i < MAX_PLAYERS - 1; i++) {
|
||||||
s32 otherindex = random() % (MAX_PLAYERS - i);
|
s32 otherindex = random() % (MAX_PLAYERS - i);
|
||||||
|
|||||||
@@ -148,6 +148,12 @@ void playerReset(void)
|
|||||||
g_PlayersWithControl[1] = true;
|
g_PlayersWithControl[1] = true;
|
||||||
g_PlayersWithControl[2] = true;
|
g_PlayersWithControl[2] = true;
|
||||||
g_PlayersWithControl[3] = true;
|
g_PlayersWithControl[3] = true;
|
||||||
|
#if MAX_PLAYERS > 4
|
||||||
|
g_PlayersWithControl[4] = true;
|
||||||
|
g_PlayersWithControl[5] = true;
|
||||||
|
g_PlayersWithControl[6] = true;
|
||||||
|
g_PlayersWithControl[7] = true;
|
||||||
|
#endif
|
||||||
g_PlayerInvincible = false;
|
g_PlayerInvincible = false;
|
||||||
|
|
||||||
playerSetTickMode(TICKMODE_GE_FADEIN);
|
playerSetTickMode(TICKMODE_GE_FADEIN);
|
||||||
@@ -180,7 +186,8 @@ void playerReset(void)
|
|||||||
cmd = (struct cmd32 *)((uintptr_t)cmd + 8);
|
cmd = (struct cmd32 *)((uintptr_t)cmd + 8);
|
||||||
break;
|
break;
|
||||||
case INTROCMD_WEAPON:
|
case INTROCMD_WEAPON:
|
||||||
if (cmd->param3 == 0 && g_Vars.currentplayer != g_Vars.anti) {
|
if (cmd->param3 == 0 && PLAYER_IS_NOT_ANTI(g_Vars.currentplayer)) {
|
||||||
|
|
||||||
modelmgrLoadProjectileModeldefs(cmd->param1);
|
modelmgrLoadProjectileModeldefs(cmd->param1);
|
||||||
|
|
||||||
if (cmd->param2 >= 0) {
|
if (cmd->param2 >= 0) {
|
||||||
@@ -207,7 +214,7 @@ void playerReset(void)
|
|||||||
cmd = (struct cmd32 *)((uintptr_t)cmd + 16);
|
cmd = (struct cmd32 *)((uintptr_t)cmd + 16);
|
||||||
break;
|
break;
|
||||||
case INTROCMD_AMMO:
|
case INTROCMD_AMMO:
|
||||||
if (cmd->param3 == 0 && g_Vars.currentplayer != g_Vars.anti) {
|
if (cmd->param3 == 0 && PLAYER_IS_NOT_ANTI(g_Vars.currentplayer)) {
|
||||||
bgunSetAmmoQuantity(cmd->param1, cmd->param2);
|
bgunSetAmmoQuantity(cmd->param1, cmd->param2);
|
||||||
}
|
}
|
||||||
cmd = (struct cmd32 *)((uintptr_t)cmd + 16);
|
cmd = (struct cmd32 *)((uintptr_t)cmd + 16);
|
||||||
|
|||||||
+26
-1
@@ -39,6 +39,10 @@
|
|||||||
#include "lib/lib_317f0.h"
|
#include "lib/lib_317f0.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
#include "net/net.h"
|
||||||
|
#include "net/netmsg.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
s16 *g_RoomPropListChunkIndexes;
|
s16 *g_RoomPropListChunkIndexes;
|
||||||
struct roomproplistchunk *g_RoomPropListChunks;
|
struct roomproplistchunk *g_RoomPropListChunks;
|
||||||
@@ -167,6 +171,10 @@ struct prop *propAllocate(void)
|
|||||||
prop->propupdate60err = 2;
|
prop->propupdate60err = 2;
|
||||||
prop->opawallhits = NULL;
|
prop->opawallhits = NULL;
|
||||||
prop->xluwallhits = NULL;
|
prop->xluwallhits = NULL;
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
// NOTE: this will be automatically overwritten at the start of the stage for the setup props
|
||||||
|
prop->syncid = (g_NetMode == NETMODE_SERVER) ? g_NetNextSyncId++ : 0;
|
||||||
|
#endif
|
||||||
g_Vars.propstates[prop->propstateindex].propcount++;
|
g_Vars.propstates[prop->propstateindex].propcount++;
|
||||||
|
|
||||||
g_Vars.allocstateindex++;
|
g_Vars.allocstateindex++;
|
||||||
@@ -199,6 +207,9 @@ void propFree(struct prop *prop)
|
|||||||
prop->prev = NULL;
|
prop->prev = NULL;
|
||||||
prop->chr = NULL;
|
prop->chr = NULL;
|
||||||
prop->rooms[0] = -1;
|
prop->rooms[0] = -1;
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
prop->syncid = 0;
|
||||||
|
#endif
|
||||||
g_Vars.freeprops = prop;
|
g_Vars.freeprops = prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1615,6 +1626,13 @@ bool currentPlayerInteract(bool eyespy)
|
|||||||
prop = propFindForInteract(eyespy);
|
prop = propFindForInteract(eyespy);
|
||||||
|
|
||||||
if (prop) {
|
if (prop) {
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
// if we aren't the authority, don't do anything
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (prop->type) {
|
switch (prop->type) {
|
||||||
case PROPTYPE_OBJ:
|
case PROPTYPE_OBJ:
|
||||||
case PROPTYPE_WEAPON:
|
case PROPTYPE_WEAPON:
|
||||||
@@ -1633,6 +1651,12 @@ bool currentPlayerInteract(bool eyespy)
|
|||||||
|
|
||||||
propExecuteTickOperation(prop, op);
|
propExecuteTickOperation(prop, op);
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
netmsgSvcPropUseWrite(&g_NetMsgRel, prop, g_Vars.currentplayer->client, op);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2449,7 +2473,8 @@ void propsTestForPickup(void)
|
|||||||
|
|
||||||
if (g_Vars.currentplayer->bondmovemode != MOVEMODE_CUTSCENE
|
if (g_Vars.currentplayer->bondmovemode != MOVEMODE_CUTSCENE
|
||||||
&& !g_PlayerInvincible
|
&& !g_PlayerInvincible
|
||||||
&& g_Vars.currentplayer != g_Vars.anti) {
|
&& PLAYER_IS_NOT_ANTI(g_Vars.currentplayer)
|
||||||
|
) {
|
||||||
roomsCopy(g_Vars.currentplayer->prop->rooms, allrooms);
|
roomsCopy(g_Vars.currentplayer->prop->rooms, allrooms);
|
||||||
|
|
||||||
for (i = 0; g_Vars.currentplayer->prop->rooms[i] != -1; i++) {
|
for (i = 0; g_Vars.currentplayer->prop->rooms[i] != -1; i++) {
|
||||||
|
|||||||
+133
-11
@@ -77,6 +77,10 @@
|
|||||||
#include "textures.h"
|
#include "textures.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
#include "net/net.h"
|
||||||
|
#include "net/netmsg.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
void rng2SetSeed(u32 seed);
|
void rng2SetSeed(u32 seed);
|
||||||
|
|
||||||
@@ -155,6 +159,13 @@ bool doorCallLift(struct prop *doorprop, bool allowclose)
|
|||||||
struct doorobj *door = doorprop->door;
|
struct doorobj *door = doorprop->door;
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
// don't automatically do anything with lifts
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (door->base.hidden & OBJHFLAG_LIFTDOOR) {
|
if (door->base.hidden & OBJHFLAG_LIFTDOOR) {
|
||||||
struct linkliftdoorobj *link = g_LiftDoors;
|
struct linkliftdoorobj *link = g_LiftDoors;
|
||||||
|
|
||||||
@@ -5085,6 +5096,11 @@ void liftGoToStop(struct liftobj *lift, s32 stopnum)
|
|||||||
// Sanity check to make sure lift is actually not moving
|
// Sanity check to make sure lift is actually not moving
|
||||||
if (lift->dist == 0 && lift->speed == 0) {
|
if (lift->dist == 0 && lift->speed == 0) {
|
||||||
lift->levelaim = stopnum;
|
lift->levelaim = stopnum;
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
netmsgSvcPropLiftWrite(&g_NetMsgRel, lift->base.prop);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5131,6 +5147,12 @@ void liftGoToStop(struct liftobj *lift, s32 stopnum)
|
|||||||
lift->speed = -lift->speed;
|
lift->speed = -lift->speed;
|
||||||
lift->levelaim = stopnum;
|
lift->levelaim = stopnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
netmsgSvcPropLiftWrite(&g_NetMsgRel, lift->base.prop);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8117,6 +8139,13 @@ void liftTick(struct prop *prop)
|
|||||||
stop = (stop + 1) % 4;
|
stop = (stop + 1) % 4;
|
||||||
} while (lift->pads[stop] < 0);
|
} while (lift->pads[stop] < 0);
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
// don't start if we're not the authority
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
liftGoToStop(lift, stop);
|
liftGoToStop(lift, stop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9119,7 +9148,7 @@ void autogunTickShoot(struct prop *autogunprop)
|
|||||||
// (ie. autogun is a Defense autogun or a thrown laptop)
|
// (ie. autogun is a Defense autogun or a thrown laptop)
|
||||||
if (g_Vars.normmplayerisrunning
|
if (g_Vars.normmplayerisrunning
|
||||||
|| (targetprop && (targetprop->type == PROPTYPE_CHR))
|
|| (targetprop && (targetprop->type == PROPTYPE_CHR))
|
||||||
|| (g_Vars.antiplayernum >= 0 && targetprop && targetprop == g_Vars.anti->prop)) {
|
|| (g_Vars.antiplayernum >= 0 && targetprop && PROP_IS_FOR_ANTI_PLAYER(targetprop))) {
|
||||||
if (cdExamLos08(&gunpos, gunrooms, &hitpos, CDTYPE_ALL, GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
if (cdExamLos08(&gunpos, gunrooms, &hitpos, CDTYPE_ALL, GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||||
#if VERSION >= VERSION_PAL_FINAL
|
#if VERSION >= VERSION_PAL_FINAL
|
||||||
cdGetPos(&hitpos, 11480, "prop/propobj.c");
|
cdGetPos(&hitpos, 11480, "prop/propobj.c");
|
||||||
@@ -14208,6 +14237,12 @@ void objBounce(struct defaultobj *obj, struct coord *gundir2d)
|
|||||||
projectile->speed.z += 3.3333333f * dir.z;
|
projectile->speed.z += 3.3333333f * dir.z;
|
||||||
projectile->ownerprop = g_Vars.currentplayer->prop;
|
projectile->ownerprop = g_Vars.currentplayer->prop;
|
||||||
projectile->bouncecount = 1;
|
projectile->bouncecount = 1;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
netmsgSvcPropMoveWrite(&g_NetMsgRel, obj->prop, &rot);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14285,6 +14320,11 @@ void objApplyMomentum(struct defaultobj *obj, struct coord *speed, f32 rotation,
|
|||||||
projectile->unk0ec = 0.07852732f;
|
projectile->unk0ec = 0.07852732f;
|
||||||
projectile->unk0f0 = 6.6666665f;
|
projectile->unk0f0 = 6.6666665f;
|
||||||
}
|
}
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
netmsgSvcPropMoveWrite(&g_NetMsgRel, obj->prop, NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14315,6 +14355,12 @@ void objApplyMomentum(struct defaultobj *obj, struct coord *speed, f32 rotation,
|
|||||||
projectile->unk0ec = 0.07852732f;
|
projectile->unk0ec = 0.07852732f;
|
||||||
projectile->unk0f0 = 1.6666666f;
|
projectile->unk0f0 = 1.6666666f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
netmsgSvcPropMoveWrite(&g_NetMsgRel, obj->prop, NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15354,6 +15400,18 @@ void objTakeGunfire(struct defaultobj *obj, f32 damage, struct coord *pos, s32 w
|
|||||||
|
|
||||||
void objDamage(struct defaultobj *obj, f32 damage, struct coord *pos, s32 weaponnum, s32 playernum)
|
void objDamage(struct defaultobj *obj, f32 damage, struct coord *pos, s32 weaponnum, s32 playernum)
|
||||||
{
|
{
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
// if we aren't the authority, don't do anything, unless called from netmsg handler
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
if (damage < 0.f) {
|
||||||
|
// HACK: negative damage means we were called from netmsg.c
|
||||||
|
damage = -damage;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Store the attacker playernum into the object's "hidden" field
|
// Store the attacker playernum into the object's "hidden" field
|
||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
// ...but not for deployed laptop guns in multiplayer, because those bits
|
// ...but not for deployed laptop guns in multiplayer, because those bits
|
||||||
@@ -15884,7 +15942,10 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_Vars.antiplayernum < 0 || g_Vars.currentplayer != g_Vars.anti || (obj->flags2 & OBJFLAG2_IMMUNETOANTI) == 0) {
|
if (g_Vars.antiplayernum < 0
|
||||||
|
|| PLAYER_IS_NOT_ANTI(g_Vars.currentplayer)
|
||||||
|
|| (obj->flags2 & OBJFLAG2_IMMUNETOANTI) == 0) {
|
||||||
|
|
||||||
if (hit->hitthing.texturenum != 10000) {
|
if (hit->hitthing.texturenum != 10000) {
|
||||||
f32 damage = gsetGetDamage(&shotdata->gset);
|
f32 damage = gsetGetDamage(&shotdata->gset);
|
||||||
|
|
||||||
@@ -15941,6 +16002,10 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
|
|||||||
pushdir.y = shotdata->gundir3d.y;
|
pushdir.y = shotdata->gundir3d.y;
|
||||||
pushdir.z = shotdata->gundir3d.z;
|
pushdir.z = shotdata->gundir3d.z;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
// don't push anything if we're not the authority
|
||||||
|
if (g_NetMode != NETMODE_CLIENT)
|
||||||
|
#endif
|
||||||
func0f082e84(obj, &spa4, &pushdir, &spb0, true);
|
func0f082e84(obj, &spa4, &pushdir, &spb0, true);
|
||||||
} else {
|
} else {
|
||||||
bool bounce = false;
|
bool bounce = false;
|
||||||
@@ -15963,6 +16028,13 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
|
|||||||
bounce = false;
|
bounce = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
// don't bounce anything if we're not the authority
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
bounce = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (bounce) {
|
if (bounce) {
|
||||||
objBounce(obj, &shotdata->gundir2d);
|
objBounce(obj, &shotdata->gundir2d);
|
||||||
}
|
}
|
||||||
@@ -16821,7 +16893,7 @@ void ammotypePlayPickupSound(u32 ammotype)
|
|||||||
case AMMOTYPE_CLOAK:
|
case AMMOTYPE_CLOAK:
|
||||||
case AMMOTYPE_BOOST:
|
case AMMOTYPE_BOOST:
|
||||||
case AMMOTYPE_TOKEN:
|
case AMMOTYPE_TOKEN:
|
||||||
sndStart(var80095200, SFX_PICKUP_AMMO, NULL, -1, -1, -1, -1, -1);
|
playerSndStart(var80095200, SFX_PICKUP_AMMO, NULL, g_Vars.currentplayernum, -1, -1, -1);
|
||||||
break;
|
break;
|
||||||
case AMMOTYPE_REMOTE_MINE:
|
case AMMOTYPE_REMOTE_MINE:
|
||||||
case AMMOTYPE_PROXY_MINE:
|
case AMMOTYPE_PROXY_MINE:
|
||||||
@@ -16830,10 +16902,10 @@ void ammotypePlayPickupSound(u32 ammotype)
|
|||||||
case AMMOTYPE_MICROCAMERA:
|
case AMMOTYPE_MICROCAMERA:
|
||||||
case AMMOTYPE_PLASTIQUE:
|
case AMMOTYPE_PLASTIQUE:
|
||||||
case AMMOTYPE_ECM_MINE:
|
case AMMOTYPE_ECM_MINE:
|
||||||
sndStart(var80095200, SFX_PICKUP_MINE, NULL, -1, -1, -1, -1, -1);
|
playerSndStart(var80095200, SFX_PICKUP_MINE, NULL, g_Vars.currentplayernum, -1, -1, -1);
|
||||||
break;
|
break;
|
||||||
case AMMOTYPE_KNIFE:
|
case AMMOTYPE_KNIFE:
|
||||||
sndStart(var80095200, SFX_PICKUP_KNIFE, NULL, -1, -1, -1, -1, -1);
|
playerSndStart(var80095200, SFX_PICKUP_KNIFE, NULL, g_Vars.currentplayernum, -1, -1, -1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16898,7 +16970,7 @@ void weaponPlayPickupSound(s32 weaponnum)
|
|||||||
sound = SFX_PICKUP_GUN;
|
sound = SFX_PICKUP_GUN;
|
||||||
}
|
}
|
||||||
|
|
||||||
sndStart(var80095200, sound, NULL, -1, -1, -1, -1, -1);
|
playerSndStart(var80095200, sound, NULL, g_Vars.currentplayernum, -1, -1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ammotypeGetPickupMessage(char *dst, s32 ammotype, s32 qty)
|
void ammotypeGetPickupMessage(char *dst, s32 ammotype, s32 qty)
|
||||||
@@ -17211,7 +17283,7 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
|
|||||||
switch (obj->type) {
|
switch (obj->type) {
|
||||||
case OBJTYPE_KEY:
|
case OBJTYPE_KEY:
|
||||||
if (g_Vars.in_cutscene == false) {
|
if (g_Vars.in_cutscene == false) {
|
||||||
sndStart(var80095200, SFX_PICKUP_KEYCARD, NULL, -1, -1, -1, -1, -1);
|
playerSndStart(var80095200, SFX_PICKUP_KEYCARD, NULL, g_Vars.currentplayernum, -1, -1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showhudmsg) {
|
if (showhudmsg) {
|
||||||
@@ -17251,7 +17323,7 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (g_Vars.in_cutscene == false) {
|
if (g_Vars.in_cutscene == false) {
|
||||||
sndStart(var80095200, SFX_PICKUP_AMMO, NULL, -1, -1, -1, -1, -1);
|
playerSndStart(var80095200, SFX_PICKUP_AMMO, NULL, g_Vars.currentplayernum, -1, -1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = TICKOP_FREE;
|
result = TICKOP_FREE;
|
||||||
@@ -17271,6 +17343,11 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
|
|||||||
|
|
||||||
if (sp64) {
|
if (sp64) {
|
||||||
weaponPlayPickupSound(weapon->weaponnum);
|
weaponPlayPickupSound(weapon->weaponnum);
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER && g_Vars.currentplayer->client) {
|
||||||
|
netmsgSvcPropPickupWrite(&g_NetMsgRel, g_Vars.currentplayer->client, prop, sp64);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return sp64;
|
return sp64;
|
||||||
@@ -17281,6 +17358,11 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
|
|||||||
|
|
||||||
if (sp64) {
|
if (sp64) {
|
||||||
weaponPlayPickupSound(weapon->weaponnum);
|
weaponPlayPickupSound(weapon->weaponnum);
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER && g_Vars.currentplayer->client) {
|
||||||
|
netmsgSvcPropPickupWrite(&g_NetMsgRel, g_Vars.currentplayer->client, prop, sp64);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return sp64;
|
return sp64;
|
||||||
@@ -17394,7 +17476,7 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
|
|||||||
playerSetShieldFrac(((struct shieldobj *) prop->obj)->amount);
|
playerSetShieldFrac(((struct shieldobj *) prop->obj)->amount);
|
||||||
|
|
||||||
if (!g_Vars.in_cutscene) {
|
if (!g_Vars.in_cutscene) {
|
||||||
sndStart(var80095200, SFX_PICKUP_SHIELD, NULL, -1, -1, -1, -1, -1);
|
playerSndStart(var80095200, SFX_PICKUP_SHIELD, NULL, g_Vars.currentplayernum, -1, -1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showhudmsg) {
|
if (showhudmsg) {
|
||||||
@@ -17431,7 +17513,7 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
|
|||||||
case OBJTYPE_TINTEDGLASS:
|
case OBJTYPE_TINTEDGLASS:
|
||||||
default:
|
default:
|
||||||
if (g_Vars.in_cutscene == false) {
|
if (g_Vars.in_cutscene == false) {
|
||||||
sndStart(var80095200, SFX_PICKUP_KEYCARD, NULL, -1, -1, -1, -1, -1);
|
playerSndStart(var80095200, SFX_PICKUP_KEYCARD, NULL, g_Vars.currentplayernum, -1, -1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showhudmsg) {
|
if (showhudmsg) {
|
||||||
@@ -17448,6 +17530,13 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (result != TICKOP_NONE && g_NetMode == NETMODE_SERVER && g_Vars.currentplayer->client) {
|
||||||
|
netmsgSvcPropPickupWrite(&g_NetMsgRel, g_Vars.currentplayer->client, prop, result);
|
||||||
|
netmsgSvcPlayerStatsWrite(&g_NetMsgRel, g_Vars.currentplayer->client);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (result == TICKOP_FREE && (obj->hidden & OBJHFLAG_TAGGED) == 0) {
|
if (result == TICKOP_FREE && (obj->hidden & OBJHFLAG_TAGGED) == 0) {
|
||||||
objFree(obj, false, obj->hidden2 & OBJH2FLAG_CANREGEN);
|
objFree(obj, false, obj->hidden2 & OBJH2FLAG_CANREGEN);
|
||||||
return TICKOP_FREE;
|
return TICKOP_FREE;
|
||||||
@@ -17472,6 +17561,13 @@ s32 objTestForPickup(struct prop *prop)
|
|||||||
return TICKOP_NONE;
|
return TICKOP_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
// if we aren't the authority, don't do anything
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
return TICKOP_NONE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (func0f085194(obj) && obj->type != OBJTYPE_HAT) {
|
if (func0f085194(obj) && obj->type != OBJTYPE_HAT) {
|
||||||
if (obj->flags & OBJFLAG_UNCOLLECTABLE) {
|
if (obj->flags & OBJFLAG_UNCOLLECTABLE) {
|
||||||
return TICKOP_NONE;
|
return TICKOP_NONE;
|
||||||
@@ -19057,6 +19153,13 @@ void doorsCheckAutomatic(void)
|
|||||||
s16 *propnumptr;
|
s16 *propnumptr;
|
||||||
s16 propnums[256];
|
s16 propnums[256];
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
// don't do anything if we're not the authority
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
roomGetProps(g_Vars.currentplayer->prop->rooms, propnums, 256);
|
roomGetProps(g_Vars.currentplayer->prop->rooms, propnums, 256);
|
||||||
propnumptr = propnums;
|
propnumptr = propnums;
|
||||||
|
|
||||||
@@ -19833,6 +19936,11 @@ void doorSetMode(struct doorobj *door, s32 newmode)
|
|||||||
} else {
|
} else {
|
||||||
door->mode = newmode;
|
door->mode = newmode;
|
||||||
}
|
}
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
netmsgSvcPropDoorWrite(&g_NetMsgRel, door->base.prop, g_Vars.currentplayer->client);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20943,7 +21051,7 @@ Gfx *countdownTimerRender(Gfx *gdl)
|
|||||||
u32 stack;
|
u32 stack;
|
||||||
s32 viewright = viGetViewLeft() + (viGetViewWidth() >> 1);
|
s32 viewright = viGetViewLeft() + (viGetViewWidth() >> 1);
|
||||||
s32 y = viGetViewTop() + viGetViewHeight() - 18;
|
s32 y = viGetViewTop() + viGetViewHeight() - 18;
|
||||||
s32 playercount = PLAYERCOUNT();
|
s32 playercount = LOCALPLAYERCOUNT();
|
||||||
char *fmt = ":\n";
|
char *fmt = ":\n";
|
||||||
|
|
||||||
if (playercount == 2) {
|
if (playercount == 2) {
|
||||||
@@ -21198,6 +21306,13 @@ void weaponCreateForPlayerDrop(s32 weaponnum)
|
|||||||
struct chrdata *chr;
|
struct chrdata *chr;
|
||||||
u32 stack2;
|
u32 stack2;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
// don't do anything if we're not the authority
|
||||||
|
if (g_NetMode == NETMODE_CLIENT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
chr = g_Vars.currentplayer->prop->chr;
|
chr = g_Vars.currentplayer->prop->chr;
|
||||||
prop = weaponCreateForChr(chr, playermgrGetModelOfWeapon(weaponnum), weaponnum, OBJFLAG_WEAPON_AICANNOTUSE, NULL, NULL);
|
prop = weaponCreateForChr(chr, playermgrGetModelOfWeapon(weaponnum), weaponnum, OBJFLAG_WEAPON_AICANNOTUSE, NULL, NULL);
|
||||||
|
|
||||||
@@ -21208,6 +21323,13 @@ void weaponCreateForPlayerDrop(s32 weaponnum)
|
|||||||
if (weaponnum == WEAPON_BRIEFCASE2) {
|
if (weaponnum == WEAPON_BRIEFCASE2) {
|
||||||
scenarioHandleDroppedToken(chr, prop);
|
scenarioHandleDroppedToken(chr, prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_NetMode == NETMODE_SERVER) {
|
||||||
|
netmsgSvcPropSpawnWrite(&g_NetMsgRel, prop);
|
||||||
|
netmsgSvcPropMoveWrite(&g_NetMsgRel, prop, NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-5
@@ -338,7 +338,7 @@ void psTickChannel(s32 channelnum)
|
|||||||
|
|
||||||
if (lvIsPaused()
|
if (lvIsPaused()
|
||||||
|| (mpIsPaused() && (channel->flags2 & PSFLAG2_MPPAUSABLE))
|
|| (mpIsPaused() && (channel->flags2 & PSFLAG2_MPPAUSABLE))
|
||||||
|| (mpIsPaused() && PLAYERCOUNT() == 1)) {
|
|| (mpIsPaused() && LOCALPLAYERCOUNT() == 1)) {
|
||||||
channel->currentvol = -1;
|
channel->currentvol = -1;
|
||||||
newvol = 0;
|
newvol = 0;
|
||||||
}
|
}
|
||||||
@@ -1171,7 +1171,7 @@ s32 psCalculateVol(struct coord *pos, f32 dist1, f32 dist2, f32 dist3, RoomNum *
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Figure out which player is closest and store their distance in playerdist
|
// Figure out which player is closest and store their distance in playerdist
|
||||||
for (i = 0; i < PLAYERCOUNT(); i++) {
|
for (i = 0; i < LOCALPLAYERCOUNT(); i++) {
|
||||||
struct player *player = g_Vars.players[i];
|
struct player *player = g_Vars.players[i];
|
||||||
s32 camroom;
|
s32 camroom;
|
||||||
|
|
||||||
@@ -1283,12 +1283,17 @@ s32 psCalculatePan2(struct coord *pos, s32 arg1, f32 arg2, struct pschannel *cha
|
|||||||
s32 degrees;
|
s32 degrees;
|
||||||
f32 f2;
|
f32 f2;
|
||||||
|
|
||||||
if (PLAYERCOUNT() < 2) {
|
if (LOCALPLAYERCOUNT() < 2) {
|
||||||
struct coord *campos = &g_Vars.currentplayer->cam_pos;
|
#ifdef PLATFORM_N64
|
||||||
|
struct player *player = g_Vars.currentplayer;
|
||||||
|
#else
|
||||||
|
struct player *player = g_Vars.players[0] ? g_Vars.players[0] : g_Vars.currentplayer;
|
||||||
|
#endif
|
||||||
|
struct coord *campos = &player->cam_pos;
|
||||||
f32 sp3c;
|
f32 sp3c;
|
||||||
f32 sp38;
|
f32 sp38;
|
||||||
|
|
||||||
f2 = -(atan2f(pos->x - campos->x, pos->z - campos->z) * 180.0f / M_PI + g_Vars.currentplayer->vv_theta);
|
f2 = -(atan2f(pos->x - campos->x, pos->z - campos->z) * 180.0f / M_PI + player->vv_theta);
|
||||||
|
|
||||||
if (arg2 >= 0.0f) {
|
if (arg2 >= 0.0f) {
|
||||||
sp3c = sinf(0.017453292f * f2);
|
sp3c = sinf(0.017453292f * f2);
|
||||||
|
|||||||
+2
-2
@@ -252,7 +252,7 @@ Gfx *radarRender(Gfx *gdl)
|
|||||||
|
|
||||||
tconfig = g_TexRadarConfigs;
|
tconfig = g_TexRadarConfigs;
|
||||||
playernum = g_Vars.currentplayernum;
|
playernum = g_Vars.currentplayernum;
|
||||||
playercount = PLAYERCOUNT();
|
playercount = LOCALPLAYERCOUNT();
|
||||||
|
|
||||||
if (g_Vars.mplayerisrunning) {
|
if (g_Vars.mplayerisrunning) {
|
||||||
if (g_Vars.normmplayerisrunning && (g_MpSetup.options & MPOPTION_NORADAR)) {
|
if (g_Vars.normmplayerisrunning && (g_MpSetup.options & MPOPTION_NORADAR)) {
|
||||||
@@ -336,7 +336,7 @@ Gfx *radarRender(Gfx *gdl)
|
|||||||
gdl = func0f153134(gdl);
|
gdl = func0f153134(gdl);
|
||||||
|
|
||||||
// Draw dots for human players
|
// Draw dots for human players
|
||||||
for (i = 0; i < playercount; i++) {
|
for (i = 0; i < PLAYERCOUNT(); i++) {
|
||||||
if (i != playernum) {
|
if (i != playernum) {
|
||||||
if (g_Vars.players[i]->isdead == false
|
if (g_Vars.players[i]->isdead == false
|
||||||
&& (g_Vars.players[i]->prop->chr->hidden & CHRHFLAG_CLOAKED) == 0
|
&& (g_Vars.players[i]->prop->chr->hidden & CHRHFLAG_CLOAKED) == 0
|
||||||
|
|||||||
@@ -12,7 +12,17 @@ void roomsReset(void)
|
|||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
|
#if MAX_PLAYERS > 4
|
||||||
|
if (PLAYERCOUNT() > 4) {
|
||||||
|
g_RoomMtxNumSlots = 400;
|
||||||
|
} else if (PLAYERCOUNT() > 2) {
|
||||||
|
g_RoomMtxNumSlots = 200;
|
||||||
|
} else {
|
||||||
|
g_RoomMtxNumSlots = 120;
|
||||||
|
}
|
||||||
|
#else
|
||||||
g_RoomMtxNumSlots = PLAYERCOUNT() >= 2 ? 200 : 120;
|
g_RoomMtxNumSlots = PLAYERCOUNT() >= 2 ? 200 : 120;
|
||||||
|
#endif
|
||||||
|
|
||||||
g_RoomMtxAges = mempAlloc(ALIGN16(g_RoomMtxNumSlots), MEMPOOL_STAGE);
|
g_RoomMtxAges = mempAlloc(ALIGN16(g_RoomMtxNumSlots), MEMPOOL_STAGE);
|
||||||
g_RoomMtxLinkedRooms = mempAlloc(ALIGN16(g_RoomMtxNumSlots * sizeof(*g_RoomMtxLinkedRooms)), MEMPOOL_STAGE);
|
g_RoomMtxLinkedRooms = mempAlloc(ALIGN16(g_RoomMtxNumSlots * sizeof(*g_RoomMtxLinkedRooms)), MEMPOOL_STAGE);
|
||||||
|
|||||||
+1
-1
@@ -2073,7 +2073,7 @@ void setupCreateProps(s32 stagenum)
|
|||||||
slotnum = (slotnum + 1) % maxsimulants;
|
slotnum = (slotnum + 1) % maxsimulants;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((g_MpSetup.chrslots & (1 << (slotnum + 4)))
|
if ((g_MpSetup.chrslots & (1 << (slotnum + MAX_PLAYERS)))
|
||||||
&& mpIsSimSlotEnabled(slotnum)) {
|
&& mpIsSimSlotEnabled(slotnum)) {
|
||||||
botmgrAllocateBot(chrnum, slotnum);
|
botmgrAllocateBot(chrnum, slotnum);
|
||||||
chrnum++;
|
chrnum++;
|
||||||
|
|||||||
+3
-3
@@ -518,7 +518,7 @@ Gfx *sightDrawAimer(Gfx *gdl, s32 x, s32 y, s32 radius, s32 cornergap, u32 colou
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Draw the lines that span most of the viewport
|
// Draw the lines that span most of the viewport
|
||||||
if (PLAYERCOUNT() == 1) {
|
if (LOCALPLAYERCOUNT() == 1) {
|
||||||
gDPHudRectangle(gdl++, viewleft + 48, y, x - radius + 2, y);
|
gDPHudRectangle(gdl++, viewleft + 48, y, x - radius + 2, y);
|
||||||
gDPHudRectangle(gdl++, x + radius - 2, y, viewright - 49, y);
|
gDPHudRectangle(gdl++, x + radius - 2, y, viewright - 49, y);
|
||||||
gDPHudRectangle(gdl++, x, viewtop + 10, x, y - radius + 2);
|
gDPHudRectangle(gdl++, x, viewtop + 10, x, y - radius + 2);
|
||||||
@@ -1313,7 +1313,7 @@ Gfx *sightDrawZoom(Gfx *gdl, bool sighton)
|
|||||||
cornerheight *= frac;
|
cornerheight *= frac;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PLAYERCOUNT() >= 2) {
|
if (LOCALPLAYERCOUNT() >= 2) {
|
||||||
cornerheight *= 2;
|
cornerheight *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1578,7 +1578,7 @@ Gfx *sightDraw(Gfx *gdl, bool sighton, s32 sight)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (PLAYERCOUNT() >= 2 && g_Vars.coopplayernum < 0 && g_Vars.antiplayernum < 0) {
|
if (LOCALPLAYERCOUNT() >= 2 && g_Vars.coopplayernum < 0 && g_Vars.antiplayernum < 0) {
|
||||||
sight = SIGHT_DEFAULT;
|
sight = SIGHT_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -53,7 +53,7 @@ void zbufAllocate(void)
|
|||||||
if (IS4MB()) {
|
if (IS4MB()) {
|
||||||
g_ZbufWidth = MAX(320, FBALLOC_WIDTH_LO);
|
g_ZbufWidth = MAX(320, FBALLOC_WIDTH_LO);
|
||||||
|
|
||||||
if (g_Vars.normmplayerisrunning && PLAYERCOUNT() >= 2) {
|
if (g_Vars.normmplayerisrunning && LOCALPLAYERCOUNT() >= 2) {
|
||||||
g_ZbufHeight = MAX(220, FBALLOC_HEIGHT_LO) / 2;
|
g_ZbufHeight = MAX(220, FBALLOC_HEIGHT_LO) / 2;
|
||||||
} else {
|
} else {
|
||||||
g_ZbufHeight = MAX(220, FBALLOC_HEIGHT_LO);
|
g_ZbufHeight = MAX(220, FBALLOC_HEIGHT_LO);
|
||||||
@@ -61,7 +61,7 @@ void zbufAllocate(void)
|
|||||||
} else {
|
} else {
|
||||||
g_ZbufWidth = MAX(640, FBALLOC_WIDTH_HI);
|
g_ZbufWidth = MAX(640, FBALLOC_WIDTH_HI);
|
||||||
|
|
||||||
if (g_Vars.normmplayerisrunning && PLAYERCOUNT() >= 2) {
|
if (g_Vars.normmplayerisrunning && LOCALPLAYERCOUNT() >= 2) {
|
||||||
g_ZbufHeight = MAX(220, FBALLOC_HEIGHT_HI);
|
g_ZbufHeight = MAX(220, FBALLOC_HEIGHT_HI);
|
||||||
} else {
|
} else {
|
||||||
g_ZbufHeight = MAX(220, FBALLOC_HEIGHT_HI);
|
g_ZbufHeight = MAX(220, FBALLOC_HEIGHT_HI);
|
||||||
@@ -101,7 +101,7 @@ Gfx *zbufConfigureRdp(Gfx *gdl)
|
|||||||
uintptr_t addr;
|
uintptr_t addr;
|
||||||
|
|
||||||
if (g_Vars.normmplayerisrunning
|
if (g_Vars.normmplayerisrunning
|
||||||
&& (g_Vars.currentplayernum >= 2 || (PLAYERCOUNT() == 2 && g_Vars.currentplayernum == 1))) {
|
&& (g_Vars.currentplayernum >= 2 || (LOCALPLAYERCOUNT() == 2 && g_Vars.currentplayernum == 1))) {
|
||||||
subamount = playerGetFbWidth() * playerGetFbHeight();
|
subamount = playerGetFbWidth() * playerGetFbHeight();
|
||||||
|
|
||||||
if (IS4MB() || optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
if (IS4MB() || optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||||
@@ -137,7 +137,7 @@ Gfx *zbufClear(Gfx *gdl)
|
|||||||
gDPSetFillColor(gdl++, 0xfffcfffc);
|
gDPSetFillColor(gdl++, 0xfffcfffc);
|
||||||
gDPSetScissorFrac(gdl++, G_SC_NON_INTERLACE, 0, 0, playerGetFbWidth() * 4.0f, playerGetFbHeight() * 4.0f);
|
gDPSetScissorFrac(gdl++, G_SC_NON_INTERLACE, 0, 0, playerGetFbWidth() * 4.0f, playerGetFbHeight() * 4.0f);
|
||||||
|
|
||||||
if (PLAYERCOUNT() <= 2) {
|
if (LOCALPLAYERCOUNT() <= 2) {
|
||||||
left = 0;
|
left = 0;
|
||||||
right = playerGetFbWidth() - 1;
|
right = playerGetFbWidth() - 1;
|
||||||
} else if (g_Vars.currentplayernum == 0 || g_Vars.currentplayernum == 2) {
|
} else if (g_Vars.currentplayernum == 0 || g_Vars.currentplayernum == 2) {
|
||||||
|
|||||||
+3
-3
@@ -177,7 +177,7 @@ extern struct briefing g_Briefing;
|
|||||||
extern struct missionconfig g_MissionConfig;
|
extern struct missionconfig g_MissionConfig;
|
||||||
extern struct menu g_Menus[MAX_PLAYERS];
|
extern struct menu g_Menus[MAX_PLAYERS];
|
||||||
extern struct menudata g_MenuData;
|
extern struct menudata g_MenuData;
|
||||||
extern struct activemenu g_AmMenus[MAX_PLAYERS];
|
extern struct activemenu g_AmMenus[MAX_LOCAL_PLAYERS];
|
||||||
extern s32 g_AmIndex;
|
extern s32 g_AmIndex;
|
||||||
extern u32 g_CheatsActiveBank0;
|
extern u32 g_CheatsActiveBank0;
|
||||||
extern u32 g_CheatsActiveBank1;
|
extern u32 g_CheatsActiveBank1;
|
||||||
@@ -196,7 +196,7 @@ extern struct covercandidate *g_CoverCandidates;
|
|||||||
extern u16 g_NumSpecialCovers;
|
extern u16 g_NumSpecialCovers;
|
||||||
extern u16 *g_SpecialCoverNums;
|
extern u16 *g_SpecialCoverNums;
|
||||||
extern struct pak g_Paks[5];
|
extern struct pak g_Paks[5];
|
||||||
extern OSPfs g_Pfses[MAX_PLAYERS];
|
extern OSPfs g_Pfses[MAX_LOCAL_PLAYERS];
|
||||||
extern u32 g_SkyStageNum;
|
extern u32 g_SkyStageNum;
|
||||||
extern bool g_SkyLightningActive;
|
extern bool g_SkyLightningActive;
|
||||||
extern struct explosion *g_Explosions;
|
extern struct explosion *g_Explosions;
|
||||||
@@ -285,7 +285,7 @@ extern struct chrdata *g_MpAllChrPtrs[MAX_MPCHRS];
|
|||||||
extern struct mpchrconfig *g_MpAllChrConfigPtrs[MAX_MPCHRS];
|
extern struct mpchrconfig *g_MpAllChrConfigPtrs[MAX_MPCHRS];
|
||||||
extern s32 g_MpNumChrs;
|
extern s32 g_MpNumChrs;
|
||||||
extern struct mpbotconfig g_BotConfigsArray[MAX_BOTS];
|
extern struct mpbotconfig g_BotConfigsArray[MAX_BOTS];
|
||||||
extern u8 g_MpSimulantDifficultiesPerNumPlayers[MAX_BOTS][MAX_PLAYERS];
|
extern u8 g_MpSimulantDifficultiesPerNumPlayers[MAX_BOTS][MAX_LOCAL_PLAYERS];
|
||||||
extern struct mpplayerconfig g_PlayerConfigsArray[MAX_MPPLAYERCONFIGS];
|
extern struct mpplayerconfig g_PlayerConfigsArray[MAX_MPPLAYERCONFIGS];
|
||||||
extern u8 g_AmBotCommands[9];
|
extern u8 g_AmBotCommands[9];
|
||||||
extern struct mpsetup g_MpSetup;
|
extern struct mpsetup g_MpSetup;
|
||||||
|
|||||||
+35
-3
@@ -20,14 +20,21 @@
|
|||||||
#define MAX_CHRWAYPOINTS 6
|
#define MAX_CHRWAYPOINTS 6
|
||||||
#define MAX_EXPLOSIONS 6
|
#define MAX_EXPLOSIONS 6
|
||||||
#define MAX_EYESPYDARTS 8
|
#define MAX_EYESPYDARTS 8
|
||||||
|
#ifdef PLATFORM_N64
|
||||||
|
#define MAX_COOPCHRS 2
|
||||||
|
#else
|
||||||
|
#define MAX_COOPCHRS MAX_PLAYERS
|
||||||
|
#endif
|
||||||
#define MAX_MPCHRS (MAX_PLAYERS + MAX_BOTS)
|
#define MAX_MPCHRS (MAX_PLAYERS + MAX_BOTS)
|
||||||
#define MAX_MPPLAYERCONFIGS (MAX_PLAYERS + 2)
|
#define MAX_MPPLAYERCONFIGS (MAX_PLAYERS + MAX_COOPCHRS)
|
||||||
#define MAX_OBJECTIVES 10
|
#define MAX_OBJECTIVES 10
|
||||||
#define MAX_PLAYERS 4
|
#define MAX_LOCAL_PLAYERS 4
|
||||||
|
#define MAX_PLAYERS 8
|
||||||
#define MAX_PROPSPERROOMCHUNK 7
|
#define MAX_PROPSPERROOMCHUNK 7
|
||||||
#define MAX_ROOMPROPLISTCHUNKS 256
|
#define MAX_ROOMPROPLISTCHUNKS 256
|
||||||
#define MAX_SQUADRONS 16
|
#define MAX_SQUADRONS 16
|
||||||
#define MAX_TEAMS 8
|
#define MAX_TEAMS 8
|
||||||
|
#define MAX_PLAYERNAME 15
|
||||||
|
|
||||||
#define NUM_BOTDIFFS 6
|
#define NUM_BOTDIFFS 6
|
||||||
#define NUM_CYCLEABLE_WEAPONS 45
|
#define NUM_CYCLEABLE_WEAPONS 45
|
||||||
@@ -67,7 +74,9 @@
|
|||||||
#define SECSTOTIME60(secs) (secs * 60)
|
#define SECSTOTIME60(secs) (secs * 60)
|
||||||
#define PFS(device) (device == SAVEDEVICE_GAMEPAK ? NULL : &g_Pfses[device])
|
#define PFS(device) (device == SAVEDEVICE_GAMEPAK ? NULL : &g_Pfses[device])
|
||||||
|
|
||||||
#if MAX_PLAYERS >= 4
|
#if MAX_PLAYERS > 4
|
||||||
|
#define PLAYERCOUNT() playerGetCount()
|
||||||
|
#elif MAX_PLAYERS == 4
|
||||||
#define PLAYERCOUNT() ((g_Vars.players[0] ? 1 : 0) + (g_Vars.players[1] ? 1 : 0) + (g_Vars.players[2] ? 1 : 0) + (g_Vars.players[3] ? 1 : 0))
|
#define PLAYERCOUNT() ((g_Vars.players[0] ? 1 : 0) + (g_Vars.players[1] ? 1 : 0) + (g_Vars.players[2] ? 1 : 0) + (g_Vars.players[3] ? 1 : 0))
|
||||||
#elif MAX_PLAYERS >= 3
|
#elif MAX_PLAYERS >= 3
|
||||||
#define PLAYERCOUNT() ((g_Vars.players[0] ? 1 : 0) + (g_Vars.players[1] ? 1 : 0) + (g_Vars.players[2] ? 1 : 0))
|
#define PLAYERCOUNT() ((g_Vars.players[0] ? 1 : 0) + (g_Vars.players[1] ? 1 : 0) + (g_Vars.players[2] ? 1 : 0))
|
||||||
@@ -77,6 +86,20 @@
|
|||||||
#define PLAYERCOUNT() 1
|
#define PLAYERCOUNT() 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MAX_COOPCHRS > 2
|
||||||
|
#define PLAYER_IS_ANTI(plr) (g_Vars.antiplayernum >= 0 && (plr) != g_Vars.bond)
|
||||||
|
#define PLAYER_IS_NOT_ANTI(plr) (g_Vars.antiplayernum < 0 || (plr) == g_Vars.bond)
|
||||||
|
#define PLAYERNUM_IS_ANTI(plrnum) (g_Vars.antiplayernum >= 0 && (plrnum) != g_Vars.bondplayernum)
|
||||||
|
#define PROP_IS_FOR_ANTI_PLAYER(plrprop) (g_Vars.antiplayernum >= 0 && g_Vars.anti && (plrprop)->type == PROPTYPE_PLAYER && (plrprop) != g_Vars.bond->prop)
|
||||||
|
#define EXPLOSION_OWNER_IS_ANTI_PLAYER(expowner) (g_Vars.antiplayernum >= 0 && (expowner) != g_Vars.bondplayernum && mpGetChrFromPlayerIndex((expowner)) != NULL)
|
||||||
|
#else
|
||||||
|
#define PLAYER_IS_ANTI(plr) ((plr) == g_Vars.anti)
|
||||||
|
#define PLAYER_IS_NOT_ANTI(plr) ((plr) != g_Vars.anti)
|
||||||
|
//define PLAYERNUM_IS_ANTI(plrnum) ((plrnum) == g_Vars.antiplayernum)
|
||||||
|
#define PROP_IS_FOR_ANTI_PLAYER(plrprop) ((plrprop) == g_Vars.anti->prop)
|
||||||
|
#define EXPLOSION_OWNER_IS_ANTI_PLAYER(expowner) ((expowner) == g_Vars.antiplayernum)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define VALIDWEAPON() (g_Vars.currentplayer->gunctrl.weaponnum >= WEAPON_UNARMED && g_Vars.currentplayer->gunctrl.weaponnum <= WEAPON_COMBATBOOST)
|
#define VALIDWEAPON() (g_Vars.currentplayer->gunctrl.weaponnum >= WEAPON_UNARMED && g_Vars.currentplayer->gunctrl.weaponnum <= WEAPON_COMBATBOOST)
|
||||||
#define FUNCISSEC() (VALIDWEAPON() && (g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].gunfuncs[(g_Vars.currentplayer->gunctrl.weaponnum - 1) >> 3] & (1 << ((g_Vars.currentplayer->gunctrl.weaponnum - 1) & 7))))
|
#define FUNCISSEC() (VALIDWEAPON() && (g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].gunfuncs[(g_Vars.currentplayer->gunctrl.weaponnum - 1) >> 3] & (1 << ((g_Vars.currentplayer->gunctrl.weaponnum - 1) & 7))))
|
||||||
|
|
||||||
@@ -696,6 +719,7 @@
|
|||||||
#define CONTROLMODE_23 6
|
#define CONTROLMODE_23 6
|
||||||
#define CONTROLMODE_24 7
|
#define CONTROLMODE_24 7
|
||||||
#define CONTROLMODE_PC 8 // "pc port" controls; enabled in the .ini file
|
#define CONTROLMODE_PC 8 // "pc port" controls; enabled in the .ini file
|
||||||
|
#define CONTROLMODE_NA 9 // dummy controls for remote players
|
||||||
|
|
||||||
#define COUNTDOWNTIMERREASON_AI 0x01
|
#define COUNTDOWNTIMERREASON_AI 0x01
|
||||||
#define COUNTDOWNTIMERREASON_NOCONTROL 0x10
|
#define COUNTDOWNTIMERREASON_NOCONTROL 0x10
|
||||||
@@ -4708,6 +4732,8 @@ enum weaponnum {
|
|||||||
#define BUTTON_ACCEPT BUTTON_ACCEPT_WPNFORWARD
|
#define BUTTON_ACCEPT BUTTON_ACCEPT_WPNFORWARD
|
||||||
#define BUTTON_WPNFORWARD BUTTON_ACCEPT_WPNFORWARD
|
#define BUTTON_WPNFORWARD BUTTON_ACCEPT_WPNFORWARD
|
||||||
|
|
||||||
|
#define LOCALPLAYERCOUNT() PLAYERCOUNT()
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// xbla behavior
|
// xbla behavior
|
||||||
@@ -4745,6 +4771,12 @@ enum weaponnum {
|
|||||||
|
|
||||||
#define EXTRA_SLEEP_TIME 1000LL // 100us
|
#define EXTRA_SLEEP_TIME 1000LL // 100us
|
||||||
|
|
||||||
|
#define NETMODE_NONE 0
|
||||||
|
#define NETMODE_SERVER 1
|
||||||
|
#define NETMODE_CLIENT 2
|
||||||
|
|
||||||
|
#define LOCALPLAYERCOUNT() playerGetLocalCount()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+12
-4
@@ -15,6 +15,7 @@
|
|||||||
#define bool s32
|
#define bool s32
|
||||||
#define ubool u32
|
#define ubool u32
|
||||||
|
|
||||||
|
extern s32 g_StageNum;
|
||||||
extern u8 *g_StackLeftAddrs[NUM_THREADS];
|
extern u8 *g_StackLeftAddrs[NUM_THREADS];
|
||||||
extern u8 *g_StackRightAddrs[NUM_THREADS];
|
extern u8 *g_StackRightAddrs[NUM_THREADS];
|
||||||
extern u8 *g_StackAllocatedPos;
|
extern u8 *g_StackAllocatedPos;
|
||||||
@@ -303,7 +304,7 @@ extern struct menudialogdef g_MpConfirmChallenge4MbMenuDialog;
|
|||||||
extern struct menudialogdef g_MainMenu4MbMenuDialog;
|
extern struct menudialogdef g_MainMenu4MbMenuDialog;
|
||||||
extern struct menudialogdef g_MpEditSimulant4MbMenuDialog;
|
extern struct menudialogdef g_MpEditSimulant4MbMenuDialog;
|
||||||
extern struct menudialogdef g_AdvancedSetup4MbMenuDialog;
|
extern struct menudialogdef g_AdvancedSetup4MbMenuDialog;
|
||||||
extern struct filelist *g_FileLists[MAX_PLAYERS];
|
extern struct filelist *g_FileLists[MAX_LOCAL_PLAYERS];
|
||||||
extern bool var80075bd0[];
|
extern bool var80075bd0[];
|
||||||
extern struct headanim g_HeadAnims[2];
|
extern struct headanim g_HeadAnims[2];
|
||||||
extern s32 var80075d60;
|
extern s32 var80075d60;
|
||||||
@@ -512,6 +513,8 @@ extern u8 g_ChrBioSlot;
|
|||||||
extern u8 g_HangarBioSlot;
|
extern u8 g_HangarBioSlot;
|
||||||
extern u8 g_DtSlot;
|
extern u8 g_DtSlot;
|
||||||
extern u8 var80088bb4;
|
extern u8 var80088bb4;
|
||||||
|
extern u64 g_RngSeed;
|
||||||
|
extern u64 g_Rng2Seed;
|
||||||
extern struct vtxstoretype g_VtxstoreTypes[4];
|
extern struct vtxstoretype g_VtxstoreTypes[4];
|
||||||
extern struct menudialogdef g_FrWeaponListMenuDialog;
|
extern struct menudialogdef g_FrWeaponListMenuDialog;
|
||||||
extern struct menudialogdef g_FrTrainingInfoInGameMenuDialog;
|
extern struct menudialogdef g_FrTrainingInfoInGameMenuDialog;
|
||||||
@@ -531,7 +534,7 @@ extern struct menudialogdef g_HangarListMenuDialog;
|
|||||||
|
|
||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
|
|
||||||
extern struct extplayerconfig g_PlayerExtCfg[MAX_PLAYERS];
|
extern struct extplayerconfig g_PlayerExtCfg[MAX_LOCAL_PLAYERS];
|
||||||
|
|
||||||
extern struct weathercfg g_WeatherConfig[WEATHERCFG_MAX_STAGES];
|
extern struct weathercfg g_WeatherConfig[WEATHERCFG_MAX_STAGES];
|
||||||
extern const struct weathercfg g_DefaultWeatherConfig;
|
extern const struct weathercfg g_DefaultWeatherConfig;
|
||||||
@@ -552,11 +555,16 @@ extern s32 g_MusicDisableMpDeath;
|
|||||||
extern s32 g_BgunGeMuzzleFlashes;
|
extern s32 g_BgunGeMuzzleFlashes;
|
||||||
extern s32 g_FileAutoSelect;
|
extern s32 g_FileAutoSelect;
|
||||||
|
|
||||||
|
extern s32 g_NetMode;
|
||||||
|
|
||||||
#define PLAYER_EXTCFG() g_PlayerExtCfg[g_Vars.currentplayerstats->mpindex & 3]
|
#define PLAYER_EXTCFG() g_PlayerExtCfg[g_Vars.currentplayerstats->mpindex & 3]
|
||||||
#define PLAYER_DEFAULT_FOV (PLAYER_EXTCFG().fovy)
|
#define PLAYER_DEFAULT_FOV playerGetDefaultFovY(g_Vars.currentplayerstats->mpindex)
|
||||||
|
#define ADJUST_ZOOM_FOV(x) ((x) * playerGetZoomFovMult(g_Vars.currentplayerstats->mpindex))
|
||||||
|
|
||||||
#define TEX_FILTER_2D g_TexFilter2D
|
#define TEX_FILTER_2D g_TexFilter2D
|
||||||
#define ADJUST_ZOOM_FOV(x) ((x) * PLAYER_EXTCFG().fovzoommult)
|
|
||||||
|
s32 playerGetCount(void);
|
||||||
|
s32 playerGetLocalCount(void);
|
||||||
|
|
||||||
#else // PLATFORM_N64
|
#else // PLATFORM_N64
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ struct modeldef *bgunGetCartModeldef(void);
|
|||||||
void bgun0f09ebcc(struct defaultobj *obj, struct coord *coord, RoomNum *rooms, Mtxf *matrix1, struct coord *velocity, Mtxf *matrix2, struct prop *prop, struct coord *pos);
|
void bgun0f09ebcc(struct defaultobj *obj, struct coord *coord, RoomNum *rooms, Mtxf *matrix1, struct coord *velocity, Mtxf *matrix2, struct prop *prop, struct coord *pos);
|
||||||
void bgun0f09ed2c(struct defaultobj *obj, struct coord *coord, Mtxf *arg2, struct coord *velocity, Mtxf *arg4);
|
void bgun0f09ed2c(struct defaultobj *obj, struct coord *coord, Mtxf *arg2, struct coord *velocity, Mtxf *arg4);
|
||||||
struct defaultobj *bgunCreateThrownProjectile2(struct chrdata *chr, struct gset *gset, struct coord *pos, RoomNum *rooms, Mtxf *arg4, struct coord *velocity);
|
struct defaultobj *bgunCreateThrownProjectile2(struct chrdata *chr, struct gset *gset, struct coord *pos, RoomNum *rooms, Mtxf *arg4, struct coord *velocity);
|
||||||
void bgunCreateThrownProjectile(s32 handnum, struct gset *gset);
|
struct defaultobj *bgunCreateThrownProjectile(s32 handnum, struct gset *gset);
|
||||||
void bgunUpdateHeldRocket(s32 handnum);
|
void bgunUpdateHeldRocket(s32 handnum);
|
||||||
void bgunCreateHeldRocket(s32 handnum, struct weaponfunc_shootprojectile *func);
|
void bgunCreateHeldRocket(s32 handnum, struct weaponfunc_shootprojectile *func);
|
||||||
void bgunFreeHeldRocket(s32 handnum);
|
void bgunFreeHeldRocket(s32 handnum);
|
||||||
|
|||||||
@@ -203,6 +203,7 @@ bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, RoomNum *rooms, f32
|
|||||||
|
|
||||||
struct prop *chrSpawnAtCoord(s32 body, s32 head, struct coord *pos, RoomNum *room, f32 angle, u8 *ailist, u32 spawnflags);
|
struct prop *chrSpawnAtCoord(s32 body, s32 head, struct coord *pos, RoomNum *room, f32 angle, u8 *ailist, u32 spawnflags);
|
||||||
bool chrIsPropPresetBlockingSightToTarget(struct chrdata *chr);
|
bool chrIsPropPresetBlockingSightToTarget(struct chrdata *chr);
|
||||||
|
bool chrSetPos(struct chrdata *chr, struct coord *pos, RoomNum *rooms, f32 angle, bool findground);
|
||||||
bool chrMoveToPos(struct chrdata *chr, struct coord *pos, RoomNum *room, f32 angle, bool ignorebg);
|
bool chrMoveToPos(struct chrdata *chr, struct coord *pos, RoomNum *room, f32 angle, bool ignorebg);
|
||||||
bool chrCheckCoverOutOfSight(struct chrdata *chr, s32 covernum, bool soft);
|
bool chrCheckCoverOutOfSight(struct chrdata *chr, s32 covernum, bool soft);
|
||||||
s32 chrAssignCoverByCriteria(struct chrdata *chr, u16 arg1, s32 arg2);
|
s32 chrAssignCoverByCriteria(struct chrdata *chr, u16 arg1, s32 arg2);
|
||||||
|
|||||||
@@ -106,5 +106,16 @@ void playerSetCamPropertiesWithRoom(struct coord *pos, struct coord *up, struct
|
|||||||
void playerSetCamPropertiesWithoutRoom(struct coord *pos, struct coord *up, struct coord *look, s32 room);
|
void playerSetCamPropertiesWithoutRoom(struct coord *pos, struct coord *up, struct coord *look, s32 room);
|
||||||
void playerSetCamProperties(struct coord *pos, struct coord *up, struct coord *look, s32 room);
|
void playerSetCamProperties(struct coord *pos, struct coord *up, struct coord *look, s32 room);
|
||||||
void playerClearMemCamRoom(void);
|
void playerClearMemCamRoom(void);
|
||||||
|
struct sndstate *playerSndStart(s32 arg0, s16 sound, struct sndstate **handle, s32 playernum, f32 pitch, s32 fxbus, s32 fxmix);
|
||||||
|
|
||||||
|
#if MAX_PLAYERS > 4
|
||||||
|
s32 playerGetCount(void);
|
||||||
|
s32 playerGetLocalCount(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
f32 playerGetDefaultFovY(s32 playernum);
|
||||||
|
f32 playerGetZoomFovMult(s32 playernum);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+21
-6
@@ -230,7 +230,7 @@ struct g_vars {
|
|||||||
/*0x488*/ s32 totalkills;
|
/*0x488*/ s32 totalkills;
|
||||||
/*0x48c*/ bool useperimshoot;
|
/*0x48c*/ bool useperimshoot;
|
||||||
/*0x490*/ s32 mpsetupmenu;
|
/*0x490*/ s32 mpsetupmenu;
|
||||||
/*0x494*/ s8 waitingtojoin[MAX_PLAYERS];
|
/*0x494*/ s8 waitingtojoin[MAX_LOCAL_PLAYERS];
|
||||||
/*0x498*/ s32 unk000498;
|
/*0x498*/ s32 unk000498;
|
||||||
/*0x49c*/ bool usingadvsetup;
|
/*0x49c*/ bool usingadvsetup;
|
||||||
/*0x4a0*/ s32 unk0004a0;
|
/*0x4a0*/ s32 unk0004a0;
|
||||||
@@ -251,7 +251,7 @@ struct g_vars {
|
|||||||
/*0x4d6*/ s8 autocutfinished; // true if cutscene reached natural end
|
/*0x4d6*/ s8 autocutfinished; // true if cutscene reached natural end
|
||||||
/*0x4d7*/ s8 autocutgroupskip; // true if pressed start during auto cutscene
|
/*0x4d7*/ s8 autocutgroupskip; // true if pressed start during auto cutscene
|
||||||
/*0x4d8*/ s32 joydisableframestogo;
|
/*0x4d8*/ s32 joydisableframestogo;
|
||||||
/*0x4dc*/ u8 playertojoymap[MAX_PLAYERS];
|
/*0x4dc*/ u8 playertojoymap[MAX_LOCAL_PLAYERS];
|
||||||
/*0x4e0*/ u8 fourmeg2player;
|
/*0x4e0*/ u8 fourmeg2player;
|
||||||
/*0x4e1*/ u8 remakewallhitvtx;
|
/*0x4e1*/ u8 remakewallhitvtx;
|
||||||
/*0x4e2*/ u8 cutsceneskip60ths;
|
/*0x4e2*/ u8 cutsceneskip60ths;
|
||||||
@@ -324,6 +324,9 @@ struct prop {
|
|||||||
/*0x3f*/ u8 active : 1;
|
/*0x3f*/ u8 active : 1;
|
||||||
/*0x40*/ struct wallhit *opawallhits; // opaque
|
/*0x40*/ struct wallhit *opawallhits; // opaque
|
||||||
/*0x44*/ struct wallhit *xluwallhits; // translucent
|
/*0x44*/ struct wallhit *xluwallhits; // translucent
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
/*0x48*/ u32 syncid;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct packedpad {
|
struct packedpad {
|
||||||
@@ -2820,6 +2823,9 @@ struct player {
|
|||||||
/*0x1c72*/ s16 amdowntime; // for alt-modes, used like invdowntime and amdowntime
|
/*0x1c72*/ s16 amdowntime; // for alt-modes, used like invdowntime and amdowntime
|
||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
/*0x1c74*/ f32 swivelpos[2];
|
/*0x1c74*/ f32 swivelpos[2];
|
||||||
|
/*0x1c84*/ u32 ucmd;
|
||||||
|
/*0x1c88*/ bool isremote;
|
||||||
|
/*0x1c8c*/ struct netclient *client;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -4002,7 +4008,7 @@ struct gamefile {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct mpchrconfig {
|
struct mpchrconfig {
|
||||||
/*0x00*/ char name[15];
|
/*0x00*/ char name[MAX_PLAYERNAME];
|
||||||
/*0x0f*/ u8 mpheadnum;
|
/*0x0f*/ u8 mpheadnum;
|
||||||
/*0x10*/ u8 mpbodynum;
|
/*0x10*/ u8 mpbodynum;
|
||||||
/*0x11*/ u8 team;
|
/*0x11*/ u8 team;
|
||||||
@@ -4046,6 +4052,9 @@ struct mpplayerconfig {
|
|||||||
/*0x96*/ u8 newtitle;
|
/*0x96*/ u8 newtitle;
|
||||||
/*0x97*/ u8 gunfuncs[6];
|
/*0x97*/ u8 gunfuncs[6];
|
||||||
/*0x9d*/ u8 handicap;
|
/*0x9d*/ u8 handicap;
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
/*0x9e*/ struct netclient *client;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mpbotconfig {
|
struct mpbotconfig {
|
||||||
@@ -4087,9 +4096,15 @@ struct mpsetup {
|
|||||||
/**
|
/**
|
||||||
* Each bit signifies that a player or sim is participating.
|
* Each bit signifies that a player or sim is participating.
|
||||||
*
|
*
|
||||||
|
* In the original game:
|
||||||
* Bits 0x000f are for players
|
* Bits 0x000f are for players
|
||||||
* Bits 0x0ff0 are for sims
|
* Bits 0x0ff0 are for sims
|
||||||
* Bits 0xf000 are probably not used
|
* Bits 0xf000 are probably not used
|
||||||
|
*
|
||||||
|
* In the PC port:
|
||||||
|
* Bits 0x00ff are for players
|
||||||
|
* Bits 0xff00 are for sims
|
||||||
|
* Externally loaded MP setups get automatically converted to this format.
|
||||||
*/
|
*/
|
||||||
/*0x800acb9e*/ u16 chrslots;
|
/*0x800acb9e*/ u16 chrslots;
|
||||||
/*0x800acba0*/ u8 weapons[NUM_MPWEAPONSLOTS];
|
/*0x800acba0*/ u8 weapons[NUM_MPWEAPONSLOTS];
|
||||||
@@ -4153,7 +4168,7 @@ struct challenge {
|
|||||||
// Same structure as availability, however each byte determines how many
|
// Same structure as availability, however each byte determines how many
|
||||||
// players it was completed with. So completions[0] is for completions with
|
// players it was completed with. So completions[0] is for completions with
|
||||||
// a single player and completions[3] is for completions with 4 players.
|
// a single player and completions[3] is for completions with 4 players.
|
||||||
/*0x05*/ u8 completions[MAX_PLAYERS];
|
/*0x05*/ u8 completions[MAX_LOCAL_PLAYERS];
|
||||||
|
|
||||||
// Array of features which will become unlocked once the challenge is
|
// Array of features which will become unlocked once the challenge is
|
||||||
// available. The array is automatically populated at runtime based on what
|
// available. The array is automatically populated at runtime based on what
|
||||||
@@ -4785,7 +4800,7 @@ struct menudata {
|
|||||||
/*0x014*/ u8 bg;
|
/*0x014*/ u8 bg;
|
||||||
/*0x015*/ u8 nextbg;
|
/*0x015*/ u8 nextbg;
|
||||||
/*0x016*/ u8 screenshottimer;
|
/*0x016*/ u8 screenshottimer;
|
||||||
/*0x017*/ u8 playerjoinalpha[MAX_PLAYERS];
|
/*0x017*/ u8 playerjoinalpha[MAX_LOCAL_PLAYERS];
|
||||||
/*0x01b*/ s8 bannernum;
|
/*0x01b*/ s8 bannernum;
|
||||||
/*0x01c*/ struct menumodel hudpiece;
|
/*0x01c*/ struct menumodel hudpiece;
|
||||||
/*0x5d4*/ u8 unk5d4;
|
/*0x5d4*/ u8 unk5d4;
|
||||||
@@ -4998,7 +5013,7 @@ struct mpconfigsim {
|
|||||||
u8 mpheadnum;
|
u8 mpheadnum;
|
||||||
u8 mpbodynum;
|
u8 mpbodynum;
|
||||||
u8 team;
|
u8 team;
|
||||||
u8 difficulties[MAX_PLAYERS];
|
u8 difficulties[MAX_LOCAL_PLAYERS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mpconfig {
|
struct mpconfig {
|
||||||
|
|||||||
+10
-10
@@ -204,7 +204,7 @@ void viReset(s32 stagenum)
|
|||||||
? FBALLOC_WIDTH_LO * FBALLOC_HEIGHT_LO * NUM_FRAMEBUFFERS
|
? FBALLOC_WIDTH_LO * FBALLOC_HEIGHT_LO * NUM_FRAMEBUFFERS
|
||||||
: FBALLOC_WIDTH_HI * FBALLOC_HEIGHT_HI * NUM_FRAMEBUFFERS;
|
: FBALLOC_WIDTH_HI * FBALLOC_HEIGHT_HI * NUM_FRAMEBUFFERS;
|
||||||
|
|
||||||
if (IS4MB() && PLAYERCOUNT() == 2) {
|
if (IS4MB() && LOCALPLAYERCOUNT() == 2) {
|
||||||
// 4MB 2-player: The viewports are 110px tall
|
// 4MB 2-player: The viewports are 110px tall
|
||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
fbsize = FBALLOC_WIDTH_LO * (FBALLOC_HEIGHT_LO / 2) * NUM_FRAMEBUFFERS;
|
fbsize = FBALLOC_WIDTH_LO * (FBALLOC_HEIGHT_LO / 2) * NUM_FRAMEBUFFERS;
|
||||||
@@ -212,7 +212,7 @@ void viReset(s32 stagenum)
|
|||||||
fbsize = SCREEN_320 * (SCREEN_240 / 2) * NUM_FRAMEBUFFERS;
|
fbsize = SCREEN_320 * (SCREEN_240 / 2) * NUM_FRAMEBUFFERS;
|
||||||
#endif
|
#endif
|
||||||
g_Vars.fourmeg2player = true;
|
g_Vars.fourmeg2player = true;
|
||||||
} else if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) && PLAYERCOUNT() == 2) {
|
} else if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) && LOCALPLAYERCOUNT() == 2) {
|
||||||
// PAL is using its correct size
|
// PAL is using its correct size
|
||||||
fbsize = SCREEN_WIDTH_LO * SCREEN_HEIGHT_LO * NUM_FRAMEBUFFERS;
|
fbsize = SCREEN_WIDTH_LO * SCREEN_HEIGHT_LO * NUM_FRAMEBUFFERS;
|
||||||
}
|
}
|
||||||
@@ -676,11 +676,11 @@ Gfx *viRenderViewportEdges(Gfx *gdl)
|
|||||||
gDPSetFillColor(gdl++, GPACK_RGBA5551(0, 0, 0, 1) << 16 | GPACK_RGBA5551(0, 0, 0, 1));
|
gDPSetFillColor(gdl++, GPACK_RGBA5551(0, 0, 0, 1) << 16 | GPACK_RGBA5551(0, 0, 0, 1));
|
||||||
|
|
||||||
#if VERSION >= VERSION_NTSC_1_0
|
#if VERSION >= VERSION_NTSC_1_0
|
||||||
if (PLAYERCOUNT() == 1
|
if (LOCALPLAYERCOUNT() == 1
|
||||||
|| ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
|
|| ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
|
||||||
&& playerHasSharedViewport() && g_Vars.currentplayernum == 0))
|
&& playerHasSharedViewport() && g_Vars.currentplayernum == 0))
|
||||||
#else
|
#else
|
||||||
if (PLAYERCOUNT() == 1
|
if (LOCALPLAYERCOUNT() == 1
|
||||||
|| ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
|
|| ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
|
||||||
&& (
|
&& (
|
||||||
(g_InCutscene && !g_MainIsEndscreen) || menuGetRoot() == MENUROOT_COOPCONTINUE
|
(g_InCutscene && !g_MainIsEndscreen) || menuGetRoot() == MENUROOT_COOPCONTINUE
|
||||||
@@ -707,10 +707,10 @@ Gfx *viRenderViewportEdges(Gfx *gdl)
|
|||||||
s32 bottomplayernum = 0;
|
s32 bottomplayernum = 0;
|
||||||
s32 tmpplayernum = 0;
|
s32 tmpplayernum = 0;
|
||||||
|
|
||||||
if (PLAYERCOUNT() == 2) {
|
if (LOCALPLAYERCOUNT() == 2) {
|
||||||
bottomplayernum = 1;
|
bottomplayernum = 1;
|
||||||
tmpplayernum = 1;
|
tmpplayernum = 1;
|
||||||
} else if (PLAYERCOUNT() >= 3) {
|
} else if (LOCALPLAYERCOUNT() >= 3) {
|
||||||
bottomplayernum = 2;
|
bottomplayernum = 2;
|
||||||
tmpplayernum = 2;
|
tmpplayernum = 2;
|
||||||
}
|
}
|
||||||
@@ -735,9 +735,9 @@ Gfx *viRenderViewportEdges(Gfx *gdl)
|
|||||||
viGetWidth() - 1, g_Vars.players[tmpplayernum]->viewtop - 1);
|
viGetWidth() - 1, g_Vars.players[tmpplayernum]->viewtop - 1);
|
||||||
gDPPipeSync(gdl++);
|
gDPPipeSync(gdl++);
|
||||||
|
|
||||||
if (PLAYERCOUNT() >= 3 ||
|
if (LOCALPLAYERCOUNT() >= 3 ||
|
||||||
(PLAYERCOUNT() == 2 && (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || g_Vars.fourmeg2player))) {
|
(LOCALPLAYERCOUNT() == 2 && (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || g_Vars.fourmeg2player))) {
|
||||||
if (PLAYERCOUNT() == 2) {
|
if (LOCALPLAYERCOUNT() == 2) {
|
||||||
tmpplayernum = 0;
|
tmpplayernum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -748,7 +748,7 @@ Gfx *viRenderViewportEdges(Gfx *gdl)
|
|||||||
gDPPipeSync(gdl++);
|
gDPPipeSync(gdl++);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PLAYERCOUNT() == 3) {
|
if (LOCALPLAYERCOUNT() == 3) {
|
||||||
// Blank square in P4 spot
|
// Blank square in P4 spot
|
||||||
gDPFillRectangle(gdl++,
|
gDPFillRectangle(gdl++,
|
||||||
g_Vars.players[tmpplayernum]->viewleft + g_Vars.players[tmpplayernum]->viewwidth + 1, g_Vars.players[tmpplayernum]->viewtop,
|
g_Vars.players[tmpplayernum]->viewleft + g_Vars.players[tmpplayernum]->viewwidth + 1, g_Vars.players[tmpplayernum]->viewtop,
|
||||||
|
|||||||
+106
@@ -0,0 +1,106 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# simple client for server status queries
|
||||||
|
|
||||||
|
import sys, os, socket, struct, selectors
|
||||||
|
|
||||||
|
DEFAULT_PORT = 27100
|
||||||
|
QUERY_MAGIC = b"PDQM\x01"
|
||||||
|
MAX_WAIT = 5.0
|
||||||
|
|
||||||
|
def checksum(data):
|
||||||
|
crc = 0xFFFF
|
||||||
|
for b in data[:-2]:
|
||||||
|
x = crc >> 8 ^ b
|
||||||
|
x ^= x >> 4
|
||||||
|
crc += (crc << 8) ^ (x << 12) ^ (x << 5) ^ x
|
||||||
|
crc &= 0xFFFF
|
||||||
|
return crc
|
||||||
|
|
||||||
|
def eat_string(data):
|
||||||
|
strlen = struct.unpack_from("<H", data)[0]
|
||||||
|
strdata = data[2:strlen + 2]
|
||||||
|
return strdata[:-1].decode(encoding='utf-8'), data[2 + strlen:]
|
||||||
|
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
print("usage: query <address>[:<port>]")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
addrstr = sys.argv[1].strip()
|
||||||
|
host = addrstr
|
||||||
|
port = None
|
||||||
|
|
||||||
|
if addrstr.startswith('[') and ("]:" in addrstr):
|
||||||
|
# [ipv6]:port
|
||||||
|
host, sep, port = addrstr.rpartition(':')
|
||||||
|
elif addrstr.count(':') == 1:
|
||||||
|
# possibly ipv4:port or hostname:port
|
||||||
|
host, sep, port = addrstr.rpartition(':')
|
||||||
|
|
||||||
|
host = host.strip('[]')
|
||||||
|
|
||||||
|
if port != None:
|
||||||
|
port = int(port)
|
||||||
|
else:
|
||||||
|
port = DEFAULT_PORT
|
||||||
|
|
||||||
|
sockfam = socket.AF_INET
|
||||||
|
if ':' in host:
|
||||||
|
sockfam = socket.AF_INET6
|
||||||
|
|
||||||
|
sel = selectors.DefaultSelector()
|
||||||
|
sock = socket.socket(sockfam, socket.SOCK_DGRAM)
|
||||||
|
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, True)
|
||||||
|
sock.settimeout(MAX_WAIT)
|
||||||
|
sel.register(sock, selectors.EVENT_READ, None)
|
||||||
|
|
||||||
|
# send query magic to server(s)
|
||||||
|
sock.sendto(QUERY_MAGIC, (host, port))
|
||||||
|
|
||||||
|
while True:
|
||||||
|
# wait for response
|
||||||
|
events = sel.select(1.0) # timeout in seconds
|
||||||
|
if not events:
|
||||||
|
break
|
||||||
|
|
||||||
|
for (key, mask) in events:
|
||||||
|
data, from_addr = sock.recvfrom(256)
|
||||||
|
|
||||||
|
# check magic
|
||||||
|
if data[:5] != QUERY_MAGIC:
|
||||||
|
print("invalid magic: expected", QUERY_MAGIC, "got", data[:5])
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# check checksum
|
||||||
|
chkremote = struct.unpack("<H", data[-2:])[0]
|
||||||
|
chklocal = checksum(data)
|
||||||
|
if chkremote != chklocal:
|
||||||
|
print("invalid checksum: expected", chklocal, "got", chkremote)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# check size
|
||||||
|
datalen = struct.unpack("<H", data[5:7])[0]
|
||||||
|
if datalen > len(data):
|
||||||
|
print("invalid size: expected", len(data), "got", datalen)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
data = data[7:datalen - 2]
|
||||||
|
|
||||||
|
# unpack fixed size part of the response
|
||||||
|
msgdata = struct.unpack_from("<LBBBBB", data)
|
||||||
|
# unpack strings from the end of the response
|
||||||
|
hostname, data = eat_string(data[9:])
|
||||||
|
romname, data = eat_string(data)
|
||||||
|
moddir, data = eat_string(data)
|
||||||
|
|
||||||
|
print("address:", from_addr)
|
||||||
|
print("protocol ver:", msgdata[0])
|
||||||
|
print("in progress:", msgdata[1])
|
||||||
|
print("clients: {0}/{1}".format(msgdata[2], msgdata[3]))
|
||||||
|
print("stage num:", hex(msgdata[4]))
|
||||||
|
print("scenario:", msgdata[5])
|
||||||
|
print("host name:", hostname)
|
||||||
|
print("rom name:", romname)
|
||||||
|
print("mod dir:", moddir)
|
||||||
|
print("-"*40)
|
||||||
|
|
||||||
Reference in new issue
Block a user