forked from Ports/perfect_dark
Compare commits
79
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc9b4d1a39 | ||
|
|
9633e7eac6 | ||
|
|
42a151a84d | ||
|
|
7cfead440b | ||
|
|
85af83859e | ||
|
|
1b803d792f | ||
|
|
cee61eeb75 | ||
|
|
4883fde642 | ||
|
|
fc865fe8cd | ||
|
|
c45763d47c | ||
|
|
9812d86a24 | ||
|
|
ed5865b350 | ||
|
|
2e9de9455b | ||
|
|
3852b28194 | ||
|
|
0e7fb4f6b2 | ||
|
|
4a7df4de4b | ||
|
|
8d6a19f55b | ||
|
|
507cc5a13b | ||
|
|
87e8a3f1af | ||
|
|
18ad06e3d7 | ||
|
|
c8383babcc | ||
|
|
b9eb0f2747 | ||
|
|
8d5e94e121 | ||
|
|
946a3166b3 | ||
|
|
e6eaca9e3d | ||
|
|
fbb6669e23 | ||
|
|
cf19cebc27 | ||
|
|
4c0cbbf554 | ||
|
|
9d44606a4c | ||
|
|
e326c14760 | ||
|
|
e13e03fd7f | ||
|
|
04a6f64a95 | ||
|
|
39e2f7730d | ||
|
|
083cae49c6 | ||
|
|
6e8190062c | ||
|
|
9ee2391a69 | ||
|
|
7f886a817c | ||
|
|
d9037ba1da | ||
|
|
8d8650ebd0 | ||
|
|
75331721f7 | ||
|
|
2623918359 | ||
|
|
265d21c35d | ||
|
|
5fea484089 | ||
|
|
322892e254 | ||
|
|
4e0025a847 | ||
|
|
38ff8ca5df | ||
|
|
9270b6647a | ||
|
|
e5effc4522 | ||
|
|
22e49d75e1 | ||
|
|
f8617ebbd6 | ||
|
|
bf1b8da629 | ||
|
|
86eaa624a3 | ||
|
|
c2fcb992ca | ||
|
|
54ba0d41c1 | ||
|
|
2c0abcb0e2 | ||
|
|
5554fb7219 | ||
|
|
804674e2b1 | ||
|
|
20534a731b | ||
|
|
242a89a622 | ||
|
|
04e2ed51a6 | ||
|
|
11fd86002b | ||
|
|
75c4905e9b | ||
|
|
336b7825c7 | ||
|
|
63046b4a00 | ||
|
|
5affafacbd | ||
|
|
8ca7f79c1e | ||
|
|
f72b2968f2 | ||
|
|
5c152c1842 | ||
|
|
0cf6021727 | ||
|
|
aa6ac4b5cc | ||
|
|
df2ba8ec7d | ||
|
|
10baed1ee1 | ||
|
|
ac46cf80aa | ||
|
|
704153d7e1 | ||
|
|
e6919bc247 | ||
|
|
b74bc59164 | ||
|
|
d7a6c29552 | ||
|
|
9e1189747d | ||
|
|
4085ae5806 |
No files matched your search
@@ -2,7 +2,7 @@ name: C/C++ CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "port", "port-net" ]
|
||||
branches: [ "port", "port-debugger" ]
|
||||
pull_request:
|
||||
branches: [ "port" ]
|
||||
workflow_dispatch:
|
||||
|
||||
+2
-1
@@ -160,6 +160,7 @@ include_directories("${CMAKE_BINARY_DIR}/src/generated/${ROMID}")
|
||||
include_directories("${CMAKE_SOURCE_DIR}/src/lib/ultra/audio")
|
||||
include_directories("${CMAKE_SOURCE_DIR}/port/include")
|
||||
include_directories("${CMAKE_BINARY_DIR}/port/include")
|
||||
include_directories("${CMAKE_SOURCE_DIR}/port/src/imgui")
|
||||
|
||||
# Set Release optimization to -Og until I fix the -O2 issues
|
||||
if(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug"))
|
||||
@@ -244,7 +245,7 @@ list(APPEND LIBS "${GL_LIBRARY}")
|
||||
# Platform-specific extra libs
|
||||
if(NOT EXTRA_LIBRARIES)
|
||||
if(WIN32)
|
||||
set(EXTRA_LIBRARIES ws2_32 winmm dbghelp -static-libstdc++)
|
||||
set(EXTRA_LIBRARIES dbghelp -static-libstdc++)
|
||||
elseif(NINTENDO_SWITCH)
|
||||
set(EXTRA_LIBRARIES stdc++ pthread)
|
||||
else()
|
||||
|
||||
@@ -1,14 +1,4 @@
|
||||
# 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/perfect-dark-pc-port/perfect_dark/blob/port-net/docs/netplay.md) for more information on how this works.
|
||||
|
||||
## Original description
|
||||
# Perfect Dark port
|
||||
|
||||
This repository contains a work-in-progress port of the [Perfect Dark decompilation](https://github.com/n64decomp/perfect_dark) to modern platforms.
|
||||
|
||||
@@ -53,13 +43,14 @@ There are minor graphics- and gameplay-related issues, and possibly occasional c
|
||||
|
||||
## Download
|
||||
|
||||
Latest [automatic builds](https://github.com/perfect-dark-pc-port/perfect_dark/actions) of the netplay branch for supported platforms:
|
||||
* [x86_64-windows (`port-net`)](https://nightly.link/perfect-dark-pc-port/perfect_dark/workflows/c-cpp/port-net/pd-x86_64-windows.zip)
|
||||
* [i686-windows (`port-net`)](https://nightly.link/perfect-dark-pc-port/perfect_dark/workflows/c-cpp/port-net/pd-i686-windows.zip)
|
||||
* [x86_64-linux (`port-net`)](https://nightly.link/perfect-dark-pc-port/perfect_dark/workflows/c-cpp/port-net/pd-x86_64-linux.zip)
|
||||
* [i686-linux (`port-net`)](https://nightly.link/perfect-dark-pc-port/perfect_dark/workflows/c-cpp/port-net/pd-i686-linux.zip)
|
||||
Latest [automatic builds](https://github.com/fgsfdsfgs/perfect_dark/releases/tag/ci-dev-build) for supported platforms:
|
||||
* [x86_64-windows](https://github.com/fgsfdsfgs/perfect_dark/releases/download/ci-dev-build/pd-x86_64-windows.zip)
|
||||
* [i686-windows](https://github.com/fgsfdsfgs/perfect_dark/releases/download/ci-dev-build/pd-i686-windows.zip)
|
||||
* [x86_64-linux](https://github.com/fgsfdsfgs/perfect_dark/releases/download/ci-dev-build/pd-x86_64-linux.tar.gz)
|
||||
* [i686-linux](https://github.com/fgsfdsfgs/perfect_dark/releases/download/ci-dev-build/pd-i686-linux.tar.gz)
|
||||
* [arm64-nswitch](https://github.com/fgsfdsfgs/perfect_dark/releases/download/ci-dev-build/pd-arm64-nswitch.zip)
|
||||
|
||||
If you are looking for regular builds (the `port` branch), see [this link](https://github.com/perfect-dark-pc-port/perfect_dark/blob/port/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).
|
||||
|
||||
## Running
|
||||
|
||||
@@ -79,9 +70,7 @@ Optionally, you can also put your Perfect Dark for GameBoy Color ROM named `pd.g
|
||||
|
||||
Optionally, you can move the data folder to `~/.local/share/perfectdark` on Linux or `~/Library/Application Support/perfectdark` on MacOS.
|
||||
|
||||
Note that users with different ROMs can't play netgames with each other.
|
||||
|
||||
Additional information can be found in the [wiki](https://github.com/perfect-dark-pc-port/perfect_dark/wiki).
|
||||
Additional information can be found in the [wiki](https://github.com/fgsfdsfgs/perfect_dark/wiki).
|
||||
|
||||
A GPU supporting OpenGL 3.0/ES3.0 or above is required to run the port.
|
||||
|
||||
@@ -91,8 +80,6 @@ The Nintendo Switch build ZIP comes with all 3 regions in different folders: `pe
|
||||
|
||||
Take the folder for the region you want and put it into the `/switch` folder on your SD card, then put your ROM into the `data` folder inside of the folder you extracted as described above.
|
||||
|
||||
`port-net` currently does not work on the Switch.
|
||||
|
||||
## Controls
|
||||
|
||||
1964GEPD-style and Xbox-style bindings are implemented.
|
||||
@@ -131,7 +118,7 @@ Controls can be rebound in `pd.ini`. Default control scheme is as follows:
|
||||
3. Install dependencies:
|
||||
`pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-SDL2 mingw-w64-x86_64-zlib mingw-w64-x86_64-cmake mingw-w64-x86_64-python3 mingw-w64-i686-toolchain mingw-w64-i686-SDL2 mingw-w64-i686-zlib mingw-w64-i686-cmake mingw-w64-i686-python3 make git`
|
||||
4. Get the source code:
|
||||
`git clone -b port-net --recursive https://github.com/perfect-dark-pc-port/perfect_dark.git && cd perfect_dark`
|
||||
`git clone --recursive https://github.com/fgsfdsfgs/perfect_dark.git && cd perfect_dark`
|
||||
5. Run `cmake -G"Unix Makefiles" -Bbuild .`.
|
||||
* Add ` -DROMID=pal-final` or ` -DROMID=jpn-final` at the end of the command if you want to build a PAL or JPN executable respectively.\
|
||||
6. Run `cmake --build build -j4 -- -O`.
|
||||
@@ -143,7 +130,7 @@ Controls can be rebound in `pd.ini`. Default control scheme is as follows:
|
||||
1. Ensure you have gcc, g++ (version 10.0+), make, cmake, git, python3 and SDL2 (version 2.0.12+), libGL and ZLib installed on your system.
|
||||
* If you wish to crosscompile, you will also need to have libraries and compilers for the target platform installed, e.g. `gcc-multilib` and `g++-multilib` for x86_64 -> i686 crosscompilation.
|
||||
2. Get the source code:
|
||||
`git clone -b port-net --recursive https://github.com/perfect-dark-pc-port/perfect_dark.git && cd perfect_dark`
|
||||
`git clone --recursive https://github.com/fgsfdsfgs/perfect_dark.git && cd perfect_dark`
|
||||
3. Run the following command:
|
||||
* ```cmake -G"Unix Makefiles" -Bbuild .```
|
||||
* Add ` -DROMID=pal-final` or ` -DROMID=jpn-final` at the end of the command if you want to build a PAL or JPN executable respectively.
|
||||
@@ -167,7 +154,7 @@ Controls can be rebound in `pd.ini`. Default control scheme is as follows:
|
||||
* This installs SDL2 system-wide and this is how the automatic builds are done. The game will also look for it in the executable path, so you could
|
||||
download it locally instead.
|
||||
4. Get the source code:
|
||||
`git clone --recursive https://github.com/perfect-dark-pc-port/perfect_dark.git && cd perfect_dark`
|
||||
`git clone --recursive https://github.com/fgsfdsfgs/perfect_dark.git && cd perfect_dark`
|
||||
5. Configure:
|
||||
* Execute command: `cmake -G"Unix Makefiles" -Bbuild -DCMAKE_OSX_ARCHITECTURES=x86_64 .`
|
||||
* Replace `x86_64` with `arm64` if building for an ARM64 Mac.
|
||||
@@ -193,7 +180,7 @@ Controls can be rebound in `pd.ini`. Default control scheme is as follows:
|
||||
```
|
||||
* If in MSYS2 or `dkp-pacman` doesn't work, replace it with just `pacman`.
|
||||
4. Get the source code:
|
||||
`git clone --recursive https://github.com/perfect-dark-pc-port/perfect_dark.git && cd perfect_dark`
|
||||
`git clone --recursive https://github.com/fgsfdsfgs/perfect_dark.git && cd perfect_dark`
|
||||
5. Ensure devkitA64 environment variables are set:
|
||||
* Execute command: `source /opt/devkitpro/switchvars.sh`
|
||||
* If your `$DEVKITPRO` path is different, substitute that instead or set the variables manually.
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
## 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 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.
|
||||
|
||||
@@ -98,7 +98,10 @@ extern void bzero(void *, size_t);
|
||||
|
||||
#ifdef PLATFORM_N64
|
||||
extern int sprintf(char *s, const char *fmt, ...);
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
extern void osSyncPrintf(const char *fmt, ...);
|
||||
|
||||
|
||||
|
||||
Vendored
-10
@@ -1,10 +0,0 @@
|
||||
#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
@@ -1,2 +0,0 @@
|
||||
#define MINIMP3_IMPLEMENTATION
|
||||
#include "external/minimp3.h"
|
||||
@@ -1,15 +0,0 @@
|
||||
#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);
|
||||
s32 conIsOpen(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef _IN_DEBUGGER_H
|
||||
#define _IN_DEBUGGER_H
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include <PR/gbi.h>
|
||||
|
||||
extern s32 g_DebuggerActive;
|
||||
extern s32 g_DebuggerTimePasses;
|
||||
extern s32 g_DebuggerFrameAdvance;
|
||||
|
||||
void debuggerInit(void);
|
||||
void debuggerProcessEvent(void *event);
|
||||
|
||||
void debuggerStartFrame(void);
|
||||
void debuggerFrame(void);
|
||||
void debuggerEndFrame(void);
|
||||
|
||||
void debuggerUpdatePropInfo(s32 clear);
|
||||
Gfx *debuggerDrawPropInfo(Gfx *gdl);
|
||||
|
||||
#endif
|
||||
Vendored
-5100
File diff suppressed because it is too large.
Load diff
@@ -1,163 +0,0 @@
|
||||
#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
|
||||
@@ -1,50 +0,0 @@
|
||||
#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
|
||||
@@ -1,10 +0,0 @@
|
||||
#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
|
||||
@@ -1,74 +0,0 @@
|
||||
#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,7 +5,6 @@
|
||||
|
||||
extern u8 *g_RomFile;
|
||||
extern u32 g_RomFileSize;
|
||||
extern const char *g_RomName;
|
||||
|
||||
s32 romdataInit(void);
|
||||
|
||||
|
||||
@@ -7,14 +7,10 @@ extern "C" {
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#define LOGFLAG_NOCON (1 << 6)
|
||||
#define LOGFLAG_SHOWMSG (1 << 7)
|
||||
|
||||
enum loglevel {
|
||||
LOG_NOTE = 0,
|
||||
LOG_CHAT = 0 | LOGFLAG_SHOWMSG,
|
||||
LOG_WARNING = 1 | LOGFLAG_SHOWMSG,
|
||||
LOG_ERROR = 2 | LOGFLAG_SHOWMSG,
|
||||
enum LogLevel {
|
||||
LOG_NOTE,
|
||||
LOG_WARNING,
|
||||
LOG_ERROR,
|
||||
};
|
||||
|
||||
void sysInitArgs(s32 argc, const char **argv);
|
||||
@@ -25,7 +21,6 @@ const char *sysArgGetString(const char *arg);
|
||||
s32 sysArgGetInt(const char *arg, s32 defval);
|
||||
|
||||
u64 sysGetMicroseconds(void);
|
||||
f32 sysGetSeconds(void);
|
||||
|
||||
void sysFatalError(const char *fmt, ...) __attribute__((noreturn));
|
||||
|
||||
|
||||
@@ -12,18 +12,4 @@ char *strParseToken(char *str, char *out, s32 *outCount);
|
||||
char *strFmt(const char *fmt, ...);
|
||||
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
|
||||
@@ -51,8 +51,6 @@ s32 videoGetMSAA(void);
|
||||
f32 videoGetAverageFPS(void);
|
||||
f64 videoGetLastRenderTime(void);
|
||||
|
||||
void videoCapFramerate(s32 limit);
|
||||
|
||||
void videoSetWindowOffset(s32 x, s32 y);
|
||||
void videoSetFullscreen(s32 fs);
|
||||
void videoSetFullscreenMode(s32 mode);
|
||||
|
||||
@@ -1,220 +0,0 @@
|
||||
#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;
|
||||
g_MenuKeyboardPlayer = -1;
|
||||
if (conOpen) {
|
||||
inputClearLastTextChar();
|
||||
inputStartTextInput();
|
||||
} else {
|
||||
inputStopTextInput();
|
||||
}
|
||||
}
|
||||
|
||||
conButton = button;
|
||||
|
||||
if (conOpen) {
|
||||
if (inputTextHandler(conInput, CON_COLS, &conInputCol, false)) {
|
||||
if (g_NetMode) {
|
||||
netChat(NULL, conInput);
|
||||
}
|
||||
conInput[0] = '\0';
|
||||
conInputCol = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 conIsOpen(void)
|
||||
{
|
||||
return conOpen;
|
||||
}
|
||||
@@ -0,0 +1,905 @@
|
||||
#include <string>
|
||||
#include <SDL.h>
|
||||
#include "imgui/imgui.h"
|
||||
#include "imgui/backends/imgui_impl_sdlrenderer2.h"
|
||||
#include "imgui/backends/imgui_impl_sdl2.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include <PR/gbi.h>
|
||||
#include <gbiex.h>
|
||||
#include "data.h"
|
||||
#include "bss.h"
|
||||
#include "constants.h"
|
||||
#include "game/stagetable.h"
|
||||
#include "game/chr.h"
|
||||
#include "game/chraction.h"
|
||||
#include "game/bg.h"
|
||||
#include "game/player.h"
|
||||
#include "game/propobj.h"
|
||||
#include "game/prop.h"
|
||||
#include "game/sight.h"
|
||||
#include "game/game_1531a0.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/mema.h"
|
||||
#include "lib/vi.h"
|
||||
#include "lib/lib_17ce0.h"
|
||||
#include "video.h"
|
||||
#include "input.h"
|
||||
#include "system.h"
|
||||
#include "utils.h"
|
||||
#include "romdata.h"
|
||||
|
||||
#undef bool
|
||||
#undef true
|
||||
#undef false
|
||||
|
||||
s32 g_DebuggerActive = FALSE;
|
||||
s32 g_DebuggerTimePasses = TRUE;
|
||||
s32 g_DebuggerFrameAdvance = 0;
|
||||
|
||||
u32 memaGetSize(void);
|
||||
|
||||
}
|
||||
|
||||
static SDL_Window *dbgwin = nullptr;
|
||||
static SDL_Renderer *dbgren = nullptr;
|
||||
|
||||
static char xstr[64] = "0";
|
||||
static char ystr[64] = "0";
|
||||
static char zstr[64] = "0";
|
||||
static char gotostr[64] = "";
|
||||
|
||||
static bool advanceHeld = false;
|
||||
|
||||
static s32 propFilter = 0;
|
||||
static s32 objFilter = 0;
|
||||
|
||||
static const char *propTypes[9];
|
||||
static const char *objTypes[0x3c];
|
||||
|
||||
static bool expandLatch = false;
|
||||
static bool expandValue = false;
|
||||
|
||||
static bool showPropInfo = false;
|
||||
static bool showActiveProps = true;
|
||||
|
||||
static void *focusPtr = nullptr;
|
||||
|
||||
static struct prop *lookatprop = nullptr;
|
||||
static struct hitthing lookathit;
|
||||
static bool lookathitset;
|
||||
|
||||
static inline const char *fmtCoord(const coord& crd)
|
||||
{
|
||||
static char tmp[128];
|
||||
snprintf(tmp, sizeof(tmp), "(%.2f, %.2f, %.2f)", crd.x, crd.y, crd.z);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
#define DEF_ACT_NAME(x) case x: return #x;
|
||||
|
||||
static inline const char *fmtActionType(s8 at)
|
||||
{
|
||||
switch (at) {
|
||||
DEF_ACT_NAME(ACT_INIT )
|
||||
DEF_ACT_NAME(ACT_STAND )
|
||||
DEF_ACT_NAME(ACT_KNEEL )
|
||||
DEF_ACT_NAME(ACT_ANIM )
|
||||
DEF_ACT_NAME(ACT_DIE )
|
||||
DEF_ACT_NAME(ACT_DEAD )
|
||||
DEF_ACT_NAME(ACT_ARGH )
|
||||
DEF_ACT_NAME(ACT_PREARGH )
|
||||
DEF_ACT_NAME(ACT_ATTACK )
|
||||
DEF_ACT_NAME(ACT_ATTACKWALK )
|
||||
DEF_ACT_NAME(ACT_ATTACKROLL )
|
||||
DEF_ACT_NAME(ACT_SIDESTEP )
|
||||
DEF_ACT_NAME(ACT_JUMPOUT )
|
||||
DEF_ACT_NAME(ACT_RUNPOS )
|
||||
DEF_ACT_NAME(ACT_PATROL )
|
||||
DEF_ACT_NAME(ACT_GOPOS )
|
||||
DEF_ACT_NAME(ACT_SURRENDER )
|
||||
DEF_ACT_NAME(ACT_LOOKATTARGET )
|
||||
DEF_ACT_NAME(ACT_SURPRISED )
|
||||
DEF_ACT_NAME(ACT_STARTALARM )
|
||||
DEF_ACT_NAME(ACT_THROWGRENADE )
|
||||
DEF_ACT_NAME(ACT_TURNDIR )
|
||||
DEF_ACT_NAME(ACT_TEST )
|
||||
DEF_ACT_NAME(ACT_BONDINTRO )
|
||||
DEF_ACT_NAME(ACT_BONDDIE )
|
||||
DEF_ACT_NAME(ACT_BONDMULTI )
|
||||
DEF_ACT_NAME(ACT_NULL )
|
||||
DEF_ACT_NAME(ACT_BOT_ATTACKSTAND )
|
||||
DEF_ACT_NAME(ACT_BOT_ATTACKKNEEL )
|
||||
DEF_ACT_NAME(ACT_BOT_ATTACKSTRAFE)
|
||||
DEF_ACT_NAME(ACT_DRUGGEDDROP )
|
||||
DEF_ACT_NAME(ACT_DRUGGEDKO )
|
||||
DEF_ACT_NAME(ACT_DRUGGEDCOMINGUP )
|
||||
DEF_ACT_NAME(ACT_ATTACKAMOUNT )
|
||||
DEF_ACT_NAME(ACT_ROBOTATTACK )
|
||||
DEF_ACT_NAME(ACT_SKJUMP )
|
||||
DEF_ACT_NAME(ACT_PUNCH )
|
||||
DEF_ACT_NAME(ACT_CUTFIRE )
|
||||
default: return "ACT";
|
||||
}
|
||||
}
|
||||
|
||||
static inline const char *fmtPropType(u8 at)
|
||||
{
|
||||
switch (at) {
|
||||
DEF_ACT_NAME(PROPTYPE_OBJ)
|
||||
DEF_ACT_NAME(PROPTYPE_DOOR)
|
||||
DEF_ACT_NAME(PROPTYPE_CHR)
|
||||
DEF_ACT_NAME(PROPTYPE_WEAPON)
|
||||
DEF_ACT_NAME(PROPTYPE_EYESPY)
|
||||
DEF_ACT_NAME(PROPTYPE_PLAYER)
|
||||
DEF_ACT_NAME(PROPTYPE_EXPLOSION)
|
||||
DEF_ACT_NAME(PROPTYPE_SMOKE)
|
||||
default: return "Prop";
|
||||
}
|
||||
}
|
||||
|
||||
static inline const char *fmtObjType(u8 at)
|
||||
{
|
||||
switch (at) {
|
||||
DEF_ACT_NAME(OBJTYPE_DOOR )
|
||||
DEF_ACT_NAME(OBJTYPE_DOORSCALE )
|
||||
DEF_ACT_NAME(OBJTYPE_BASIC )
|
||||
DEF_ACT_NAME(OBJTYPE_KEY )
|
||||
DEF_ACT_NAME(OBJTYPE_ALARM )
|
||||
DEF_ACT_NAME(OBJTYPE_CCTV )
|
||||
DEF_ACT_NAME(OBJTYPE_AMMOCRATE )
|
||||
DEF_ACT_NAME(OBJTYPE_WEAPON )
|
||||
DEF_ACT_NAME(OBJTYPE_CHR )
|
||||
DEF_ACT_NAME(OBJTYPE_SINGLEMONITOR )
|
||||
DEF_ACT_NAME(OBJTYPE_MULTIMONITOR )
|
||||
DEF_ACT_NAME(OBJTYPE_HANGINGMONITORS )
|
||||
DEF_ACT_NAME(OBJTYPE_AUTOGUN )
|
||||
DEF_ACT_NAME(OBJTYPE_LINKGUNS )
|
||||
DEF_ACT_NAME(OBJTYPE_DEBRIS )
|
||||
DEF_ACT_NAME(OBJTYPE_10 )
|
||||
DEF_ACT_NAME(OBJTYPE_HAT )
|
||||
DEF_ACT_NAME(OBJTYPE_GRENADEPROB )
|
||||
DEF_ACT_NAME(OBJTYPE_LINKLIFTDOOR )
|
||||
DEF_ACT_NAME(OBJTYPE_MULTIAMMOCRATE )
|
||||
DEF_ACT_NAME(OBJTYPE_SHIELD )
|
||||
DEF_ACT_NAME(OBJTYPE_TAG )
|
||||
DEF_ACT_NAME(OBJTYPE_BEGINOBJECTIVE )
|
||||
DEF_ACT_NAME(OBJTYPE_ENDOBJECTIVE )
|
||||
DEF_ACT_NAME(OBJECTIVETYPE_DESTROYOBJ )
|
||||
DEF_ACT_NAME(OBJECTIVETYPE_COMPFLAGS )
|
||||
DEF_ACT_NAME(OBJECTIVETYPE_FAILFLAGS )
|
||||
DEF_ACT_NAME(OBJECTIVETYPE_COLLECTOBJ )
|
||||
DEF_ACT_NAME(OBJECTIVETYPE_THROWOBJ )
|
||||
DEF_ACT_NAME(OBJECTIVETYPE_HOLOGRAPH )
|
||||
DEF_ACT_NAME(OBJECTIVETYPE_1F )
|
||||
DEF_ACT_NAME(OBJECTIVETYPE_ENTERROOM )
|
||||
DEF_ACT_NAME(OBJECTIVETYPE_THROWINROOM )
|
||||
DEF_ACT_NAME(OBJTYPE_22 )
|
||||
DEF_ACT_NAME(OBJTYPE_BRIEFING )
|
||||
DEF_ACT_NAME(OBJTYPE_GASBOTTLE )
|
||||
DEF_ACT_NAME(OBJTYPE_RENAMEOBJ )
|
||||
DEF_ACT_NAME(OBJTYPE_PADLOCKEDDOOR )
|
||||
DEF_ACT_NAME(OBJTYPE_TRUCK )
|
||||
DEF_ACT_NAME(OBJTYPE_HELI )
|
||||
DEF_ACT_NAME(OBJTYPE_29 )
|
||||
DEF_ACT_NAME(OBJTYPE_GLASS )
|
||||
DEF_ACT_NAME(OBJTYPE_SAFE )
|
||||
DEF_ACT_NAME(OBJTYPE_SAFEITEM )
|
||||
DEF_ACT_NAME(OBJTYPE_TANK )
|
||||
DEF_ACT_NAME(OBJTYPE_CAMERAPOS )
|
||||
DEF_ACT_NAME(OBJTYPE_TINTEDGLASS )
|
||||
DEF_ACT_NAME(OBJTYPE_LIFT )
|
||||
DEF_ACT_NAME(OBJTYPE_CONDITIONALSCENERY)
|
||||
DEF_ACT_NAME(OBJTYPE_BLOCKEDPATH )
|
||||
DEF_ACT_NAME(OBJTYPE_HOVERBIKE )
|
||||
DEF_ACT_NAME(OBJTYPE_END )
|
||||
DEF_ACT_NAME(OBJTYPE_HOVERPROP )
|
||||
DEF_ACT_NAME(OBJTYPE_FAN )
|
||||
DEF_ACT_NAME(OBJTYPE_HOVERCAR )
|
||||
DEF_ACT_NAME(OBJTYPE_PADEFFECT )
|
||||
DEF_ACT_NAME(OBJTYPE_CHOPPER )
|
||||
DEF_ACT_NAME(OBJTYPE_MINE )
|
||||
DEF_ACT_NAME(OBJTYPE_ESCASTEP )
|
||||
default: return "Obj";
|
||||
}
|
||||
}
|
||||
|
||||
#undef DEF_ACT_NAME
|
||||
|
||||
extern "C" void debuggerInit(void)
|
||||
{
|
||||
SDL_Window *parent = (SDL_Window *)videoGetWindowHandle();
|
||||
|
||||
int px = 0;
|
||||
int py = 0;
|
||||
int pw = 0;
|
||||
int ph = 0;
|
||||
// in windowed mode put the debugger to the right of the window
|
||||
if ((SDL_GetWindowFlags(parent) & SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) {
|
||||
SDL_GetWindowPosition(parent, &px, &py);
|
||||
SDL_GetWindowSize(parent, &pw, &ph);
|
||||
}
|
||||
|
||||
const Uint32 winflags = SDL_WINDOW_RESIZABLE;
|
||||
dbgwin = SDL_CreateWindow("Debugger", px + pw + 4, py, 320, ph, winflags);
|
||||
if (!dbgwin) {
|
||||
sysLogPrintf(LOG_ERROR, "DBG: could not create SDL window: %s", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
// can't trust any hardware accelerated windows to live in harmony with our main window, so force SW
|
||||
dbgren = SDL_CreateRenderer(dbgwin, -1, SDL_RENDERER_SOFTWARE);
|
||||
if (!dbgren) {
|
||||
sysLogPrintf(LOG_ERROR, "DBG: could not create SDL renderer: %s", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
IMGUI_CHECKVERSION();
|
||||
ImGui::CreateContext();
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
|
||||
io.IniFilename = nullptr;
|
||||
|
||||
ImGui::StyleColorsDark();
|
||||
|
||||
ImGui_ImplSDL2_InitForSDLRenderer(dbgwin, dbgren);
|
||||
ImGui_ImplSDLRenderer2_Init(dbgren);
|
||||
|
||||
propTypes[0] = "NONE";
|
||||
for (s32 i = 1; i < ARRAYCOUNT(propTypes); ++i) {
|
||||
propTypes[i] = fmtPropType(i);
|
||||
}
|
||||
|
||||
objTypes[0] = "NONE";
|
||||
for (s32 i = 1; i < ARRAYCOUNT(objTypes); ++i) {
|
||||
objTypes[i] = fmtObjType(i);
|
||||
}
|
||||
|
||||
g_DebuggerActive = TRUE;
|
||||
}
|
||||
|
||||
static inline void debuggerHotKey(const s32 key, const bool pressed)
|
||||
{
|
||||
switch (key) {
|
||||
case SDLK_F1:
|
||||
if (pressed)
|
||||
g_DebuggerTimePasses ^= 1;
|
||||
break;
|
||||
case SDLK_F2:
|
||||
if (pressed)
|
||||
g_DebuggerFrameAdvance = 1;
|
||||
break;
|
||||
case SDLK_F3:
|
||||
if (pressed)
|
||||
g_DebuggerFrameAdvance = 5;
|
||||
break;
|
||||
case SDLK_F4:
|
||||
advanceHeld = pressed;
|
||||
break;
|
||||
case SDLK_F5:
|
||||
if (pressed) {
|
||||
if (g_TickRateDiv <= 1) {
|
||||
g_TickRateDiv = 2;
|
||||
} else {
|
||||
g_TickRateDiv = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SDLK_F6:
|
||||
if (pressed) {
|
||||
g_TickRateDiv++;
|
||||
if (g_TickRateDiv > 5) {
|
||||
g_TickRateDiv = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void debuggerProcessEvent(void *data)
|
||||
{
|
||||
if (g_DebuggerActive) {
|
||||
SDL_Event *e = (SDL_Event *)data;
|
||||
if (e->type == SDL_KEYDOWN || e->type == SDL_KEYUP) {
|
||||
debuggerHotKey(e->key.keysym.sym, e->type == SDL_KEYDOWN);
|
||||
} else if (e->type == SDL_MOUSEBUTTONDOWN || e->type == SDL_MOUSEBUTTONUP) {
|
||||
if (SDL_GetMouseFocus() != dbgwin || SDL_GetWindowID(dbgwin) != e->button.windowID) {
|
||||
return;
|
||||
}
|
||||
} else if (e->type == SDL_MOUSEMOTION) {
|
||||
if (SDL_GetMouseFocus() != dbgwin || SDL_GetWindowID(dbgwin) != e->motion.windowID) {
|
||||
return;
|
||||
}
|
||||
} else if (e->type == SDL_MOUSEWHEEL) {
|
||||
if (SDL_GetMouseFocus() != dbgwin || SDL_GetWindowID(dbgwin) != e->wheel.windowID) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
ImGui_ImplSDL2_ProcessEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void debuggerStartFrame(void)
|
||||
{
|
||||
ImGui_ImplSDLRenderer2_NewFrame();
|
||||
ImGui_ImplSDL2_NewFrame();
|
||||
ImGui::NewFrame();
|
||||
}
|
||||
|
||||
static inline bool debuggerGetSurfaceInfo(struct hitthing *hit)
|
||||
{
|
||||
struct coord endpos;
|
||||
endpos.x = g_Vars.currentplayer->cam_pos.x + g_Vars.currentplayer->cam_look.x * 10000.f;
|
||||
endpos.y = g_Vars.currentplayer->cam_pos.y + g_Vars.currentplayer->cam_look.y * 10000.f;
|
||||
endpos.z = g_Vars.currentplayer->cam_pos.z + g_Vars.currentplayer->cam_look.z * 10000.f;
|
||||
|
||||
// get what rooms the LOS goes through
|
||||
RoomNum outrooms[17], tmprooms[8], srcrooms[2];
|
||||
srcrooms[0] = g_Vars.currentplayer->cam_room;
|
||||
srcrooms[1] = -1;
|
||||
outrooms[16] = -1;
|
||||
portal00018148(&g_Vars.currentplayer->cam_pos, &endpos, srcrooms, tmprooms, outrooms, 16);
|
||||
|
||||
// no prop was hit; check for bg hits
|
||||
for (s32 i = 0; outrooms[i] != -1; ++i) {
|
||||
if (bgTestHitInRoom(&g_Vars.currentplayer->cam_pos, &endpos, outrooms[i], hit)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
extern "C" void debuggerUpdatePropInfo(s32 clear)
|
||||
{
|
||||
if (showPropInfo) {
|
||||
if (clear) {
|
||||
lookatprop = nullptr;
|
||||
lookathitset = false;
|
||||
} else {
|
||||
lookatprop = propFindAimingAt(HAND_RIGHT, false, FINDPROPCONTEXT_QUERY);
|
||||
if (!lookatprop) {
|
||||
// if we aren't looking at a prop, try to get the surface we're looking at
|
||||
lookathitset = debuggerGetSurfaceInfo(&lookathit);
|
||||
} else {
|
||||
lookathitset = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
lookatprop = nullptr;
|
||||
lookathitset = false;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void debuggerTeleportPlayer(struct coord& crd)
|
||||
{
|
||||
sysLogPrintf(LOG_NOTE, "DBG: teleporting player 1 to (%.2f, %.2f, %.2f)", crd.x, crd.y, crd.z);
|
||||
|
||||
if (!g_Vars.players[0] || !g_Vars.players[0]->prop) {
|
||||
sysLogPrintf(LOG_NOTE, "DBG: no player 1 or player 1 has no prop");
|
||||
return;
|
||||
}
|
||||
|
||||
struct chrdata *playerchr = g_Vars.players[0]->prop->chr;
|
||||
if (!playerchr) {
|
||||
sysLogPrintf(LOG_NOTE, "DBG: player 1 has no chr");
|
||||
return;
|
||||
}
|
||||
|
||||
RoomNum inrooms[9] = { -1 };
|
||||
RoomNum aboverooms[9] = { -1 };
|
||||
|
||||
bgFindRoomsByPos(&crd, inrooms, aboverooms, 8, NULL);
|
||||
|
||||
RoomNum *rooms = NULL;
|
||||
if (inrooms[0] != -1) {
|
||||
rooms = inrooms;
|
||||
} else if (aboverooms[0] != -1) {
|
||||
rooms = aboverooms;
|
||||
}
|
||||
|
||||
if (rooms) {
|
||||
const u32 old = playerchr->hidden;
|
||||
playerchr->hidden |= CHRHFLAG_WARPONSCREEN;
|
||||
chrMoveToPos(playerchr, &crd, rooms, g_Vars.players[0]->vv_theta, true);
|
||||
if ((old & CHRHFLAG_WARPONSCREEN) == 0) {
|
||||
playerchr->hidden &= ~CHRHFLAG_WARPONSCREEN;
|
||||
}
|
||||
} else {
|
||||
sysLogPrintf(LOG_NOTE, "DBG: could not find any rooms at teleport destination");
|
||||
}
|
||||
}
|
||||
|
||||
static inline void debuggerKillChr(struct chrdata *chr)
|
||||
{
|
||||
struct coord dmgdir = { 0.f, 0.f, 0.f };
|
||||
chrDamageByImpact(chr, 10000.f, &dmgdir, nullptr, nullptr, HITPART_GENERAL);
|
||||
}
|
||||
|
||||
static inline void debuggerKillPlayer(void)
|
||||
{
|
||||
sysLogPrintf(LOG_NOTE, "DBG: killing player 1");
|
||||
|
||||
if (!g_Vars.players[0] || !g_Vars.players[0]->prop) {
|
||||
sysLogPrintf(LOG_NOTE, "DBG: no player 1 or player 1 has no prop");
|
||||
return;
|
||||
}
|
||||
|
||||
struct chrdata *playerchr = g_Vars.players[0]->prop->chr;
|
||||
if (!playerchr) {
|
||||
sysLogPrintf(LOG_NOTE, "DBG: player 1 has no chr");
|
||||
return;
|
||||
}
|
||||
|
||||
debuggerKillChr(playerchr);
|
||||
}
|
||||
|
||||
static inline void debuggerHealPlayer(void)
|
||||
{
|
||||
sysLogPrintf(LOG_NOTE, "DBG: healing player 1");
|
||||
|
||||
if (!g_Vars.players[0] || !g_Vars.players[0]->prop) {
|
||||
sysLogPrintf(LOG_NOTE, "DBG: no player 1 or player 1 has no prop");
|
||||
return;
|
||||
}
|
||||
|
||||
player *prev = g_Vars.currentplayer;
|
||||
g_Vars.currentplayer = g_Vars.players[0];
|
||||
playerDisplayHealth();
|
||||
g_Vars.currentplayer->bondhealth = 1.f;
|
||||
g_Vars.currentplayer = prev;
|
||||
}
|
||||
|
||||
static inline void describeHand(hand *hand)
|
||||
{
|
||||
ImGui::Text("Gun num: %02x", hand->gset.weaponnum);
|
||||
ImGui::Text("Gun func: %02x", hand->gset.weaponfunc);
|
||||
ImGui::Text("Aim pos: %s", fmtCoord(hand->aimpos));
|
||||
ImGui::Text("Hit pos: %s", fmtCoord(hand->hitpos));
|
||||
}
|
||||
|
||||
static inline std::string& describeRoomList(RoomNum *rooms, s32 maxRooms, std::string& out)
|
||||
{
|
||||
for (s32 i = 0; i < maxRooms && rooms[i] >= 0; ++i) {
|
||||
out += strFmt("%03x ", rooms[i]);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
static inline void describeProjectile(projectile *prj)
|
||||
{
|
||||
ImGui::Text("Drop type: %04x", (u16)prj->droptype);
|
||||
ImGui::Text("Flags: %08x", prj->flags);
|
||||
ImGui::Text("Vel: %s", fmtCoord(prj->speed));
|
||||
}
|
||||
|
||||
static inline void describeObj(defaultobj *obj)
|
||||
{
|
||||
ImGui::Text("Type: %s (%02x)", fmtObjType(obj->type), obj->type);
|
||||
ImGui::Text("Model: %04x", (u16)obj->modelnum);
|
||||
ImGui::Text("Pad: %04x", (u16)obj->pad);
|
||||
ImGui::Text("Flags 1: %08x", obj->flags);
|
||||
ImGui::Text("Flags 2: %08x", obj->flags2);
|
||||
ImGui::Text("Flags 3: %08x", obj->flags3);
|
||||
ImGui::Text("Hidden 1: %08x", obj->hidden);
|
||||
ImGui::Text("Hidden 2: %02x", obj->hidden2);
|
||||
|
||||
if ((obj->hidden & OBJHFLAG_PROJECTILE) && obj->projectile) {
|
||||
if (ImGui::TreeNode(strFmt("Projectile (%p)", obj->projectile))) {
|
||||
describeProjectile(obj->projectile);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void describeWeapon(weaponobj *wpn)
|
||||
{
|
||||
ImGui::Text("Gun num: %02x", wpn->weaponnum);
|
||||
ImGui::Text("Gun func: %02x", wpn->gunfunc);
|
||||
ImGui::Text("Fade out timer (60hz): %d", wpn->fadeouttimer60);
|
||||
ImGui::Text("Timer (240hz): %d", wpn->timer240);
|
||||
}
|
||||
|
||||
static inline void describeProp(prop *prop);
|
||||
|
||||
static inline void describeChr(chrdata *chr)
|
||||
{
|
||||
ImGui::Text("Number: %04x", (u16)chr->chrnum);
|
||||
ImGui::Text("Flags 1: %08x", chr->flags);
|
||||
ImGui::Text("Flags 2: %08x", chr->flags2);
|
||||
ImGui::Text("Hidden 1: %08x", chr->hidden);
|
||||
ImGui::Text("Hidden 2: %04x", chr->hidden2);
|
||||
ImGui::Text("Chr flags: %08x", chr->chrflags);
|
||||
ImGui::Text("Damage: %.3f", chr->damage);
|
||||
ImGui::Text("Shield: %.3f", chr->cshield);
|
||||
ImGui::Text("Body: %04x", (u16)chr->bodynum);
|
||||
ImGui::Text("Head: %02x", (u8)chr->headnum);
|
||||
ImGui::Text("Team: %02x", chr->team);
|
||||
ImGui::Text("Tude: %02x", chr->tude);
|
||||
ImGui::Text("Action: %s (%02x)", fmtActionType(chr->actiontype), (u8)chr->actiontype);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (chr->weapons_held[HAND_RIGHT]) {
|
||||
if (ImGui::TreeNode(strFmt("Right hand prop (%p)", chr->weapons_held[HAND_RIGHT]))) {
|
||||
describeProp(chr->weapons_held[HAND_RIGHT]);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
if (chr->weapons_held[HAND_LEFT]) {
|
||||
if (ImGui::TreeNode(strFmt("Left hand prop (%p)", chr->weapons_held[HAND_LEFT]))) {
|
||||
describeProp(chr->weapons_held[HAND_LEFT]);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
if (chr->weapons_held[2]) {
|
||||
if (ImGui::TreeNode(strFmt("Hat prop (%p)", chr->weapons_held[2]))) {
|
||||
describeProp(chr->weapons_held[2]);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::SeparatorText("Controls");
|
||||
|
||||
if (ImGui::Button("Kill")) {
|
||||
debuggerKillChr(chr);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Heal")) {
|
||||
chr->damage = 0.f;
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Sleep")) {
|
||||
chr->sleep = 127;
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Wake")) {
|
||||
chr->sleep = 0;
|
||||
}
|
||||
|
||||
// line break
|
||||
|
||||
if (ImGui::Button("Drop guns")) {
|
||||
chrDropItemsForOwnerReap(chr);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void describeProp(prop *prop)
|
||||
{
|
||||
ImGui::Text(prop->active ? "Active" : "Inactive");
|
||||
ImGui::Text("Type: %s (%02x)", fmtPropType(prop->type), prop->type);
|
||||
ImGui::Text("Flags: %02x", prop->flags);
|
||||
ImGui::Text("Pos: %s", fmtCoord(prop->pos));
|
||||
|
||||
std::string roomstr = "";
|
||||
ImGui::Text("Rooms: %s", describeRoomList(prop->rooms, ARRAYCOUNT(prop->rooms), roomstr).c_str());
|
||||
|
||||
if (prop->obj) {
|
||||
if (expandLatch) {
|
||||
ImGui::SetNextItemOpen(expandValue);
|
||||
}
|
||||
if (ImGui::TreeNode(strFmt("%s (%p)", fmtObjType(prop->obj->type), prop->obj))) {
|
||||
describeObj(prop->obj);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
|
||||
if ((prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER || prop->type == PROPTYPE_EYESPY) && prop->chr) {
|
||||
if (expandLatch) {
|
||||
ImGui::SetNextItemOpen(expandValue);
|
||||
}
|
||||
if (ImGui::TreeNode(strFmt("Chr (%p)", prop->chr))) {
|
||||
describeChr(prop->chr);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
} else if (prop->type == PROPTYPE_WEAPON && prop->weapon) {
|
||||
if (expandLatch) {
|
||||
ImGui::SetNextItemOpen(expandValue);
|
||||
}
|
||||
if (ImGui::TreeNode(strFmt("Weapon (%p)", prop->weapon))) {
|
||||
describeWeapon(prop->weapon);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void describePlayer(player *plr)
|
||||
{
|
||||
ImGui::Text("Cam pos: %s", fmtCoord(plr->cam_pos));
|
||||
ImGui::Text("Cam look: %s", fmtCoord(plr->cam_look));
|
||||
ImGui::Text("Cam room: %03x", (u32)plr->cam_room);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("Health: %.3f", plr->bondhealth);
|
||||
ImGui::Text("Shield: %.3f", plr->apparentarmour);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (plr->prop) {
|
||||
if (ImGui::TreeNode(strFmt("Prop (%p)", plr->prop))) {
|
||||
describeProp(plr->prop);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::TreeNode("Right hand")) {
|
||||
describeHand(&plr->hands[HAND_RIGHT]);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
if (ImGui::TreeNode("Left hand")) {
|
||||
describeHand(&plr->hands[HAND_LEFT]);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void debuggerFrame(void)
|
||||
{
|
||||
if (!g_DebuggerActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (advanceHeld) {
|
||||
g_DebuggerFrameAdvance = 1;
|
||||
}
|
||||
|
||||
expandLatch = false;
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2(0.f, 0.f));
|
||||
ImGui::SetNextWindowSize(io.DisplaySize);
|
||||
ImGui::Begin("Debugger", nullptr, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar);
|
||||
|
||||
if (ImGui::CollapsingHeader("Debug")) {
|
||||
ImGui::SeparatorText("Player");
|
||||
|
||||
ImGui::PushItemWidth(56.f);
|
||||
ImGui::InputText("X", xstr, IM_ARRAYSIZE(xstr) - 1, ImGuiInputTextFlags_CharsNoBlank | ImGuiInputTextFlags_CharsDecimal);
|
||||
ImGui::SameLine();
|
||||
ImGui::InputText("Y", ystr, IM_ARRAYSIZE(ystr) - 1, ImGuiInputTextFlags_CharsNoBlank | ImGuiInputTextFlags_CharsDecimal);
|
||||
ImGui::SameLine();
|
||||
ImGui::InputText("Z", zstr, IM_ARRAYSIZE(zstr) - 1, ImGuiInputTextFlags_CharsNoBlank | ImGuiInputTextFlags_CharsDecimal);
|
||||
ImGui::SameLine();
|
||||
ImGui::PopItemWidth();
|
||||
if (ImGui::Button("Warp")) {
|
||||
struct coord crd;
|
||||
crd.x = std::atof(xstr);
|
||||
crd.y = std::atof(ystr);
|
||||
crd.z = std::atof(zstr);
|
||||
debuggerTeleportPlayer(crd);
|
||||
}
|
||||
|
||||
if (ImGui::Button("Kill")) {
|
||||
debuggerKillPlayer();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Heal")) {
|
||||
debuggerHealPlayer();
|
||||
}
|
||||
|
||||
ImGui::SeparatorText("Time");
|
||||
|
||||
bool timePasses = (g_DebuggerTimePasses != 0);
|
||||
if (ImGui::Checkbox("Time passes", &timePasses)) {
|
||||
g_DebuggerTimePasses = (s32)timePasses;
|
||||
}
|
||||
|
||||
s32 framediv = g_TickRateDiv;
|
||||
if (ImGui::InputInt("Tickrate", &framediv, 1, 2)) {
|
||||
if (framediv >= 0 && framediv < 60) {
|
||||
g_TickRateDiv = framediv;
|
||||
g_Vars.mininc60 = framediv;
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::Button("+1 frame")) {
|
||||
g_DebuggerFrameAdvance = 1;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("+5 frames")) {
|
||||
g_DebuggerFrameAdvance = 5;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("+10 frames")) {
|
||||
g_DebuggerFrameAdvance = 10;
|
||||
}
|
||||
|
||||
ImGui::SeparatorText("Other");
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Time")) {
|
||||
ImGui::Text("Level Frame#: %d", g_Vars.lvframenum);
|
||||
ImGui::Text("Level Tick (60hz): %d", g_Vars.lvframe60);
|
||||
ImGui::Text("Level Tick (240hz): %d", g_Vars.lvframe240);
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Frame Time (60hz): %.2f", g_Vars.diffframe60f);
|
||||
ImGui::Text("Frame Time (240hz): %.2f", g_Vars.diffframe240f);
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Lost Time (60hz): %d", g_Vars.lostframetime60t);
|
||||
ImGui::Text("Lost Time (240hz): %d", g_Vars.lostframetime240t);
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Players")) {
|
||||
for (s32 i = 0; i < ARRAYCOUNT(g_Vars.players); ++i) {
|
||||
auto plr = g_Vars.players[i];
|
||||
if (plr) {
|
||||
if (ImGui::TreeNode(strFmt("Player %d (%p)###Player%p", i + 1, plr, plr))) {
|
||||
describePlayer(plr);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Vars.activeprops && g_Vars.activeprops != g_Vars.activepropstail) {
|
||||
if (ImGui::CollapsingHeader("Props")) {
|
||||
ImGui::Text("Visible: %d", g_Vars.numonscreenprops);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Checkbox("Active props only", &showActiveProps);
|
||||
|
||||
ImGui::Combo("Filter prop", &propFilter, propTypes, ARRAYCOUNT(propTypes));
|
||||
ImGui::Combo("Filter obj", &objFilter, objTypes, ARRAYCOUNT(objTypes));
|
||||
|
||||
if (ImGui::Button("Expand all")) {
|
||||
expandLatch = true;
|
||||
expandValue = true;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Close all")) {
|
||||
expandLatch = true;
|
||||
expandValue = false;
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
auto showProp = [&](struct prop *prop) {
|
||||
if (prop && (!propFilter || propFilter == prop->type)) {
|
||||
if (!objFilter || (prop->obj && prop->obj->type == objFilter)) {
|
||||
const bool focus = (focusPtr && ((void *)prop == focusPtr || (void *)prop->obj == focusPtr));
|
||||
if (expandLatch) {
|
||||
ImGui::SetNextItemOpen(expandValue);
|
||||
} else if (focus) {
|
||||
ImGui::SetNextItemOpen(true);
|
||||
focusPtr = nullptr;
|
||||
}
|
||||
if (ImGui::TreeNode(strFmt("%s (%p)###Prop%p", fmtPropType(prop->type), prop, prop))) {
|
||||
if (focus) {
|
||||
ImGui::SetScrollHereY();
|
||||
}
|
||||
describeProp(prop);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (showActiveProps) {
|
||||
// show the active props list
|
||||
struct prop *prop;
|
||||
struct prop *next;
|
||||
bool done;
|
||||
prop = g_Vars.activeprops;
|
||||
do {
|
||||
next = prop->next;
|
||||
done = next == g_Vars.pausedprops;
|
||||
showProp(prop);
|
||||
prop = next;
|
||||
} while (!done);
|
||||
} else {
|
||||
// show all props
|
||||
for (s32 i = 0; i < g_Vars.maxprops; ++i) {
|
||||
struct prop *prop = &g_Vars.props[i];
|
||||
showProp(prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (g_ChrSlots && g_NumChrSlots) {
|
||||
if (ImGui::CollapsingHeader("Characters")) {
|
||||
ImGui::Text("Count: %d/%d", g_NumChrs, g_NumChrSlots);
|
||||
ImGui::Separator();
|
||||
for (s32 i = 0; i < g_NumChrSlots; ++i) {
|
||||
if (g_ChrSlots[i].chrnum >= 0) {
|
||||
if (ImGui::TreeNode(strFmt("Slot %3d: %04x (%p)", i, g_ChrSlots[i].chrnum, &g_ChrSlots[i]))) {
|
||||
describeChr(&g_ChrSlots[i]);
|
||||
if (g_ChrSlots[i].prop && ImGui::TreeNode(strFmt("Prop (%p)##chr", g_ChrSlots[i].prop))) {
|
||||
describeProp(g_ChrSlots[i].prop);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Stage")) {
|
||||
ImGui::Text("Number: %02x", g_Vars.stagenum);
|
||||
ImGui::Text("Index: %02x", g_StageIndex);
|
||||
ImGui::Text("Setup: %s", romdataFileGetName(g_Stages[g_StageIndex].setupfileid));
|
||||
ImGui::Text("Room count: %d", g_Vars.roomcount);
|
||||
if (g_Rooms && ImGui::TreeNode("Rooms")) {
|
||||
ImGui::Separator();
|
||||
for (s32 i = 1; i < g_Vars.roomcount; ++i) {
|
||||
if (ImGui::TreeNode(strFmt("Room %03x", i))) {
|
||||
ImGui::Text("Loaded: %d", g_Rooms[i].loaded240);
|
||||
ImGui::Text("Flags: %04x", g_Rooms[i].flags);
|
||||
ImGui::Text("Portals: %d", g_Rooms[i].numportals);
|
||||
ImGui::Text("Centre: %s", fmtCoord(g_Rooms[i].centre));
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Memory")) {
|
||||
ImGui::Text("Mema size: %uk", memaGetSize() / 1024);
|
||||
ImGui::Spacing();
|
||||
if (ImGui::TreeNode("Memp state")) {
|
||||
if (ImGui::BeginTable("MemaTab", 3)) {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("Pool");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("Onboard");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("Expansion");
|
||||
for (u8 i = MEMPOOL_STAGE; i <= MEMPOOL_PERMANENT; i += 2) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text((i == MEMPOOL_STAGE) ? "Stage" : "Permanent");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%uk/%uk", mempGetPoolFree(i, MEMBANK_ONBOARD) / 1024, mempGetPoolSize(i, MEMBANK_ONBOARD) / 1024);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%uk/%uk", mempGetPoolFree(i, MEMBANK_EXPANSION) / 1024, mempGetPoolSize(i, MEMBANK_EXPANSION) / 1024);
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
|
||||
if ((showPropInfo = ImGui::CollapsingHeader("Looking at"))) {
|
||||
if (lookatprop) {
|
||||
ImGui::Text("Looking at prop");
|
||||
describeProp(lookatprop);
|
||||
} else if (lookathitset) {
|
||||
ImGui::Text("Looking at surface");
|
||||
ImGui::Text("Hit pos: %s", fmtCoord(lookathit.pos));
|
||||
ImGui::Text("Texture: %04x", lookathit.texturenum);
|
||||
} else {
|
||||
ImGui::Text("Looking at nothing");
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
extern "C" void debuggerEndFrame(void)
|
||||
{
|
||||
ImGui::Render();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
SDL_RenderSetScale(dbgren, io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y);
|
||||
SDL_SetRenderDrawColor(dbgren, 0, 0, 0, 255);
|
||||
SDL_RenderClear(dbgren);
|
||||
ImGui_ImplSDLRenderer2_RenderDrawData(ImGui::GetDrawData());
|
||||
SDL_RenderPresent(dbgren);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2023 Omar Cornut
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,46 @@
|
||||
// dear imgui: Platform Backend for SDL2
|
||||
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
|
||||
// (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Platform: Clipboard support.
|
||||
// [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen.
|
||||
// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy SDL_SCANCODE_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set]
|
||||
// [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
||||
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||
// [X] Platform: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
||||
// Missing features:
|
||||
// [ ] Platform: Multi-viewport + Minimized windows seems to break mouse wheel events (at least under Windows).
|
||||
// [x] Platform: Basic IME support. App needs to call 'SDL_SetHint(SDL_HINT_IME_SHOW_UI, "1");' before SDL_CreateWindow()!.
|
||||
|
||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||
// Learn about Dear ImGui:
|
||||
// - FAQ https://dearimgui.com/faq
|
||||
// - Getting Started https://dearimgui.com/getting-started
|
||||
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
||||
// - Introduction, links and more at the top of imgui.cpp
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
#ifndef IMGUI_DISABLE
|
||||
|
||||
struct SDL_Window;
|
||||
struct SDL_Renderer;
|
||||
typedef union SDL_Event SDL_Event;
|
||||
|
||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* sdl_gl_context);
|
||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window);
|
||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window);
|
||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForMetal(SDL_Window* window);
|
||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForSDLRenderer(SDL_Window* window, SDL_Renderer* renderer);
|
||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOther(SDL_Window* window);
|
||||
IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame();
|
||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event);
|
||||
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
static inline void ImGui_ImplSDL2_NewFrame(SDL_Window*) { ImGui_ImplSDL2_NewFrame(); } // 1.84: removed unnecessary parameter
|
||||
#endif
|
||||
|
||||
#endif // #ifndef IMGUI_DISABLE
|
||||
@@ -0,0 +1,268 @@
|
||||
// dear imgui: Renderer Backend for SDL_Renderer for SDL2
|
||||
// (Requires: SDL 2.0.17+)
|
||||
|
||||
// Note how SDL_Renderer is an _optional_ component of SDL2.
|
||||
// For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
|
||||
// If your application will want to render any non trivial amount of graphics other than UI,
|
||||
// please be aware that SDL_Renderer currently offers a limited graphic API to the end-user and
|
||||
// it might be difficult to step out of those boundaries.
|
||||
|
||||
// Implemented features:
|
||||
// [X] Renderer: User texture binding. Use 'SDL_Texture*' as ImTextureID. Read the FAQ about ImTextureID!
|
||||
// [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
|
||||
// Missing features:
|
||||
// [ ] Renderer: Multi-viewport support (multiple windows).
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||
// Learn about Dear ImGui:
|
||||
// - FAQ https://dearimgui.com/faq
|
||||
// - Getting Started https://dearimgui.com/getting-started
|
||||
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
||||
// - Introduction, links and more at the top of imgui.cpp
|
||||
|
||||
// CHANGELOG
|
||||
// 2023-05-30: Renamed imgui_impl_sdlrenderer.h/.cpp to imgui_impl_sdlrenderer2.h/.cpp to accommodate for upcoming SDL3.
|
||||
// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
|
||||
// 2021-12-21: Update SDL_RenderGeometryRaw() format to work with SDL 2.0.19.
|
||||
// 2021-12-03: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
||||
// 2021-10-06: Backup and restore modified ClipRect/Viewport.
|
||||
// 2021-09-21: Initial version.
|
||||
|
||||
#include "imgui.h"
|
||||
#ifndef IMGUI_DISABLE
|
||||
#include "imgui_impl_sdlrenderer2.h"
|
||||
#include <stdint.h> // intptr_t
|
||||
|
||||
// Clang warnings with -Weverything
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wsign-conversion" // warning: implicit conversion changes signedness
|
||||
#endif
|
||||
|
||||
// SDL
|
||||
#include <SDL.h>
|
||||
#if !SDL_VERSION_ATLEAST(2,0,17)
|
||||
#error This backend requires SDL 2.0.17+ because of SDL_RenderGeometry() function
|
||||
#endif
|
||||
|
||||
// SDL_Renderer data
|
||||
struct ImGui_ImplSDLRenderer2_Data
|
||||
{
|
||||
SDL_Renderer* SDLRenderer;
|
||||
SDL_Texture* FontTexture;
|
||||
ImGui_ImplSDLRenderer2_Data() { memset((void*)this, 0, sizeof(*this)); }
|
||||
};
|
||||
|
||||
// Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts
|
||||
// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.
|
||||
static ImGui_ImplSDLRenderer2_Data* ImGui_ImplSDLRenderer2_GetBackendData()
|
||||
{
|
||||
return ImGui::GetCurrentContext() ? (ImGui_ImplSDLRenderer2_Data*)ImGui::GetIO().BackendRendererUserData : nullptr;
|
||||
}
|
||||
|
||||
// Functions
|
||||
bool ImGui_ImplSDLRenderer2_Init(SDL_Renderer* renderer)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
||||
IM_ASSERT(renderer != nullptr && "SDL_Renderer not initialized!");
|
||||
|
||||
// Setup backend capabilities flags
|
||||
ImGui_ImplSDLRenderer2_Data* bd = IM_NEW(ImGui_ImplSDLRenderer2_Data)();
|
||||
io.BackendRendererUserData = (void*)bd;
|
||||
io.BackendRendererName = "imgui_impl_sdlrenderer2";
|
||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
||||
|
||||
bd->SDLRenderer = renderer;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplSDLRenderer2_Shutdown()
|
||||
{
|
||||
ImGui_ImplSDLRenderer2_Data* bd = ImGui_ImplSDLRenderer2_GetBackendData();
|
||||
IM_ASSERT(bd != nullptr && "No renderer backend to shutdown, or already shutdown?");
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
ImGui_ImplSDLRenderer2_DestroyDeviceObjects();
|
||||
|
||||
io.BackendRendererName = nullptr;
|
||||
io.BackendRendererUserData = nullptr;
|
||||
io.BackendFlags &= ~ImGuiBackendFlags_RendererHasVtxOffset;
|
||||
IM_DELETE(bd);
|
||||
}
|
||||
|
||||
static void ImGui_ImplSDLRenderer2_SetupRenderState()
|
||||
{
|
||||
ImGui_ImplSDLRenderer2_Data* bd = ImGui_ImplSDLRenderer2_GetBackendData();
|
||||
|
||||
// Clear out any viewports and cliprect set by the user
|
||||
// FIXME: Technically speaking there are lots of other things we could backup/setup/restore during our render process.
|
||||
SDL_RenderSetViewport(bd->SDLRenderer, nullptr);
|
||||
SDL_RenderSetClipRect(bd->SDLRenderer, nullptr);
|
||||
}
|
||||
|
||||
void ImGui_ImplSDLRenderer2_NewFrame()
|
||||
{
|
||||
ImGui_ImplSDLRenderer2_Data* bd = ImGui_ImplSDLRenderer2_GetBackendData();
|
||||
IM_ASSERT(bd != nullptr && "Did you call ImGui_ImplSDLRenderer2_Init()?");
|
||||
|
||||
if (!bd->FontTexture)
|
||||
ImGui_ImplSDLRenderer2_CreateDeviceObjects();
|
||||
}
|
||||
|
||||
void ImGui_ImplSDLRenderer2_RenderDrawData(ImDrawData* draw_data)
|
||||
{
|
||||
ImGui_ImplSDLRenderer2_Data* bd = ImGui_ImplSDLRenderer2_GetBackendData();
|
||||
|
||||
// If there's a scale factor set by the user, use that instead
|
||||
// If the user has specified a scale factor to SDL_Renderer already via SDL_RenderSetScale(), SDL will scale whatever we pass
|
||||
// to SDL_RenderGeometryRaw() by that scale factor. In that case we don't want to be also scaling it ourselves here.
|
||||
float rsx = 1.0f;
|
||||
float rsy = 1.0f;
|
||||
SDL_RenderGetScale(bd->SDLRenderer, &rsx, &rsy);
|
||||
ImVec2 render_scale;
|
||||
render_scale.x = (rsx == 1.0f) ? draw_data->FramebufferScale.x : 1.0f;
|
||||
render_scale.y = (rsy == 1.0f) ? draw_data->FramebufferScale.y : 1.0f;
|
||||
|
||||
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
|
||||
int fb_width = (int)(draw_data->DisplaySize.x * render_scale.x);
|
||||
int fb_height = (int)(draw_data->DisplaySize.y * render_scale.y);
|
||||
if (fb_width == 0 || fb_height == 0)
|
||||
return;
|
||||
|
||||
// Backup SDL_Renderer state that will be modified to restore it afterwards
|
||||
struct BackupSDLRendererState
|
||||
{
|
||||
SDL_Rect Viewport;
|
||||
bool ClipEnabled;
|
||||
SDL_Rect ClipRect;
|
||||
};
|
||||
BackupSDLRendererState old = {};
|
||||
old.ClipEnabled = SDL_RenderIsClipEnabled(bd->SDLRenderer) == SDL_TRUE;
|
||||
SDL_RenderGetViewport(bd->SDLRenderer, &old.Viewport);
|
||||
SDL_RenderGetClipRect(bd->SDLRenderer, &old.ClipRect);
|
||||
|
||||
// Will project scissor/clipping rectangles into framebuffer space
|
||||
ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports
|
||||
ImVec2 clip_scale = render_scale;
|
||||
|
||||
// Render command lists
|
||||
ImGui_ImplSDLRenderer2_SetupRenderState();
|
||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||
{
|
||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||
const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
|
||||
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
|
||||
|
||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||
{
|
||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||
if (pcmd->UserCallback)
|
||||
{
|
||||
// User callback, registered via ImDrawList::AddCallback()
|
||||
// (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
|
||||
if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
|
||||
ImGui_ImplSDLRenderer2_SetupRenderState();
|
||||
else
|
||||
pcmd->UserCallback(cmd_list, pcmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Project scissor/clipping rectangles into framebuffer space
|
||||
ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y);
|
||||
ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y);
|
||||
if (clip_min.x < 0.0f) { clip_min.x = 0.0f; }
|
||||
if (clip_min.y < 0.0f) { clip_min.y = 0.0f; }
|
||||
if (clip_max.x > (float)fb_width) { clip_max.x = (float)fb_width; }
|
||||
if (clip_max.y > (float)fb_height) { clip_max.y = (float)fb_height; }
|
||||
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
|
||||
continue;
|
||||
|
||||
SDL_Rect r = { (int)(clip_min.x), (int)(clip_min.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y) };
|
||||
SDL_RenderSetClipRect(bd->SDLRenderer, &r);
|
||||
|
||||
const float* xy = (const float*)(const void*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, pos));
|
||||
const float* uv = (const float*)(const void*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, uv));
|
||||
#if SDL_VERSION_ATLEAST(2,0,19)
|
||||
const SDL_Color* color = (const SDL_Color*)(const void*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, col)); // SDL 2.0.19+
|
||||
#else
|
||||
const int* color = (const int*)(const void*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, col)); // SDL 2.0.17 and 2.0.18
|
||||
#endif
|
||||
|
||||
// Bind texture, Draw
|
||||
SDL_Texture* tex = (SDL_Texture*)pcmd->GetTexID();
|
||||
SDL_RenderGeometryRaw(bd->SDLRenderer, tex,
|
||||
xy, (int)sizeof(ImDrawVert),
|
||||
color, (int)sizeof(ImDrawVert),
|
||||
uv, (int)sizeof(ImDrawVert),
|
||||
cmd_list->VtxBuffer.Size - pcmd->VtxOffset,
|
||||
idx_buffer + pcmd->IdxOffset, pcmd->ElemCount, sizeof(ImDrawIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Restore modified SDL_Renderer state
|
||||
SDL_RenderSetViewport(bd->SDLRenderer, &old.Viewport);
|
||||
SDL_RenderSetClipRect(bd->SDLRenderer, old.ClipEnabled ? &old.ClipRect : nullptr);
|
||||
}
|
||||
|
||||
// Called by Init/NewFrame/Shutdown
|
||||
bool ImGui_ImplSDLRenderer2_CreateFontsTexture()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGui_ImplSDLRenderer2_Data* bd = ImGui_ImplSDLRenderer2_GetBackendData();
|
||||
|
||||
// Build texture atlas
|
||||
unsigned char* pixels;
|
||||
int width, height;
|
||||
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bit (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
|
||||
|
||||
// Upload texture to graphics system
|
||||
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
|
||||
bd->FontTexture = SDL_CreateTexture(bd->SDLRenderer, SDL_PIXELFORMAT_ABGR8888, SDL_TEXTUREACCESS_STATIC, width, height);
|
||||
if (bd->FontTexture == nullptr)
|
||||
{
|
||||
SDL_Log("error creating texture");
|
||||
return false;
|
||||
}
|
||||
SDL_UpdateTexture(bd->FontTexture, nullptr, pixels, 4 * width);
|
||||
SDL_SetTextureBlendMode(bd->FontTexture, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetTextureScaleMode(bd->FontTexture, SDL_ScaleModeLinear);
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->SetTexID((ImTextureID)(intptr_t)bd->FontTexture);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplSDLRenderer2_DestroyFontsTexture()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGui_ImplSDLRenderer2_Data* bd = ImGui_ImplSDLRenderer2_GetBackendData();
|
||||
if (bd->FontTexture)
|
||||
{
|
||||
io.Fonts->SetTexID(0);
|
||||
SDL_DestroyTexture(bd->FontTexture);
|
||||
bd->FontTexture = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool ImGui_ImplSDLRenderer2_CreateDeviceObjects()
|
||||
{
|
||||
return ImGui_ImplSDLRenderer2_CreateFontsTexture();
|
||||
}
|
||||
|
||||
void ImGui_ImplSDLRenderer2_DestroyDeviceObjects()
|
||||
{
|
||||
ImGui_ImplSDLRenderer2_DestroyFontsTexture();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // #ifndef IMGUI_DISABLE
|
||||
@@ -0,0 +1,41 @@
|
||||
// dear imgui: Renderer Backend for SDL_Renderer for SDL2
|
||||
// (Requires: SDL 2.0.17+)
|
||||
|
||||
// Note how SDL_Renderer is an _optional_ component of SDL2.
|
||||
// For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
|
||||
// If your application will want to render any non trivial amount of graphics other than UI,
|
||||
// please be aware that SDL_Renderer currently offers a limited graphic API to the end-user and
|
||||
// it might be difficult to step out of those boundaries.
|
||||
|
||||
// Implemented features:
|
||||
// [X] Renderer: User texture binding. Use 'SDL_Texture*' as ImTextureID. Read the FAQ about ImTextureID!
|
||||
// [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
|
||||
// Missing features:
|
||||
// [ ] Renderer: Multi-viewport support (multiple windows).
|
||||
|
||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||
// Learn about Dear ImGui:
|
||||
// - FAQ https://dearimgui.com/faq
|
||||
// - Getting Started https://dearimgui.com/getting-started
|
||||
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
||||
// - Introduction, links and more at the top of imgui.cpp
|
||||
|
||||
#pragma once
|
||||
#ifndef IMGUI_DISABLE
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
struct SDL_Renderer;
|
||||
|
||||
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer2_Init(SDL_Renderer* renderer);
|
||||
IMGUI_IMPL_API void ImGui_ImplSDLRenderer2_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplSDLRenderer2_NewFrame();
|
||||
IMGUI_IMPL_API void ImGui_ImplSDLRenderer2_RenderDrawData(ImDrawData* draw_data);
|
||||
|
||||
// Called by Init/NewFrame/Shutdown
|
||||
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer2_CreateFontsTexture();
|
||||
IMGUI_IMPL_API void ImGui_ImplSDLRenderer2_DestroyFontsTexture();
|
||||
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer2_CreateDeviceObjects();
|
||||
IMGUI_IMPL_API void ImGui_ImplSDLRenderer2_DestroyDeviceObjects();
|
||||
|
||||
#endif // #ifndef IMGUI_DISABLE
|
||||
@@ -0,0 +1,129 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// DEAR IMGUI COMPILE-TIME OPTIONS
|
||||
// Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure.
|
||||
// You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions.
|
||||
//-----------------------------------------------------------------------------
|
||||
// A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/rebased branch with your modifications to it)
|
||||
// B) or '#define IMGUI_USER_CONFIG "my_imgui_config.h"' in your project and then add directives in your own file without touching this template.
|
||||
//-----------------------------------------------------------------------------
|
||||
// You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp
|
||||
// files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures.
|
||||
// Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts.
|
||||
// Call IMGUI_CHECKVERSION() from your .cpp file to verify that the data structures your files are using are matching the ones imgui.cpp is using.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
//---- Define assertion handler. Defaults to calling assert().
|
||||
// If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement.
|
||||
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
|
||||
//#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts
|
||||
|
||||
//---- Define attributes of all API symbols declarations, e.g. for DLL under Windows
|
||||
// Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility.
|
||||
// DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions()
|
||||
// for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details.
|
||||
//#define IMGUI_API __declspec( dllexport )
|
||||
//#define IMGUI_API __declspec( dllimport )
|
||||
|
||||
//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to clean your code of obsolete function/names.
|
||||
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
//#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87: disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This will be folded into IMGUI_DISABLE_OBSOLETE_FUNCTIONS in a few versions.
|
||||
|
||||
//---- Disable all of Dear ImGui or don't implement standard windows/tools.
|
||||
// It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp.
|
||||
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
|
||||
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty.
|
||||
//#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowIDStackToolWindow() will be empty.
|
||||
|
||||
//---- Don't implement some functions to reduce linkage requirements.
|
||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a)
|
||||
//#define IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with Visual Studio] Implement default IME handler (require imm32.lib/.a, auto-link for Visual Studio, -limm32 on command-line for MinGW)
|
||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with non-Visual Studio compilers] Don't implement default IME handler (won't require imm32.lib/.a)
|
||||
//#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, IME).
|
||||
//#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default).
|
||||
//#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf)
|
||||
//#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself.
|
||||
//#define IMGUI_DISABLE_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle at all (replace them with dummies)
|
||||
//#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function.
|
||||
//#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions().
|
||||
//#define IMGUI_DISABLE_SSE // Disable use of SSE intrinsics even if available
|
||||
|
||||
//---- Include imgui_user.h at the end of imgui.h as a convenience
|
||||
//#define IMGUI_INCLUDE_IMGUI_USER_H
|
||||
|
||||
//---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another)
|
||||
//#define IMGUI_USE_BGRA_PACKED_COLOR
|
||||
|
||||
//---- Use 32-bit for ImWchar (default is 16-bit) to support unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...)
|
||||
//#define IMGUI_USE_WCHAR32
|
||||
|
||||
//---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version
|
||||
// By default the embedded implementations are declared static and not available outside of Dear ImGui sources files.
|
||||
//#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h"
|
||||
//#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h"
|
||||
//#define IMGUI_STB_SPRINTF_FILENAME "my_folder/stb_sprintf.h" // only used if IMGUI_USE_STB_SPRINTF is defined.
|
||||
//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
|
||||
//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
|
||||
//#define IMGUI_DISABLE_STB_SPRINTF_IMPLEMENTATION // only disabled if IMGUI_USE_STB_SPRINTF is defined.
|
||||
|
||||
//---- Use stb_sprintf.h for a faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined)
|
||||
// Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by stb_sprintf.h.
|
||||
//#define IMGUI_USE_STB_SPRINTF
|
||||
|
||||
//---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui)
|
||||
// Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided).
|
||||
// On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'.
|
||||
//#define IMGUI_ENABLE_FREETYPE
|
||||
|
||||
//---- Use FreeType+lunasvg library to render OpenType SVG fonts (SVGinOT)
|
||||
// Requires lunasvg headers to be available in the include path + program to be linked with the lunasvg library (not provided).
|
||||
// Only works in combination with IMGUI_ENABLE_FREETYPE.
|
||||
// (implementation is based on Freetype's rsvg-port.c which is licensed under CeCILL-C Free Software License Agreement)
|
||||
//#define IMGUI_ENABLE_FREETYPE_LUNASVG
|
||||
|
||||
//---- Use stb_truetype to build and rasterize the font atlas (default)
|
||||
// The only purpose of this define is if you want force compilation of the stb_truetype backend ALONG with the FreeType backend.
|
||||
//#define IMGUI_ENABLE_STB_TRUETYPE
|
||||
|
||||
//---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4.
|
||||
// This will be inlined as part of ImVec2 and ImVec4 class declarations.
|
||||
/*
|
||||
#define IM_VEC2_CLASS_EXTRA \
|
||||
constexpr ImVec2(const MyVec2& f) : x(f.x), y(f.y) {} \
|
||||
operator MyVec2() const { return MyVec2(x,y); }
|
||||
|
||||
#define IM_VEC4_CLASS_EXTRA \
|
||||
constexpr ImVec4(const MyVec4& f) : x(f.x), y(f.y), z(f.z), w(f.w) {} \
|
||||
operator MyVec4() const { return MyVec4(x,y,z,w); }
|
||||
*/
|
||||
//---- ...Or use Dear ImGui's own very basic math operators.
|
||||
//#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
|
||||
//---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices.
|
||||
// Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices).
|
||||
// Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer.
|
||||
// Read about ImGuiBackendFlags_RendererHasVtxOffset for details.
|
||||
//#define ImDrawIdx unsigned int
|
||||
|
||||
//---- Override ImDrawCallback signature (will need to modify renderer backends accordingly)
|
||||
//struct ImDrawList;
|
||||
//struct ImDrawCmd;
|
||||
//typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data);
|
||||
//#define ImDrawCallback MyImDrawCallback
|
||||
|
||||
//---- Debug Tools: Macro to break in Debugger (we provide a default implementation of this in the codebase)
|
||||
// (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.)
|
||||
//#define IM_DEBUG_BREAK IM_ASSERT(0)
|
||||
//#define IM_DEBUG_BREAK __debugbreak()
|
||||
|
||||
//---- Debug Tools: Enable slower asserts
|
||||
//#define IMGUI_DEBUG_PARANOID
|
||||
|
||||
//---- Tip: You can add extra functions within the ImGui:: namespace from anywhere (e.g. your own sources/header files)
|
||||
/*
|
||||
namespace ImGui
|
||||
{
|
||||
void MyFunction(const char* name, MyMatrix44* mtx);
|
||||
}
|
||||
*/
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,627 @@
|
||||
// [DEAR IMGUI]
|
||||
// This is a slightly modified version of stb_rect_pack.h 1.01.
|
||||
// Grep for [DEAR IMGUI] to find the changes.
|
||||
//
|
||||
// stb_rect_pack.h - v1.01 - public domain - rectangle packing
|
||||
// Sean Barrett 2014
|
||||
//
|
||||
// Useful for e.g. packing rectangular textures into an atlas.
|
||||
// Does not do rotation.
|
||||
//
|
||||
// Before #including,
|
||||
//
|
||||
// #define STB_RECT_PACK_IMPLEMENTATION
|
||||
//
|
||||
// in the file that you want to have the implementation.
|
||||
//
|
||||
// Not necessarily the awesomest packing method, but better than
|
||||
// the totally naive one in stb_truetype (which is primarily what
|
||||
// this is meant to replace).
|
||||
//
|
||||
// Has only had a few tests run, may have issues.
|
||||
//
|
||||
// More docs to come.
|
||||
//
|
||||
// No memory allocations; uses qsort() and assert() from stdlib.
|
||||
// Can override those by defining STBRP_SORT and STBRP_ASSERT.
|
||||
//
|
||||
// This library currently uses the Skyline Bottom-Left algorithm.
|
||||
//
|
||||
// Please note: better rectangle packers are welcome! Please
|
||||
// implement them to the same API, but with a different init
|
||||
// function.
|
||||
//
|
||||
// Credits
|
||||
//
|
||||
// Library
|
||||
// Sean Barrett
|
||||
// Minor features
|
||||
// Martins Mozeiko
|
||||
// github:IntellectualKitty
|
||||
//
|
||||
// Bugfixes / warning fixes
|
||||
// Jeremy Jaussaud
|
||||
// Fabian Giesen
|
||||
//
|
||||
// Version history:
|
||||
//
|
||||
// 1.01 (2021-07-11) always use large rect mode, expose STBRP__MAXVAL in public section
|
||||
// 1.00 (2019-02-25) avoid small space waste; gracefully fail too-wide rectangles
|
||||
// 0.99 (2019-02-07) warning fixes
|
||||
// 0.11 (2017-03-03) return packing success/fail result
|
||||
// 0.10 (2016-10-25) remove cast-away-const to avoid warnings
|
||||
// 0.09 (2016-08-27) fix compiler warnings
|
||||
// 0.08 (2015-09-13) really fix bug with empty rects (w=0 or h=0)
|
||||
// 0.07 (2015-09-13) fix bug with empty rects (w=0 or h=0)
|
||||
// 0.06 (2015-04-15) added STBRP_SORT to allow replacing qsort
|
||||
// 0.05: added STBRP_ASSERT to allow replacing assert
|
||||
// 0.04: fixed minor bug in STBRP_LARGE_RECTS support
|
||||
// 0.01: initial release
|
||||
//
|
||||
// LICENSE
|
||||
//
|
||||
// See end of file for license information.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// INCLUDE SECTION
|
||||
//
|
||||
|
||||
#ifndef STB_INCLUDE_STB_RECT_PACK_H
|
||||
#define STB_INCLUDE_STB_RECT_PACK_H
|
||||
|
||||
#define STB_RECT_PACK_VERSION 1
|
||||
|
||||
#ifdef STBRP_STATIC
|
||||
#define STBRP_DEF static
|
||||
#else
|
||||
#define STBRP_DEF extern
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct stbrp_context stbrp_context;
|
||||
typedef struct stbrp_node stbrp_node;
|
||||
typedef struct stbrp_rect stbrp_rect;
|
||||
|
||||
typedef int stbrp_coord;
|
||||
|
||||
#define STBRP__MAXVAL 0x7fffffff
|
||||
// Mostly for internal use, but this is the maximum supported coordinate value.
|
||||
|
||||
STBRP_DEF int stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int num_rects);
|
||||
// Assign packed locations to rectangles. The rectangles are of type
|
||||
// 'stbrp_rect' defined below, stored in the array 'rects', and there
|
||||
// are 'num_rects' many of them.
|
||||
//
|
||||
// Rectangles which are successfully packed have the 'was_packed' flag
|
||||
// set to a non-zero value and 'x' and 'y' store the minimum location
|
||||
// on each axis (i.e. bottom-left in cartesian coordinates, top-left
|
||||
// if you imagine y increasing downwards). Rectangles which do not fit
|
||||
// have the 'was_packed' flag set to 0.
|
||||
//
|
||||
// You should not try to access the 'rects' array from another thread
|
||||
// while this function is running, as the function temporarily reorders
|
||||
// the array while it executes.
|
||||
//
|
||||
// To pack into another rectangle, you need to call stbrp_init_target
|
||||
// again. To continue packing into the same rectangle, you can call
|
||||
// this function again. Calling this multiple times with multiple rect
|
||||
// arrays will probably produce worse packing results than calling it
|
||||
// a single time with the full rectangle array, but the option is
|
||||
// available.
|
||||
//
|
||||
// The function returns 1 if all of the rectangles were successfully
|
||||
// packed and 0 otherwise.
|
||||
|
||||
struct stbrp_rect
|
||||
{
|
||||
// reserved for your use:
|
||||
int id;
|
||||
|
||||
// input:
|
||||
stbrp_coord w, h;
|
||||
|
||||
// output:
|
||||
stbrp_coord x, y;
|
||||
int was_packed; // non-zero if valid packing
|
||||
|
||||
}; // 16 bytes, nominally
|
||||
|
||||
|
||||
STBRP_DEF void stbrp_init_target (stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes);
|
||||
// Initialize a rectangle packer to:
|
||||
// pack a rectangle that is 'width' by 'height' in dimensions
|
||||
// using temporary storage provided by the array 'nodes', which is 'num_nodes' long
|
||||
//
|
||||
// You must call this function every time you start packing into a new target.
|
||||
//
|
||||
// There is no "shutdown" function. The 'nodes' memory must stay valid for
|
||||
// the following stbrp_pack_rects() call (or calls), but can be freed after
|
||||
// the call (or calls) finish.
|
||||
//
|
||||
// Note: to guarantee best results, either:
|
||||
// 1. make sure 'num_nodes' >= 'width'
|
||||
// or 2. call stbrp_allow_out_of_mem() defined below with 'allow_out_of_mem = 1'
|
||||
//
|
||||
// If you don't do either of the above things, widths will be quantized to multiples
|
||||
// of small integers to guarantee the algorithm doesn't run out of temporary storage.
|
||||
//
|
||||
// If you do #2, then the non-quantized algorithm will be used, but the algorithm
|
||||
// may run out of temporary storage and be unable to pack some rectangles.
|
||||
|
||||
STBRP_DEF void stbrp_setup_allow_out_of_mem (stbrp_context *context, int allow_out_of_mem);
|
||||
// Optionally call this function after init but before doing any packing to
|
||||
// change the handling of the out-of-temp-memory scenario, described above.
|
||||
// If you call init again, this will be reset to the default (false).
|
||||
|
||||
|
||||
STBRP_DEF void stbrp_setup_heuristic (stbrp_context *context, int heuristic);
|
||||
// Optionally select which packing heuristic the library should use. Different
|
||||
// heuristics will produce better/worse results for different data sets.
|
||||
// If you call init again, this will be reset to the default.
|
||||
|
||||
enum
|
||||
{
|
||||
STBRP_HEURISTIC_Skyline_default=0,
|
||||
STBRP_HEURISTIC_Skyline_BL_sortHeight = STBRP_HEURISTIC_Skyline_default,
|
||||
STBRP_HEURISTIC_Skyline_BF_sortHeight
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// the details of the following structures don't matter to you, but they must
|
||||
// be visible so you can handle the memory allocations for them
|
||||
|
||||
struct stbrp_node
|
||||
{
|
||||
stbrp_coord x,y;
|
||||
stbrp_node *next;
|
||||
};
|
||||
|
||||
struct stbrp_context
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
int align;
|
||||
int init_mode;
|
||||
int heuristic;
|
||||
int num_nodes;
|
||||
stbrp_node *active_head;
|
||||
stbrp_node *free_head;
|
||||
stbrp_node extra[2]; // we allocate two extra nodes so optimal user-node-count is 'width' not 'width+2'
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPLEMENTATION SECTION
|
||||
//
|
||||
|
||||
#ifdef STB_RECT_PACK_IMPLEMENTATION
|
||||
#ifndef STBRP_SORT
|
||||
#include <stdlib.h>
|
||||
#define STBRP_SORT qsort
|
||||
#endif
|
||||
|
||||
#ifndef STBRP_ASSERT
|
||||
#include <assert.h>
|
||||
#define STBRP_ASSERT assert
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define STBRP__NOTUSED(v) (void)(v)
|
||||
#define STBRP__CDECL __cdecl
|
||||
#else
|
||||
#define STBRP__NOTUSED(v) (void)sizeof(v)
|
||||
#define STBRP__CDECL
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
STBRP__INIT_skyline = 1
|
||||
};
|
||||
|
||||
STBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic)
|
||||
{
|
||||
switch (context->init_mode) {
|
||||
case STBRP__INIT_skyline:
|
||||
STBRP_ASSERT(heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight || heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight);
|
||||
context->heuristic = heuristic;
|
||||
break;
|
||||
default:
|
||||
STBRP_ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
STBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context *context, int allow_out_of_mem)
|
||||
{
|
||||
if (allow_out_of_mem)
|
||||
// if it's ok to run out of memory, then don't bother aligning them;
|
||||
// this gives better packing, but may fail due to OOM (even though
|
||||
// the rectangles easily fit). @TODO a smarter approach would be to only
|
||||
// quantize once we've hit OOM, then we could get rid of this parameter.
|
||||
context->align = 1;
|
||||
else {
|
||||
// if it's not ok to run out of memory, then quantize the widths
|
||||
// so that num_nodes is always enough nodes.
|
||||
//
|
||||
// I.e. num_nodes * align >= width
|
||||
// align >= width / num_nodes
|
||||
// align = ceil(width/num_nodes)
|
||||
|
||||
context->align = (context->width + context->num_nodes-1) / context->num_nodes;
|
||||
}
|
||||
}
|
||||
|
||||
STBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i < num_nodes-1; ++i)
|
||||
nodes[i].next = &nodes[i+1];
|
||||
nodes[i].next = NULL;
|
||||
context->init_mode = STBRP__INIT_skyline;
|
||||
context->heuristic = STBRP_HEURISTIC_Skyline_default;
|
||||
context->free_head = &nodes[0];
|
||||
context->active_head = &context->extra[0];
|
||||
context->width = width;
|
||||
context->height = height;
|
||||
context->num_nodes = num_nodes;
|
||||
stbrp_setup_allow_out_of_mem(context, 0);
|
||||
|
||||
// node 0 is the full width, node 1 is the sentinel (lets us not store width explicitly)
|
||||
context->extra[0].x = 0;
|
||||
context->extra[0].y = 0;
|
||||
context->extra[0].next = &context->extra[1];
|
||||
context->extra[1].x = (stbrp_coord) width;
|
||||
context->extra[1].y = (1<<30);
|
||||
context->extra[1].next = NULL;
|
||||
}
|
||||
|
||||
// find minimum y position if it starts at x1
|
||||
static int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first, int x0, int width, int *pwaste)
|
||||
{
|
||||
stbrp_node *node = first;
|
||||
int x1 = x0 + width;
|
||||
int min_y, visited_width, waste_area;
|
||||
|
||||
STBRP__NOTUSED(c);
|
||||
|
||||
STBRP_ASSERT(first->x <= x0);
|
||||
|
||||
#if 0
|
||||
// skip in case we're past the node
|
||||
while (node->next->x <= x0)
|
||||
++node;
|
||||
#else
|
||||
STBRP_ASSERT(node->next->x > x0); // we ended up handling this in the caller for efficiency
|
||||
#endif
|
||||
|
||||
STBRP_ASSERT(node->x <= x0);
|
||||
|
||||
min_y = 0;
|
||||
waste_area = 0;
|
||||
visited_width = 0;
|
||||
while (node->x < x1) {
|
||||
if (node->y > min_y) {
|
||||
// raise min_y higher.
|
||||
// we've accounted for all waste up to min_y,
|
||||
// but we'll now add more waste for everything we've visted
|
||||
waste_area += visited_width * (node->y - min_y);
|
||||
min_y = node->y;
|
||||
// the first time through, visited_width might be reduced
|
||||
if (node->x < x0)
|
||||
visited_width += node->next->x - x0;
|
||||
else
|
||||
visited_width += node->next->x - node->x;
|
||||
} else {
|
||||
// add waste area
|
||||
int under_width = node->next->x - node->x;
|
||||
if (under_width + visited_width > width)
|
||||
under_width = width - visited_width;
|
||||
waste_area += under_width * (min_y - node->y);
|
||||
visited_width += under_width;
|
||||
}
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
*pwaste = waste_area;
|
||||
return min_y;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x,y;
|
||||
stbrp_node **prev_link;
|
||||
} stbrp__findresult;
|
||||
|
||||
static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int width, int height)
|
||||
{
|
||||
int best_waste = (1<<30), best_x, best_y = (1 << 30);
|
||||
stbrp__findresult fr;
|
||||
stbrp_node **prev, *node, *tail, **best = NULL;
|
||||
|
||||
// align to multiple of c->align
|
||||
width = (width + c->align - 1);
|
||||
width -= width % c->align;
|
||||
STBRP_ASSERT(width % c->align == 0);
|
||||
|
||||
// if it can't possibly fit, bail immediately
|
||||
if (width > c->width || height > c->height) {
|
||||
fr.prev_link = NULL;
|
||||
fr.x = fr.y = 0;
|
||||
return fr;
|
||||
}
|
||||
|
||||
node = c->active_head;
|
||||
prev = &c->active_head;
|
||||
while (node->x + width <= c->width) {
|
||||
int y,waste;
|
||||
y = stbrp__skyline_find_min_y(c, node, node->x, width, &waste);
|
||||
if (c->heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight) { // actually just want to test BL
|
||||
// bottom left
|
||||
if (y < best_y) {
|
||||
best_y = y;
|
||||
best = prev;
|
||||
}
|
||||
} else {
|
||||
// best-fit
|
||||
if (y + height <= c->height) {
|
||||
// can only use it if it first vertically
|
||||
if (y < best_y || (y == best_y && waste < best_waste)) {
|
||||
best_y = y;
|
||||
best_waste = waste;
|
||||
best = prev;
|
||||
}
|
||||
}
|
||||
}
|
||||
prev = &node->next;
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
best_x = (best == NULL) ? 0 : (*best)->x;
|
||||
|
||||
// if doing best-fit (BF), we also have to try aligning right edge to each node position
|
||||
//
|
||||
// e.g, if fitting
|
||||
//
|
||||
// ____________________
|
||||
// |____________________|
|
||||
//
|
||||
// into
|
||||
//
|
||||
// | |
|
||||
// | ____________|
|
||||
// |____________|
|
||||
//
|
||||
// then right-aligned reduces waste, but bottom-left BL is always chooses left-aligned
|
||||
//
|
||||
// This makes BF take about 2x the time
|
||||
|
||||
if (c->heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight) {
|
||||
tail = c->active_head;
|
||||
node = c->active_head;
|
||||
prev = &c->active_head;
|
||||
// find first node that's admissible
|
||||
while (tail->x < width)
|
||||
tail = tail->next;
|
||||
while (tail) {
|
||||
int xpos = tail->x - width;
|
||||
int y,waste;
|
||||
STBRP_ASSERT(xpos >= 0);
|
||||
// find the left position that matches this
|
||||
while (node->next->x <= xpos) {
|
||||
prev = &node->next;
|
||||
node = node->next;
|
||||
}
|
||||
STBRP_ASSERT(node->next->x > xpos && node->x <= xpos);
|
||||
y = stbrp__skyline_find_min_y(c, node, xpos, width, &waste);
|
||||
if (y + height <= c->height) {
|
||||
if (y <= best_y) {
|
||||
if (y < best_y || waste < best_waste || (waste==best_waste && xpos < best_x)) {
|
||||
best_x = xpos;
|
||||
//STBRP_ASSERT(y <= best_y); [DEAR IMGUI]
|
||||
best_y = y;
|
||||
best_waste = waste;
|
||||
best = prev;
|
||||
}
|
||||
}
|
||||
}
|
||||
tail = tail->next;
|
||||
}
|
||||
}
|
||||
|
||||
fr.prev_link = best;
|
||||
fr.x = best_x;
|
||||
fr.y = best_y;
|
||||
return fr;
|
||||
}
|
||||
|
||||
static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, int width, int height)
|
||||
{
|
||||
// find best position according to heuristic
|
||||
stbrp__findresult res = stbrp__skyline_find_best_pos(context, width, height);
|
||||
stbrp_node *node, *cur;
|
||||
|
||||
// bail if:
|
||||
// 1. it failed
|
||||
// 2. the best node doesn't fit (we don't always check this)
|
||||
// 3. we're out of memory
|
||||
if (res.prev_link == NULL || res.y + height > context->height || context->free_head == NULL) {
|
||||
res.prev_link = NULL;
|
||||
return res;
|
||||
}
|
||||
|
||||
// on success, create new node
|
||||
node = context->free_head;
|
||||
node->x = (stbrp_coord) res.x;
|
||||
node->y = (stbrp_coord) (res.y + height);
|
||||
|
||||
context->free_head = node->next;
|
||||
|
||||
// insert the new node into the right starting point, and
|
||||
// let 'cur' point to the remaining nodes needing to be
|
||||
// stiched back in
|
||||
|
||||
cur = *res.prev_link;
|
||||
if (cur->x < res.x) {
|
||||
// preserve the existing one, so start testing with the next one
|
||||
stbrp_node *next = cur->next;
|
||||
cur->next = node;
|
||||
cur = next;
|
||||
} else {
|
||||
*res.prev_link = node;
|
||||
}
|
||||
|
||||
// from here, traverse cur and free the nodes, until we get to one
|
||||
// that shouldn't be freed
|
||||
while (cur->next && cur->next->x <= res.x + width) {
|
||||
stbrp_node *next = cur->next;
|
||||
// move the current node to the free list
|
||||
cur->next = context->free_head;
|
||||
context->free_head = cur;
|
||||
cur = next;
|
||||
}
|
||||
|
||||
// stitch the list back in
|
||||
node->next = cur;
|
||||
|
||||
if (cur->x < res.x + width)
|
||||
cur->x = (stbrp_coord) (res.x + width);
|
||||
|
||||
#ifdef _DEBUG
|
||||
cur = context->active_head;
|
||||
while (cur->x < context->width) {
|
||||
STBRP_ASSERT(cur->x < cur->next->x);
|
||||
cur = cur->next;
|
||||
}
|
||||
STBRP_ASSERT(cur->next == NULL);
|
||||
|
||||
{
|
||||
int count=0;
|
||||
cur = context->active_head;
|
||||
while (cur) {
|
||||
cur = cur->next;
|
||||
++count;
|
||||
}
|
||||
cur = context->free_head;
|
||||
while (cur) {
|
||||
cur = cur->next;
|
||||
++count;
|
||||
}
|
||||
STBRP_ASSERT(count == context->num_nodes+2);
|
||||
}
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int STBRP__CDECL rect_height_compare(const void *a, const void *b)
|
||||
{
|
||||
const stbrp_rect *p = (const stbrp_rect *) a;
|
||||
const stbrp_rect *q = (const stbrp_rect *) b;
|
||||
if (p->h > q->h)
|
||||
return -1;
|
||||
if (p->h < q->h)
|
||||
return 1;
|
||||
return (p->w > q->w) ? -1 : (p->w < q->w);
|
||||
}
|
||||
|
||||
static int STBRP__CDECL rect_original_order(const void *a, const void *b)
|
||||
{
|
||||
const stbrp_rect *p = (const stbrp_rect *) a;
|
||||
const stbrp_rect *q = (const stbrp_rect *) b;
|
||||
return (p->was_packed < q->was_packed) ? -1 : (p->was_packed > q->was_packed);
|
||||
}
|
||||
|
||||
STBRP_DEF int stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects)
|
||||
{
|
||||
int i, all_rects_packed = 1;
|
||||
|
||||
// we use the 'was_packed' field internally to allow sorting/unsorting
|
||||
for (i=0; i < num_rects; ++i) {
|
||||
rects[i].was_packed = i;
|
||||
}
|
||||
|
||||
// sort according to heuristic
|
||||
STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_height_compare);
|
||||
|
||||
for (i=0; i < num_rects; ++i) {
|
||||
if (rects[i].w == 0 || rects[i].h == 0) {
|
||||
rects[i].x = rects[i].y = 0; // empty rect needs no space
|
||||
} else {
|
||||
stbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h);
|
||||
if (fr.prev_link) {
|
||||
rects[i].x = (stbrp_coord) fr.x;
|
||||
rects[i].y = (stbrp_coord) fr.y;
|
||||
} else {
|
||||
rects[i].x = rects[i].y = STBRP__MAXVAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// unsort
|
||||
STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order);
|
||||
|
||||
// set was_packed flags and all_rects_packed status
|
||||
for (i=0; i < num_rects; ++i) {
|
||||
rects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL);
|
||||
if (!rects[i].was_packed)
|
||||
all_rects_packed = 0;
|
||||
}
|
||||
|
||||
// return the all_rects_packed status
|
||||
return all_rects_packed;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
This software is available under 2 licenses -- choose whichever you prefer.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE A - MIT License
|
||||
Copyright (c) 2017 Sean Barrett
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE B - Public Domain (www.unlicense.org)
|
||||
This is free and unencumbered software released into the public domain.
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
|
||||
software, either in source code form or as a compiled binary, for any purpose,
|
||||
commercial or non-commercial, and by any means.
|
||||
In jurisdictions that recognize copyright laws, the author or authors of this
|
||||
software dedicate any and all copyright interest in the software to the public
|
||||
domain. We make this dedication for the benefit of the public at large and to
|
||||
the detriment of our heirs and successors. We intend this dedication to be an
|
||||
overt act of relinquishment in perpetuity of all present and future rights to
|
||||
this software under copyright law.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+24
-10
@@ -10,6 +10,7 @@
|
||||
#include "config.h"
|
||||
#include "utils.h"
|
||||
#include "system.h"
|
||||
#include "debugger.h"
|
||||
#include "fs.h"
|
||||
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 14)
|
||||
@@ -549,6 +550,8 @@ static int inputEventFilter(void *data, SDL_Event *event)
|
||||
break;
|
||||
}
|
||||
|
||||
debuggerProcessEvent(event);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -889,16 +892,27 @@ static inline void inputUpdateMouse(void)
|
||||
mouseX = mx;
|
||||
mouseY = my;
|
||||
|
||||
// if MLOCK_AUTO is enabled, disable cursor if mouse is unlocked
|
||||
// and we haven't moved it for a few seconds
|
||||
if (mouseLockMode == MLOCK_AUTO && !mouseLocked) {
|
||||
if (abs(mouseDX) > CURSOR_HIDE_THRESHOLD || abs(mouseDY) > CURSOR_HIDE_THRESHOLD) {
|
||||
if (!mouseShowCursor) {
|
||||
inputMouseShowCursor(1);
|
||||
}
|
||||
} else if (sysGetMicroseconds() > mouseCursorTime) {
|
||||
if (mouseShowCursor) {
|
||||
inputMouseShowCursor(0);
|
||||
const s32 mouseFocus = (SDL_GetMouseFocus() == videoGetWindowHandle());
|
||||
if (!mouseFocus) {
|
||||
mouseDX = 0;
|
||||
mouseDY = 0;
|
||||
mouseWheel = 0;
|
||||
mouseButtons = 0;
|
||||
if (!mouseShowCursor) {
|
||||
inputMouseShowCursor(1);
|
||||
}
|
||||
} else {
|
||||
// if MLOCK_AUTO is enabled, disable cursor if mouse is unlocked
|
||||
// and we haven't moved it for a few seconds
|
||||
if (mouseLockMode == MLOCK_AUTO && !mouseLocked) {
|
||||
if (abs(mouseDX) > CURSOR_HIDE_THRESHOLD || abs(mouseDY) > CURSOR_HIDE_THRESHOLD) {
|
||||
if (!mouseShowCursor) {
|
||||
inputMouseShowCursor(1);
|
||||
}
|
||||
} else if (sysGetMicroseconds() > mouseCursorTime) {
|
||||
if (mouseShowCursor) {
|
||||
inputMouseShowCursor(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-18
@@ -16,9 +16,8 @@
|
||||
#include "config.h"
|
||||
#include "mod.h"
|
||||
#include "system.h"
|
||||
#include "console.h"
|
||||
#include "debugger.h"
|
||||
#include "utils.h"
|
||||
#include "net/net.h"
|
||||
|
||||
u32 g_OsMemSize = 0;
|
||||
s32 g_OsMemSizeMb = 16;
|
||||
@@ -71,7 +70,7 @@ static void gameInit(void)
|
||||
{
|
||||
osMemSize = g_OsMemSizeMb * 1024 * 1024;
|
||||
|
||||
for (s32 i = 0; i < MAX_LOCAL_PLAYERS; ++i) {
|
||||
for (s32 i = 0; i < MAX_PLAYERS; ++i) {
|
||||
struct extplayerconfig *cfg = g_PlayerExtCfg + i;
|
||||
cfg->fovzoommult = cfg->fovzoom ? cfg->fovy / 60.0f : 1.0f;
|
||||
}
|
||||
@@ -88,7 +87,6 @@ static void gameInit(void)
|
||||
static void cleanup(void)
|
||||
{
|
||||
sysLogPrintf(LOG_NOTE, "shutdown");
|
||||
netDisconnect();
|
||||
inputSaveBinds();
|
||||
configSave(CONFIG_PATH);
|
||||
videoShutdown();
|
||||
@@ -104,7 +102,6 @@ int main(int argc, const char **argv)
|
||||
crashInit();
|
||||
}
|
||||
|
||||
conInit();
|
||||
sysInit();
|
||||
fsInit();
|
||||
configInit();
|
||||
@@ -112,7 +109,7 @@ int main(int argc, const char **argv)
|
||||
inputInit();
|
||||
audioInit();
|
||||
romdataInit();
|
||||
netInit();
|
||||
debuggerInit();
|
||||
|
||||
g_ValidGbcRomFound = romdataCheckGbcRom();
|
||||
|
||||
@@ -141,8 +138,6 @@ int main(int argc, const char **argv)
|
||||
|
||||
g_StageNum = sysArgGetInt("--boot-stage", STAGE_TITLE);
|
||||
|
||||
g_FileAutoSelect = sysArgGetInt("--profile", -1);
|
||||
|
||||
if (g_StageNum == STAGE_TITLE && (sysArgCheck("--skip-intro") || g_SkipIntro)) {
|
||||
// shorthand for --boot-stage 0x26
|
||||
g_StageNum = STAGE_CITRAINING;
|
||||
@@ -151,19 +146,11 @@ int main(int argc, const char **argv)
|
||||
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) {
|
||||
sysLogPrintf(LOG_NOTE, "boot stage set to 0x%02x", g_StageNum);
|
||||
}
|
||||
|
||||
g_FileAutoSelect = sysArgGetInt("--profile", -1);
|
||||
if (g_FileAutoSelect >= 0) {
|
||||
sysLogPrintf(LOG_NOTE, "player profile set to %d", g_FileAutoSelect);
|
||||
}
|
||||
@@ -184,7 +171,7 @@ PD_CONSTRUCTOR static void gameConfigInit(void)
|
||||
configRegisterInt("Game.SkipIntro", &g_SkipIntro, 0, 1);
|
||||
configRegisterInt("Game.DisableMpDeathMusic", &g_MusicDisableMpDeath, 0, 1);
|
||||
configRegisterInt("Game.GEMuzzleFlashes", &g_BgunGeMuzzleFlashes, 0, 1);
|
||||
for (s32 j = 0; j < MAX_LOCAL_PLAYERS; ++j) {
|
||||
for (s32 j = 0; j < MAX_PLAYERS; ++j) {
|
||||
const s32 i = j + 1;
|
||||
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);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "mixer.h"
|
||||
#include "platform.h"
|
||||
|
||||
#define MINIMP3_IMPLEMENTATION
|
||||
#include "external/minimp3.h"
|
||||
|
||||
#ifdef __SSE4_1__
|
||||
|
||||
-1127
File diff suppressed because it is too large.
Load diff
@@ -1,305 +0,0 @@
|
||||
#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));
|
||||
}
|
||||
@@ -1,422 +0,0 @@
|
||||
#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 "game/filelist.h"
|
||||
#include "video.h"
|
||||
#include "input.h"
|
||||
#include "config.h"
|
||||
#include "mpsetups.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);
|
||||
extern struct menuitem g_MpPlayerSetup234MenuItems[];
|
||||
extern struct menudialogdef g_NetJoinPlayerSetupMenuDialog;
|
||||
|
||||
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) {
|
||||
// load the setup file when entering the Combat Simulator
|
||||
mpsetupCopyAllFromPak();
|
||||
mpsetupLoadCurrentFile();
|
||||
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 | MENUDIALOGFLAG_STARTSELECTS,
|
||||
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, false) < 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;
|
||||
}
|
||||
|
||||
static MenuItemHandlerResult menuhandlerJoinPlayerSetup(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||
{
|
||||
if (operation == MENUOP_SET) {
|
||||
// load MP player file
|
||||
filelistCreate(0, FILETYPE_MPPLAYER);
|
||||
filelistsTick();
|
||||
menuPushDialog(&g_NetJoinPlayerSetupMenuDialog);
|
||||
}
|
||||
|
||||
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_028, // "Player Setup"
|
||||
0,
|
||||
menuhandlerJoinPlayerSetup,
|
||||
},
|
||||
{
|
||||
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,
|
||||
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 | MENUDIALOGFLAG_STARTSELECTS,
|
||||
NULL,
|
||||
};
|
||||
|
||||
struct menudialogdef g_NetJoinPlayerSetupMenuDialog = {
|
||||
MENUDIALOGTYPE_DEFAULT,
|
||||
L_MPMENU_028, // "Player Setup"
|
||||
g_MpPlayerSetup234MenuItems,
|
||||
NULL,
|
||||
MENUDIALOGFLAG_DROPOUTONCLOSE | MENUDIALOGFLAG_STARTSELECTS,
|
||||
NULL,
|
||||
};
|
||||
File diff suppressed because it is too large.
Load diff
+25
-27
@@ -72,10 +72,8 @@
|
||||
#include "lib/str.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
#include "debugger.h"
|
||||
#include "system.h"
|
||||
#include "console.h"
|
||||
#include "net/net.h"
|
||||
#include "net/netmsg.h"
|
||||
|
||||
extern u8 *g_MempHeap;
|
||||
extern u32 g_MempHeapSize;
|
||||
@@ -424,9 +422,6 @@ void mainLoop(void)
|
||||
|
||||
if (argFindByPrefix(1, "-ma")) {
|
||||
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);
|
||||
@@ -468,15 +463,7 @@ void mainLoop(void)
|
||||
}
|
||||
|
||||
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
|
||||
#ifdef PLATFORM_N64
|
||||
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();
|
||||
} else if (g_Vars.perfectbuddynum) {
|
||||
mpReset();
|
||||
@@ -484,8 +471,16 @@ void mainLoop(void)
|
||||
&& (numplayers >= 2 || g_Vars.lvmpbotlevel || argFindByPrefix(1, "-play"))) {
|
||||
g_MpSetup.chrslots = 1;
|
||||
|
||||
for (s32 i = 1; i < numplayers; ++i) {
|
||||
g_MpSetup.chrslots |= 1 << i;
|
||||
if (numplayers >= 2) {
|
||||
g_MpSetup.chrslots |= 1 << 1;
|
||||
}
|
||||
|
||||
if (numplayers >= 3) {
|
||||
g_MpSetup.chrslots |= 1 << 2;
|
||||
}
|
||||
|
||||
if (numplayers >= 4) {
|
||||
g_MpSetup.chrslots |= 1 << 3;
|
||||
}
|
||||
|
||||
g_MpSetup.stagenum = g_StageNum;
|
||||
@@ -539,6 +534,15 @@ void mainTick(void)
|
||||
joyDebugJoy();
|
||||
schedSetCrashEnable2(false);
|
||||
|
||||
if (g_DebuggerTimePasses) {
|
||||
g_MainGameLogicEnabled = true;
|
||||
} else {
|
||||
g_MainGameLogicEnabled = (g_DebuggerFrameAdvance > 0);
|
||||
if (g_MainGameLogicEnabled) {
|
||||
--g_DebuggerFrameAdvance;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_MainGameLogicEnabled) {
|
||||
gdl = gdlstart = gfxGetMasterDisplayList();
|
||||
|
||||
@@ -569,9 +573,6 @@ void mainTick(void)
|
||||
gdl = profileRender(gdl);
|
||||
}
|
||||
|
||||
gdl = conRender(gdl);
|
||||
gdl = netDebugRender(gdl);
|
||||
|
||||
gDPFullSync(gdl++);
|
||||
gSPEndDisplayList(gdl++);
|
||||
}
|
||||
@@ -579,11 +580,10 @@ void mainTick(void)
|
||||
if (g_MainGameLogicEnabled) {
|
||||
gfxSwapBuffers();
|
||||
viUpdateMode();
|
||||
rdpCreateTask(gdlstart, gdl, 0, (uintptr_t) &msg);
|
||||
memaPrint();
|
||||
profileSetMarker(PROFILE_MAINTICK_END);
|
||||
}
|
||||
|
||||
rdpCreateTask(gdlstart, gdl, 0, (uintptr_t) &msg);
|
||||
memaPrint();
|
||||
profileSetMarker(PROFILE_MAINTICK_END);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -599,7 +599,7 @@ void mainEndStage(void)
|
||||
s32 prevplayernum = g_Vars.currentplayernum;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < LOCALPLAYERCOUNT(); i++) {
|
||||
for (i = 0; i < PLAYERCOUNT(); i++) {
|
||||
setCurrentPlayerNum(i);
|
||||
endscreenPushCoop();
|
||||
}
|
||||
@@ -610,7 +610,7 @@ void mainEndStage(void)
|
||||
s32 prevplayernum = g_Vars.currentplayernum;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < LOCALPLAYERCOUNT(); i++) {
|
||||
for (i = 0; i < PLAYERCOUNT(); i++) {
|
||||
setCurrentPlayerNum(i);
|
||||
endscreenPushAnti();
|
||||
}
|
||||
@@ -623,8 +623,6 @@ void mainEndStage(void)
|
||||
endscreenPrepare();
|
||||
musicStartMenu();
|
||||
}
|
||||
|
||||
netServerStageEnd();
|
||||
}
|
||||
|
||||
g_MainIsEndscreen = true;
|
||||
|
||||
+6
-23
@@ -24,9 +24,8 @@
|
||||
#include "video.h"
|
||||
#include "audio.h"
|
||||
#include "input.h"
|
||||
#include "console.h"
|
||||
#include "mixer.h"
|
||||
#include "net/net.h"
|
||||
#include "debugger.h"
|
||||
|
||||
/*
|
||||
* private typedefs and defines
|
||||
@@ -241,15 +240,8 @@ void schedSubmitTask(OSSched *sc, OSScTask *t)
|
||||
|
||||
void schedStartFrame(OSSched *sc)
|
||||
{
|
||||
debuggerStartFrame();
|
||||
videoStartFrame();
|
||||
if (g_Vars.diffframe60) {
|
||||
if (g_NetMode) {
|
||||
videoCapFramerate(120);
|
||||
netStartFrame();
|
||||
} else {
|
||||
videoCapFramerate(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void schedAudioFrame(OSSched *sc)
|
||||
@@ -280,8 +272,6 @@ void schedAudioFrame(OSSched *sc)
|
||||
*/
|
||||
void schedEndFrame(OSSched *sc)
|
||||
{
|
||||
static bool netDebugKey = false;
|
||||
|
||||
sc->frameCount++;
|
||||
|
||||
#if PAL
|
||||
@@ -300,26 +290,19 @@ void schedEndFrame(OSSched *sc)
|
||||
viHandleRetrace();
|
||||
}
|
||||
|
||||
inputUpdate();
|
||||
conTick();
|
||||
debuggerFrame();
|
||||
|
||||
const bool newKey = inputKeyPressed(VK_F9);
|
||||
if (!netDebugKey && newKey) {
|
||||
g_NetDebugDraw = !g_NetDebugDraw;
|
||||
}
|
||||
netDebugKey = newKey;
|
||||
inputUpdate();
|
||||
|
||||
joyStartReadData(&g_PiMesgQueue);
|
||||
joyReadData();
|
||||
joy00014238();
|
||||
|
||||
if (g_Vars.diffframe60) {
|
||||
netEndFrame();
|
||||
}
|
||||
|
||||
sndHandleRetrace();
|
||||
schedAudioFrame(sc);
|
||||
schedRenderCrashPeriodically(sc->frameCount);
|
||||
|
||||
debuggerEndFrame();
|
||||
videoEndFrame();
|
||||
|
||||
if (g_MainIsBooting == 0) {
|
||||
|
||||
@@ -50,10 +50,6 @@ u8 *preprocessMpConfigs(u8* data, u32 size, u32* outSize)
|
||||
PD_SWAP_VAL(cfg->setup.options);
|
||||
PD_SWAP_VAL(cfg->setup.teamscorelimit);
|
||||
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?
|
||||
PD_SWAP_VAL(cfg->setup.fileguid.deviceserial);
|
||||
PD_SWAP_VAL(cfg->setup.fileguid.fileid);
|
||||
|
||||
+5
-5
@@ -55,10 +55,10 @@
|
||||
|
||||
u8 *g_RomFile;
|
||||
u32 g_RomFileSize;
|
||||
const char *g_RomName = ROMDATA_ROM_NAME;
|
||||
|
||||
static u8 *romDataSeg;
|
||||
static u32 romDataSegSize;
|
||||
static const char *romName = ROMDATA_ROM_NAME;
|
||||
|
||||
enum loadsource {
|
||||
SRC_UNLOADED = 0,
|
||||
@@ -190,12 +190,12 @@ static inline void romdataWrongRomError(const char *fmt, ...)
|
||||
|
||||
static inline void romdataLoadRom(void)
|
||||
{
|
||||
sysLogPrintf(LOG_NOTE, "ROM file: %s", g_RomName);
|
||||
sysLogPrintf(LOG_NOTE, "ROM file: %s", romName);
|
||||
|
||||
g_RomFile = fsFileLoad(g_RomName, &g_RomFileSize);
|
||||
g_RomFile = fsFileLoad(romName, &g_RomFileSize);
|
||||
|
||||
if (!g_RomFile) {
|
||||
sysFatalError("Could not open ROM file %s.\nEnsure that it is in the %s directory.", g_RomName, fsFullPath(""));
|
||||
sysFatalError("Could not open ROM file %s.\nEnsure that it is in the %s directory.", romName, fsFullPath(""));
|
||||
}
|
||||
|
||||
// zips are not guaranteed to start with PK, but might as well at least try
|
||||
@@ -383,7 +383,7 @@ s32 romdataInit(void)
|
||||
{
|
||||
const char *altRomName = sysArgGetString("--rom-file");
|
||||
if (altRomName) {
|
||||
g_RomName = altRomName;
|
||||
romName = altRomName;
|
||||
}
|
||||
|
||||
romdataLoadRom();
|
||||
|
||||
+2
-14
@@ -12,7 +12,6 @@
|
||||
#include <SDL.h>
|
||||
#include <PR/ultratypes.h>
|
||||
#include "platform.h"
|
||||
#include "console.h"
|
||||
#include "system.h"
|
||||
|
||||
#ifdef PLATFORM_WIN32
|
||||
@@ -158,12 +157,6 @@ u64 sysGetMicroseconds(void)
|
||||
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)
|
||||
{
|
||||
return (logPath[0] != '\0');
|
||||
@@ -190,13 +183,8 @@ void sysLogPrintf(s32 level, const char *fmt, ...)
|
||||
}
|
||||
}
|
||||
|
||||
FILE *fout = ((level & 0x0f) == LOG_NOTE) ? stdout : stderr;
|
||||
fprintf(fout, "%s%s\n", prefix[level & 0x0f], logmsg);
|
||||
fflush(fout);
|
||||
|
||||
if ((level & LOGFLAG_NOCON) == 0) {
|
||||
conPrintLn((level & LOGFLAG_SHOWMSG) != 0, logmsg);
|
||||
}
|
||||
FILE *fout = (level == LOG_NOTE) ? stdout : stderr;
|
||||
fprintf(fout, "%s%s\n", prefix[level], logmsg);
|
||||
}
|
||||
|
||||
void sysFatalError(const char *fmt, ...)
|
||||
|
||||
@@ -447,14 +447,6 @@ void videoSetDetailTextures(s32 detail)
|
||||
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)
|
||||
{
|
||||
return gfx_create_framebuffer(w, h, upscale, autoresize);
|
||||
|
||||
+29
-29
@@ -26,7 +26,7 @@
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
struct activemenu g_AmMenus[MAX_LOCAL_PLAYERS];
|
||||
struct activemenu g_AmMenus[MAX_PLAYERS];
|
||||
struct fontchar *g_AmFont1;
|
||||
struct font *g_AmFont2;
|
||||
s32 g_AmIndex;
|
||||
@@ -547,7 +547,7 @@ void amReset(void)
|
||||
g_AmFont1 = g_CharsHandelGothicSm;
|
||||
g_AmFont2 = g_FontHandelGothicSm;
|
||||
#else
|
||||
if (LOCALPLAYERCOUNT() >= 2) {
|
||||
if (PLAYERCOUNT() >= 2) {
|
||||
g_AmFont1 = g_CharsHandelGothicXs;
|
||||
g_AmFont2 = g_FontHandelGothicXs;
|
||||
} else {
|
||||
@@ -578,7 +578,7 @@ s16 amCalculateSlotWidth(void)
|
||||
}
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (LOCALPLAYERCOUNT() > 1) {
|
||||
if (PLAYERCOUNT() > 1) {
|
||||
max += 3;
|
||||
} else {
|
||||
max += 4;
|
||||
@@ -762,32 +762,32 @@ void amClose(void)
|
||||
bool amIsCramped(void)
|
||||
{
|
||||
#if VERSION == VERSION_JPN_FINAL
|
||||
if (LOCALPLAYERCOUNT() >= 3 && g_AmMenus[g_AmIndex].screenindex != 1) {
|
||||
if (PLAYERCOUNT() >= 3 && g_AmMenus[g_AmIndex].screenindex != 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IS4MB() && LOCALPLAYERCOUNT() == 2) {
|
||||
if (IS4MB() && PLAYERCOUNT() == 2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||
&& LOCALPLAYERCOUNT() == 2
|
||||
&& PLAYERCOUNT() == 2
|
||||
&& g_AmMenus[g_AmIndex].screenindex != 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
#else
|
||||
return (g_AmMenus[g_AmIndex].screenindex == 0 && LOCALPLAYERCOUNT() >= 3)
|
||||
|| (IS4MB() && LOCALPLAYERCOUNT() == 2)
|
||||
|| (LOCALPLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL);
|
||||
return (g_AmMenus[g_AmIndex].screenindex == 0 && PLAYERCOUNT() >= 3)
|
||||
|| (IS4MB() && PLAYERCOUNT() == 2)
|
||||
|| (PLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void amCalculateSlotPosition(s16 column, s16 row, s16 *x, s16 *y)
|
||||
{
|
||||
#if VERSION == VERSION_JPN_FINAL
|
||||
s32 playercount = LOCALPLAYERCOUNT();
|
||||
s32 playercount = PLAYERCOUNT();
|
||||
|
||||
*x = g_AmMenus[g_AmIndex].xradius * (column - 1);
|
||||
*y = (row - 1) * 50;
|
||||
@@ -841,7 +841,7 @@ void amCalculateSlotPosition(s16 column, s16 row, s16 *x, s16 *y)
|
||||
}
|
||||
}
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
s32 playercount = LOCALPLAYERCOUNT();
|
||||
s32 playercount = PLAYERCOUNT();
|
||||
|
||||
*x = g_AmMenus[g_AmIndex].xradius * (column - 1);
|
||||
*y = (row - 1) * 50;
|
||||
@@ -893,7 +893,7 @@ void amCalculateSlotPosition(s16 column, s16 row, s16 *x, s16 *y)
|
||||
}
|
||||
}
|
||||
#else
|
||||
s32 playercount = LOCALPLAYERCOUNT();
|
||||
s32 playercount = PLAYERCOUNT();
|
||||
|
||||
*x = g_AmMenus[g_AmIndex].xradius * (column - 1);
|
||||
*y = (row - 1) * 50;
|
||||
@@ -973,15 +973,15 @@ Gfx *amRenderAibotInfo(Gfx *gdl, s32 buddynum)
|
||||
#endif
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (LOCALPLAYERCOUNT() == 1 && optionsGetEffectiveScreenSize() != SCREENSIZE_FULL) {
|
||||
if (PLAYERCOUNT() == 1 && optionsGetEffectiveScreenSize() != SCREENSIZE_FULL) {
|
||||
wide = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if ((LOCALPLAYERCOUNT() == 2 && (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || IS4MB())) || LOCALPLAYERCOUNT() >= 3)
|
||||
if ((PLAYERCOUNT() == 2 && (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || IS4MB())) || PLAYERCOUNT() >= 3)
|
||||
#else
|
||||
if ((LOCALPLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) || LOCALPLAYERCOUNT() >= 3)
|
||||
if ((PLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) || PLAYERCOUNT() >= 3)
|
||||
#endif
|
||||
{
|
||||
if ((g_Vars.currentplayernum % 2) == 0) {
|
||||
@@ -1014,7 +1014,7 @@ Gfx *amRenderAibotInfo(Gfx *gdl, s32 buddynum)
|
||||
- (s32)(textwidth * 0.5f)
|
||||
+ offset;
|
||||
|
||||
if (LOCALPLAYERCOUNT() >= 2) {
|
||||
if (PLAYERCOUNT() >= 2) {
|
||||
y = viGetViewTop() + 5;
|
||||
} else {
|
||||
y = viGetViewTop() + 10;
|
||||
@@ -1030,12 +1030,12 @@ Gfx *amRenderAibotInfo(Gfx *gdl, s32 buddynum)
|
||||
gdl = func0f1574d0jf(gdl, &x, &y, aibotname, g_AmFont1, g_AmFont2, -1,
|
||||
0x000000ff, SCREEN_320, SCREEN_240, 0, 0);
|
||||
|
||||
y += (LOCALPLAYERCOUNT() >= 2) ? 0 : (s32)(textheight * 1.1f);
|
||||
y += (PLAYERCOUNT() >= 2) ? 0 : (s32)(textheight * 1.1f);
|
||||
#else
|
||||
gdl = textRender(gdl, &x, &y, aibotname, g_AmFont1, g_AmFont2, -1,
|
||||
0x000000ff, SCREEN_320, SCREEN_240, 0, 0);
|
||||
|
||||
y += (LOCALPLAYERCOUNT() >= 2) ? 0 : (s32)(textheight * 1.1f);
|
||||
y += (PLAYERCOUNT() >= 2) ? 0 : (s32)(textheight * 1.1f);
|
||||
textMeasure(&textheight, &textwidth, weaponname, g_AmFont1, g_AmFont2, 0);
|
||||
|
||||
x = viGetViewLeft() / g_ScaleX
|
||||
@@ -1064,7 +1064,7 @@ Gfx *amRenderAibotInfo(Gfx *gdl, s32 buddynum)
|
||||
- (s32)(textwidth * 0.5f)
|
||||
+ offset;
|
||||
|
||||
if (LOCALPLAYERCOUNT() >= 2) {
|
||||
if (PLAYERCOUNT() >= 2) {
|
||||
y = viGetViewTop() + 5;
|
||||
} else {
|
||||
y = viGetViewTop() + 10;
|
||||
@@ -1123,7 +1123,7 @@ Gfx *amRenderSlot(Gfx *gdl, char *text, s16 x, s16 y, s32 mode, s32 flags)
|
||||
paddingtop = 6;
|
||||
paddingbottom = 6;
|
||||
|
||||
if (LOCALPLAYERCOUNT() >= 2) {
|
||||
if (PLAYERCOUNT() >= 2) {
|
||||
paddingtop = 5;
|
||||
paddingbottom = 3;
|
||||
}
|
||||
@@ -1262,7 +1262,7 @@ Gfx *amRender(Gfx *gdl)
|
||||
#endif
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
const s32 playercount = LOCALPLAYERCOUNT();
|
||||
const s32 playercount = PLAYERCOUNT();
|
||||
if (playercount < 2 || (playercount == 2 && optionsGetScreenSplit() == SCREENSPLIT_HORIZONTAL)) {
|
||||
gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT);
|
||||
}
|
||||
@@ -1487,7 +1487,7 @@ Gfx *amRender(Gfx *gdl)
|
||||
above = 6;
|
||||
below = 6;
|
||||
|
||||
if (LOCALPLAYERCOUNT() >= 2) {
|
||||
if (PLAYERCOUNT() >= 2) {
|
||||
above = 5;
|
||||
below = 3;
|
||||
}
|
||||
@@ -1510,7 +1510,7 @@ Gfx *amRender(Gfx *gdl)
|
||||
halfwidth = 1;
|
||||
above = 2;
|
||||
below = 0;
|
||||
} else if (LOCALPLAYERCOUNT() >= 2) {
|
||||
} else if (PLAYERCOUNT() >= 2) {
|
||||
s32 textheight;
|
||||
s32 textwidth;
|
||||
char text[32];
|
||||
@@ -1592,16 +1592,16 @@ Gfx *amRender(Gfx *gdl)
|
||||
}
|
||||
#endif
|
||||
|
||||
barwidth = LOCALPLAYERCOUNT() >= 2 ? 48 : 64;
|
||||
barheight = LOCALPLAYERCOUNT() >= 2 ? 7 : 11;
|
||||
barwidth = PLAYERCOUNT() >= 2 ? 48 : 64;
|
||||
barheight = PLAYERCOUNT() >= 2 ? 7 : 11;
|
||||
xoffset = 0;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if ((LOCALPLAYERCOUNT() == 2 && (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || IS4MB())) || LOCALPLAYERCOUNT() >= 3) {
|
||||
if ((PLAYERCOUNT() == 2 && (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || IS4MB())) || PLAYERCOUNT() >= 3) {
|
||||
xoffset = (g_Vars.currentplayernum & 1) == 0 ? 8 : -8;
|
||||
}
|
||||
|
||||
if (LOCALPLAYERCOUNT() == 1 && optionsGetEffectiveScreenSize() != SCREENSIZE_FULL) {
|
||||
if (PLAYERCOUNT() == 1 && optionsGetEffectiveScreenSize() != SCREENSIZE_FULL) {
|
||||
part1left = viGetViewLeft() / g_ScaleX + 32;
|
||||
} else {
|
||||
part1left = (s32) ((viGetViewWidth() / g_ScaleX) * 0.5f)
|
||||
@@ -1610,7 +1610,7 @@ Gfx *amRender(Gfx *gdl)
|
||||
+ xoffset;
|
||||
}
|
||||
#else
|
||||
if ((LOCALPLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) || LOCALPLAYERCOUNT() >= 3) {
|
||||
if ((PLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) || PLAYERCOUNT() >= 3) {
|
||||
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);
|
||||
gDPSetCombineMode(gdl++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
|
||||
|
||||
y = viGetViewTop() + viGetViewHeight() - (LOCALPLAYERCOUNT() >= 2 ? 19 : 34);
|
||||
y = viGetViewTop() + viGetViewHeight() - (PLAYERCOUNT() >= 2 ? 19 : 34);
|
||||
|
||||
// NTSC beta doesn't scale the health bar when hi-res is on,
|
||||
// and it only matches if part2left is an inline expression
|
||||
|
||||
@@ -22,7 +22,7 @@ void amTick(void)
|
||||
s32 prevplayernum = g_Vars.currentplayernum;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < LOCALPLAYERCOUNT(); i++) {
|
||||
for (i = 0; i < PLAYERCOUNT(); i++) {
|
||||
setCurrentPlayerNum(i);
|
||||
g_AmIndex = g_Vars.currentplayernum;
|
||||
|
||||
|
||||
@@ -1016,7 +1016,7 @@ void eyespyProcessInput(bool allowbuttons)
|
||||
// Make eyespy look horizontally
|
||||
if (domovecentre) {
|
||||
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) {
|
||||
tmp = g_Vars.currentplayer->eyespy->verta;
|
||||
|
||||
|
||||
+6
-56
@@ -54,11 +54,9 @@
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#include "platform.h"
|
||||
#include "game/stagetable.h"
|
||||
#include "video.h"
|
||||
#include "net/net.h"
|
||||
#include "net/netmsg.h"
|
||||
#include "platform.h"
|
||||
#endif
|
||||
|
||||
#define GUNLOADSTATE_FLUX 0
|
||||
@@ -4483,7 +4481,7 @@ struct defaultobj *bgunCreateThrownProjectile2(struct chrdata *chr, struct gset
|
||||
* 2 = fumbling grenade from right hand (due to nbomb)
|
||||
* 3 = fumbling grenade from left hand (actually not possible)
|
||||
*/
|
||||
struct defaultobj *bgunCreateThrownProjectile(s32 handnum, struct gset *gset)
|
||||
void bgunCreateThrownProjectile(s32 handnum, struct gset *gset)
|
||||
{
|
||||
struct coord velocity = {0, 0, 0};
|
||||
Mtxf sp1f4;
|
||||
@@ -4513,13 +4511,6 @@ struct defaultobj *bgunCreateThrownProjectile(s32 handnum, struct gset *gset)
|
||||
struct trainingdata *data;
|
||||
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) {
|
||||
droppinggrenade = true;
|
||||
handnum -= 2;
|
||||
@@ -4685,16 +4676,7 @@ struct defaultobj *bgunCreateThrownProjectile(s32 handnum, struct gset *gset)
|
||||
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)
|
||||
@@ -4798,12 +4780,6 @@ void bgunCreateFiredProjectile(s32 handnum)
|
||||
f32 spd4[4];
|
||||
f32 spc4[4];
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode == NETMODE_CLIENT) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
hand = g_Vars.currentplayer->hands + handnum;
|
||||
|
||||
playerprop = g_Vars.currentplayer->prop;
|
||||
@@ -5016,12 +4992,6 @@ void bgunCreateFiredProjectile(s32 handnum)
|
||||
weapon->base.prop = 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
|
||||
// NTSC beta doesn't have any of the failure checks
|
||||
Mtxf sp78;
|
||||
@@ -6352,13 +6322,6 @@ void bgunDisarm(struct prop *attackerprop)
|
||||
s32 modelnum;
|
||||
s32 i;
|
||||
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 VERSION >= VERSION_NTSC_1_0
|
||||
@@ -6376,12 +6339,6 @@ void bgunDisarm(struct prop *attackerprop)
|
||||
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;
|
||||
drop = true;
|
||||
|
||||
@@ -6410,7 +6367,7 @@ void bgunDisarm(struct prop *attackerprop)
|
||||
&& player->hands[i].stateminor == HANDSTATEMINOR_ATTACK_THROW_0) {
|
||||
#endif
|
||||
drop = false;
|
||||
obj = bgunCreateThrownProjectile(i + 2, &player->hands[i].gset);
|
||||
bgunCreateThrownProjectile(i + 2, &player->hands[i].gset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6434,13 +6391,6 @@ void bgunDisarm(struct prop *attackerprop)
|
||||
}
|
||||
|
||||
objDrop(prop2, true);
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode == NETMODE_SERVER) {
|
||||
netmsgSvcPropSpawnWrite(&g_NetMsgRel, prop2);
|
||||
netmsgSvcPropMoveWrite(&g_NetMsgRel, prop2, NULL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11782,7 +11732,7 @@ void bgunSetTriggerOn(s32 handnum, bool on)
|
||||
s32 bgunConsiderToggleGunFunction(s32 usedowntime, bool trigpressed, bool fromactivemenu, bool fromdedicatedbutton)
|
||||
{
|
||||
#ifndef PLATFORM_N64
|
||||
const bool extcontrols = PLAYER_EXTCFG().extcontrols || g_Vars.currentplayer->isremote;
|
||||
const bool extcontrols = PLAYER_EXTCFG().extcontrols;
|
||||
bool docontinue;
|
||||
#endif
|
||||
switch (bgunGetWeaponNum(HAND_RIGHT)) {
|
||||
@@ -11901,7 +11851,7 @@ void bgun0f0a8c50(void)
|
||||
case WEAPON_LAPTOPGUN:
|
||||
case WEAPON_DRAGON:
|
||||
case WEAPON_REMOTEMINE:
|
||||
if (PLAYER_EXTCFG().extcontrols || g_Vars.currentplayer->isremote) {
|
||||
if (PLAYER_EXTCFG().extcontrols) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -12804,7 +12754,7 @@ Gfx *bgunDrawHud(Gfx *gdl)
|
||||
{
|
||||
struct player *player = g_Vars.currentplayer;
|
||||
s32 bottom = viGetViewTop() + viGetViewHeight() - 13;
|
||||
s32 playercount = LOCALPLAYERCOUNT();
|
||||
s32 playercount = PLAYERCOUNT();
|
||||
s32 playernum = g_Vars.currentplayernum;
|
||||
struct gunctrl *ctrl;
|
||||
s32 secs60;
|
||||
|
||||
+6
-210
@@ -42,10 +42,6 @@
|
||||
#include <math.h>
|
||||
#include "input.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) {
|
||||
if ((((c1buttons & (buttons1)) && (c1buttonsthisframe & (buttons2)))
|
||||
@@ -109,159 +105,6 @@ 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
|
||||
|
||||
void bmoveSetControlDef(u32 controldef)
|
||||
@@ -470,39 +313,6 @@ void bmoveApplyMoveData(struct movedata *data)
|
||||
} else if (g_Vars.currentplayer->bondmovemode == MOVEMODE_WALK) {
|
||||
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)
|
||||
@@ -908,14 +718,6 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
#endif
|
||||
|
||||
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);
|
||||
canmanualzoom = weaponHasAimFlag(weaponnum, INVAIMFLAG_MANUALZOOM);
|
||||
contpad1 = optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex);
|
||||
@@ -1231,7 +1033,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
}
|
||||
|
||||
// Handle B button activation
|
||||
if (allowc1buttons && controlmode < CONTROLMODE_PC) {
|
||||
if (allowc1buttons && controlmode != CONTROLMODE_PC) {
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & B_BUTTON)
|
||||
|| joyGetButtonsOnSample(i, contpad2, c2allowedbuttons & B_BUTTON)) {
|
||||
@@ -1701,7 +1503,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & usemask)) {
|
||||
if (g_Vars.currentplayer->usedowntime >= -1) {
|
||||
if (controlmode < CONTROLMODE_PC) {
|
||||
if (controlmode != CONTROLMODE_PC) {
|
||||
if (joyGetButtonsPressedOnSample(i, contpad1, shootbuttons & c1allowedbuttons)
|
||||
&& g_Vars.currentplayer->usedowntime >= 0
|
||||
&& bgunConsiderToggleGunFunction(g_Vars.currentplayer->usedowntime, true, false, 0) != USETIMER_CONTINUE) {
|
||||
@@ -1726,7 +1528,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
}
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
@@ -1877,7 +1679,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
#ifdef PLATFORM_N64
|
||||
if (allowc1buttons) {
|
||||
#else
|
||||
if (allowc1buttons && (controlmode < CONTROLMODE_PC || (PLAYER_EXTCFG().crouchmode & CROUCHMODE_ANALOG))) {
|
||||
if (allowc1buttons && (controlmode != CONTROLMODE_PC || (PLAYER_EXTCFG().crouchmode & CROUCHMODE_ANALOG))) {
|
||||
#endif
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
if (!canmanualzoom && aimonhist[i]) {
|
||||
@@ -1961,7 +1763,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
}
|
||||
|
||||
// Handle mine detonation
|
||||
if (controlmode < CONTROLMODE_PC) {
|
||||
if (controlmode != CONTROLMODE_PC) {
|
||||
if ((((c1buttons & invbuttons) && (c1buttonsthisframe & B_BUTTON))
|
||||
|| ((c1buttons & B_BUTTON) && (c1buttonsthisframe & invbuttons)))
|
||||
&& weaponnum == WEAPON_REMOTEMINE) {
|
||||
@@ -1994,7 +1796,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
movedata.triggeron = g_Vars.currentplayer->waitforzrelease == false
|
||||
&& (c1buttons & shootbuttons)
|
||||
&& g_Vars.currentplayer->pausemode == PAUSEMODE_UNPAUSED;
|
||||
if (controlmode < CONTROLMODE_PC) {
|
||||
if (controlmode != CONTROLMODE_PC) {
|
||||
movedata.triggeron = movedata.triggeron && ((c1buttons & invbuttons) == 0);
|
||||
}
|
||||
}
|
||||
@@ -2711,13 +2513,7 @@ void bmoveUpdateHead(f32 arg0, f32 arg1, f32 arg2, Mtxf *arg3, f32 arg4)
|
||||
bheadUpdate(sp244, arg2);
|
||||
mtx4LoadXRotation(BADDEG2RAD(360 - g_Vars.currentplayer->vv_verta360), &sp180);
|
||||
|
||||
#ifdef PLATFORM_N64
|
||||
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,
|
||||
0, 0, 0,
|
||||
-g_Vars.currentplayer->headlook.x, -g_Vars.currentplayer->headlook.y, -g_Vars.currentplayer->headlook.z,
|
||||
|
||||
+3
-72
@@ -27,69 +27,7 @@
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#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;
|
||||
}
|
||||
}
|
||||
extern f32 fabsf(f32);
|
||||
#endif
|
||||
|
||||
void bwalkInit(void)
|
||||
@@ -516,7 +454,7 @@ bool bwalkCalculateNewPositionWithPush(struct coord *delta, f32 rotateamount, bo
|
||||
}
|
||||
} else if (chr->chrflags & CHRCFLAG_PUSHABLE) {
|
||||
if (g_Vars.antiplayernum < 0
|
||||
|| PLAYER_IS_NOT_ANTI(g_Vars.currentplayer)
|
||||
|| g_Vars.currentplayer != g_Vars.anti
|
||||
|| (chr->hidden & CHRHFLAG_ANTINONINTERACTABLE) == 0) {
|
||||
canpush = true;
|
||||
}
|
||||
@@ -850,7 +788,7 @@ void bwalkUpdateVertical(void)
|
||||
// Maybe reset counter-op's radius - not sure why
|
||||
// Maybe it gets set to 0 when they die?
|
||||
if (g_Vars.antiplayernum >= 0
|
||||
&& PLAYER_IS_ANTI(g_Vars.currentplayer)
|
||||
&& g_Vars.currentplayer == g_Vars.anti
|
||||
&& 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)) {
|
||||
g_Vars.currentplayer->prop->chr->radius = 30;
|
||||
@@ -1905,14 +1843,7 @@ void bwalkTick(void)
|
||||
bwalkUpdatePrevPos();
|
||||
bwalkUpdateTheta();
|
||||
bmoveUpdateVerta();
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_Vars.currentplayer->isremote) {
|
||||
bwalkUpdateRemote();
|
||||
} else
|
||||
#endif
|
||||
bwalk0f0c69b8();
|
||||
|
||||
bwalkUpdateVertical();
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
|
||||
+4
-10
@@ -136,7 +136,7 @@ void challengeDetermineUnlockedFeatures(void)
|
||||
}
|
||||
|
||||
// Now same as above, but per player
|
||||
for (j = 0; j < MAX_LOCAL_PLAYERS; j++) {
|
||||
for (j = 0; j < MAX_PLAYERS; j++) {
|
||||
numgifted = 0;
|
||||
|
||||
for (challengeindex = 0; challengeindex < ARRAYCOUNT(g_MpChallenges); challengeindex++) {
|
||||
@@ -197,7 +197,7 @@ void challengeDetermineUnlockedFeatures(void)
|
||||
}
|
||||
|
||||
for (challengeindex = 0; challengeindex < ARRAYCOUNT(g_MpChallenges); challengeindex++) {
|
||||
for (prev = 0; prev < MAX_LOCAL_PLAYERS; prev++) {
|
||||
for (prev = 0; prev < MAX_PLAYERS; prev++) {
|
||||
if (challengeIsAvailableToPlayer(prev, challengeindex)) {
|
||||
for (i = 0; i < ARRAYCOUNT(g_MpChallenges[challengeindex].unlockfeatures); i++) {
|
||||
if (g_MpChallenges[challengeindex].unlockfeatures[i] == j) {
|
||||
@@ -249,7 +249,7 @@ void challengePerformSanityChecks(void)
|
||||
}
|
||||
}
|
||||
|
||||
// Turn off all simulants (and players 5-8 if supported) and turn them on if enabled
|
||||
// Turn off all simulants and turn them on if enabled
|
||||
// for this number of players
|
||||
g_MpSetup.chrslots &= 0x000f;
|
||||
|
||||
@@ -265,14 +265,8 @@ void challengePerformSanityChecks(void)
|
||||
g_Vars.mphilltime = 10;
|
||||
}
|
||||
} else if (!challengeIsFeatureUnlocked(MPFEATURE_8BOTS)) {
|
||||
// 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
|
||||
// Limit to 4 players and 4 simulants
|
||||
g_MpSetup.chrslots &= 0x00ff;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-14
@@ -49,8 +49,6 @@
|
||||
#include "types.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#include "video.h"
|
||||
#include "net/net.h"
|
||||
#include "net/netmsg.h"
|
||||
#endif
|
||||
|
||||
void rng2SetSeed(u32 seed);
|
||||
@@ -4662,7 +4660,7 @@ void chrHit(struct shotdata *shotdata, struct hit *hit)
|
||||
hit->model, hit->hitthing.unk28 / 2, sp90);
|
||||
|
||||
if (g_Vars.antiplayernum >= 0
|
||||
&& PLAYER_IS_ANTI(g_Vars.currentplayer)
|
||||
&& g_Vars.currentplayer == g_Vars.anti
|
||||
&& (chr->hidden & CHRHFLAG_ANTINONINTERACTABLE)) {
|
||||
return;
|
||||
}
|
||||
@@ -4693,17 +4691,9 @@ void chrHit(struct shotdata *shotdata, struct hit *hit)
|
||||
|| weapon->weaponnum == WEAPON_TIMEDMINE
|
||||
|| weapon->weaponnum == WEAPON_REMOTEMINE
|
||||
|| 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);
|
||||
chr->hidden |= CHRHFLAG_DROPPINGITEM;
|
||||
objDamage(&weapon->base, gsetGetDamage(&shotdata->gset), &sp98, shotdata->gset.weaponnum, g_Vars.currentplayernum);
|
||||
}
|
||||
objSetDropped(hit->prop, DROPTYPE_DEFAULT);
|
||||
chr->hidden |= CHRHFLAG_DROPPINGITEM;
|
||||
objDamage(&weapon->base, gsetGetDamage(&shotdata->gset), &sp98, shotdata->gset.weaponnum, g_Vars.currentplayernum);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+17
-138
@@ -56,10 +56,6 @@
|
||||
#include "lib/vi.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#include "net/net.h"
|
||||
#include "net/netmsg.h"
|
||||
#endif
|
||||
|
||||
s32 g_RecentQuipsPlayed[5];
|
||||
u32 var8009cd84;
|
||||
@@ -4042,7 +4038,7 @@ void chrChoke(struct chrdata *chr, s32 choketype)
|
||||
if (soundnum >= 0) {
|
||||
if (chr->prop->type == PROPTYPE_PLAYER) {
|
||||
if (g_Vars.players[playernum]->chokehandle == NULL) {
|
||||
playerSndStart(var80095200, soundnum, &g_Vars.players[playernum]->chokehandle, playernum, -1, -1, -1);
|
||||
sndStart(var80095200, soundnum, &g_Vars.players[playernum]->chokehandle, -1, -1, -1, -1, -1);
|
||||
}
|
||||
} else {
|
||||
psStopSound(chr->prop, PSTYPE_CHRTALK, 0);
|
||||
@@ -4105,12 +4101,6 @@ 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)
|
||||
{
|
||||
#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,
|
||||
false, // damageshield
|
||||
NULL, // prop2
|
||||
@@ -4124,12 +4114,6 @@ 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)
|
||||
{
|
||||
#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,
|
||||
true, // damageshield
|
||||
chr->prop, // prop2
|
||||
@@ -4143,12 +4127,6 @@ 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)
|
||||
{
|
||||
#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,
|
||||
true, // damageshield
|
||||
prop2, // prop2
|
||||
@@ -4170,13 +4148,6 @@ void func0f034248(struct chrdata *chr, f32 damage, struct coord *vector, struct
|
||||
s32 side = 0;
|
||||
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) {
|
||||
chrCalculateShieldHit(chr, &chr->prop->pos, vector, &node, &hitpart, &model, &side);
|
||||
}
|
||||
@@ -4201,13 +4172,6 @@ void chrDamageByImpact(struct chrdata *chr, f32 damage, struct coord *vector, st
|
||||
struct model *model = NULL;
|
||||
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) {
|
||||
chrCalculateShieldHit(chr, &chr->prop->pos, vector, &node, &hitpart, &model, &side);
|
||||
}
|
||||
@@ -4225,12 +4189,6 @@ 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)
|
||||
{
|
||||
#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,
|
||||
true, // damageshield
|
||||
chr->prop, // prop2
|
||||
@@ -4314,13 +4272,6 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse
|
||||
s32 aplayernum = -1;
|
||||
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) {
|
||||
choketype = CHOKETYPE_GURGLE;
|
||||
}
|
||||
@@ -4351,7 +4302,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
|
||||
if (g_Vars.antiplayernum >= 0
|
||||
&& aprop
|
||||
&& PROP_IS_FOR_ANTI_PLAYER(aprop)
|
||||
&& aprop == g_Vars.anti->prop
|
||||
&& (chr->hidden & CHRHFLAG_ANTINONINTERACTABLE)) {
|
||||
return;
|
||||
}
|
||||
@@ -4503,9 +4454,7 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse
|
||||
}
|
||||
|
||||
// Anti shooting other enemies is lethal
|
||||
if (aprop
|
||||
&& PROP_IS_FOR_ANTI_PLAYER(aprop)
|
||||
&& vprop != g_Vars.bond->prop) {
|
||||
if (aprop && aprop == g_Vars.anti->prop && vprop != g_Vars.bond->prop) {
|
||||
damage *= 100;
|
||||
}
|
||||
} else {
|
||||
@@ -4906,12 +4855,6 @@ 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);
|
||||
return;
|
||||
}
|
||||
@@ -8336,7 +8279,7 @@ void chrAlertOthersOfInjury(struct chrdata *chr, bool dying)
|
||||
s32 numinrange = 0;
|
||||
s32 numchrs = chrsGetNumSlots();
|
||||
|
||||
if (g_Vars.antiplayernum >= 0 && PROP_IS_FOR_ANTI_PLAYER(chr->prop)) {
|
||||
if (g_Vars.antiplayernum >= 0 && chr->prop == g_Vars.anti->prop) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13571,7 +13514,7 @@ void chraTickBg(void)
|
||||
|
||||
if (targetprop && (targetprop->type == PROPTYPE_CHR || targetprop->type == PROPTYPE_PLAYER)) {
|
||||
if ((targetprop->type == PROPTYPE_PLAYER
|
||||
&& !(g_Vars.antiplayernum >= 0 && g_Vars.anti && PROP_IS_FOR_ANTI_PLAYER(targetprop))
|
||||
&& !(g_Vars.antiplayernum >= 0 && g_Vars.anti && g_Vars.anti->prop == targetprop)
|
||||
&& chrCompareTeams(chr, targetprop->chr, COMPARE_ENEMIES))
|
||||
|| CHRRACE(targetprop->chr) == RACE_EYESPY) {
|
||||
s32 time60;
|
||||
@@ -15357,68 +15300,6 @@ void func0f04b740(void)
|
||||
// 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)
|
||||
{
|
||||
struct coord pos2;
|
||||
@@ -15426,7 +15307,7 @@ bool chrMoveToPos(struct chrdata *chr, struct coord *pos, RoomNum *rooms, f32 an
|
||||
bool result = false;
|
||||
u32 nodetype;
|
||||
union modelrwdata *rwdata;
|
||||
struct player *player = NULL;
|
||||
struct player *player;
|
||||
f32 ground;
|
||||
|
||||
pos2.x = pos->x;
|
||||
@@ -15455,17 +15336,21 @@ bool chrMoveToPos(struct chrdata *chr, struct coord *pos, RoomNum *rooms, f32 an
|
||||
propDeregisterRooms(chr->prop);
|
||||
roomsCopy(rooms2, chr->prop->rooms);
|
||||
chr0f0220ac(chr);
|
||||
modelSetRootPosition(chr->model, &pos2);
|
||||
|
||||
nodetype = chr->model->definition->rootnode->type;
|
||||
|
||||
if ((nodetype & 0xff) == MODELNODETYPE_CHRINFO) {
|
||||
rwdata = modelGetNodeRwData(chr->model, chr->model->definition->rootnode);
|
||||
rwdata->chrinfo.ground = ground;
|
||||
if (chr->model) {
|
||||
modelSetRootPosition(chr->model, &pos2);
|
||||
nodetype = chr->model->definition->rootnode->type;
|
||||
if ((nodetype & 0xff) == MODELNODETYPE_CHRINFO) {
|
||||
rwdata = modelGetNodeRwData(chr->model, chr->model->definition->rootnode);
|
||||
rwdata->chrinfo.ground = ground;
|
||||
}
|
||||
}
|
||||
|
||||
chr->chrflags |= CHRCFLAG_FORCETOGROUND;
|
||||
chrSetLookAngle(chr, angle);
|
||||
|
||||
if (chr->model || chr->aibot) {
|
||||
chrSetLookAngle(chr, angle);
|
||||
}
|
||||
|
||||
if (chr->prop->type == PROPTYPE_PLAYER) {
|
||||
player = g_Vars.players[playermgrGetPlayerNumByProp(chr->prop)];
|
||||
@@ -15476,12 +15361,6 @@ bool chrMoveToPos(struct chrdata *chr, struct coord *pos, RoomNum *rooms, f32 an
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,10 +52,6 @@
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
#include "game/mplayer/mplayer.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @cmd 0000
|
||||
*/
|
||||
@@ -6043,35 +6039,11 @@ bool aiSetChrPresetToChrNearPad(void)
|
||||
bool aiChrSetTeam(void)
|
||||
{
|
||||
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
|
||||
#ifdef PLATFORM_N64
|
||||
struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]);
|
||||
|
||||
if (chr) {
|
||||
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;
|
||||
|
||||
|
||||
+12
-57
@@ -292,27 +292,6 @@ char *endscreenMenuTextAccuracy(struct menuitem *item)
|
||||
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)
|
||||
{
|
||||
if (g_CheatsActiveBank0 || g_CheatsActiveBank1) {
|
||||
@@ -333,7 +312,7 @@ char *endscreenMenuTextMissionStatus(struct menuitem *item)
|
||||
return langGet(L_OPTIONS_295); // "Aborted"
|
||||
}
|
||||
|
||||
if (ANTI_ABORTED()) {
|
||||
if (g_Vars.anti->aborted) {
|
||||
return langGet(L_OPTIONS_295); // "Aborted"
|
||||
}
|
||||
|
||||
@@ -341,7 +320,7 @@ char *endscreenMenuTextMissionStatus(struct menuitem *item)
|
||||
return langGet(L_OPTIONS_293); // "Failed"
|
||||
}
|
||||
} else {
|
||||
if (ANTI_ABORTED()) {
|
||||
if (g_Vars.anti->aborted) {
|
||||
return langGet(L_OPTIONS_295); // "Aborted"
|
||||
}
|
||||
|
||||
@@ -1721,22 +1700,14 @@ void endscreenPushCoop(void)
|
||||
#endif
|
||||
{
|
||||
// Failed or aborted
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||
#ifndef PLATFORM_N64
|
||||
|| LOCALPLAYERCOUNT() >= 3
|
||||
#endif
|
||||
) {
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||
menuPushRootDialog(&g_2PMissionEndscreenFailedVMenuDialog, MENUROOT_MPENDSCREEN);
|
||||
} else {
|
||||
menuPushRootDialog(&g_2PMissionEndscreenFailedHMenuDialog, MENUROOT_MPENDSCREEN);
|
||||
}
|
||||
} else {
|
||||
// Completed
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||
#ifndef PLATFORM_N64
|
||||
|| LOCALPLAYERCOUNT() >= 3
|
||||
#endif
|
||||
) {
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||
menuPushRootDialog(&g_2PMissionEndscreenCompletedVMenuDialog, MENUROOT_MPENDSCREEN);
|
||||
} else {
|
||||
menuPushRootDialog(&g_2PMissionEndscreenCompletedHMenuDialog, MENUROOT_MPENDSCREEN);
|
||||
@@ -1816,28 +1787,20 @@ void endscreenPushAnti(void)
|
||||
|
||||
if (g_Vars.currentplayer == g_Vars.bond) {
|
||||
#if VERSION >= VERSION_NTSC_1_0 && defined(DEBUG)
|
||||
if (!ANTI_ABORTED() && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()) && !debugIsSetCompleteEnabled())
|
||||
if (!g_Vars.anti->aborted && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()) && !debugIsSetCompleteEnabled())
|
||||
#else
|
||||
if (!ANTI_ABORTED() && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()))
|
||||
if (!g_Vars.anti->aborted && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()))
|
||||
#endif
|
||||
{
|
||||
// Bond - failed or aborted
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||
#ifndef PLATFORM_N64
|
||||
|| LOCALPLAYERCOUNT() >= 3
|
||||
#endif
|
||||
) {
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||
menuPushRootDialog(&g_2PMissionEndscreenFailedVMenuDialog, MENUROOT_MPENDSCREEN);
|
||||
} else {
|
||||
menuPushRootDialog(&g_2PMissionEndscreenFailedHMenuDialog, MENUROOT_MPENDSCREEN);
|
||||
}
|
||||
} else {
|
||||
// Bond - completed
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||
#ifndef PLATFORM_N64
|
||||
|| LOCALPLAYERCOUNT() >= 3
|
||||
#endif
|
||||
) {
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||
menuPushRootDialog(&g_2PMissionEndscreenCompletedVMenuDialog, MENUROOT_MPENDSCREEN);
|
||||
} else {
|
||||
menuPushRootDialog(&g_2PMissionEndscreenCompletedHMenuDialog, MENUROOT_MPENDSCREEN);
|
||||
@@ -1847,28 +1810,20 @@ void endscreenPushAnti(void)
|
||||
filemgrSaveOrLoad(&g_GameFileGuid, FILEOP_SAVE_GAME_000, 0);
|
||||
} else {
|
||||
#if VERSION >= VERSION_NTSC_1_0 && defined(DEBUG)
|
||||
if (!ANTI_ABORTED() && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()) && !debugIsSetCompleteEnabled())
|
||||
if (!g_Vars.anti->aborted && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()) && !debugIsSetCompleteEnabled())
|
||||
#else
|
||||
if (!ANTI_ABORTED() && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()))
|
||||
if (!g_Vars.anti->aborted && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()))
|
||||
#endif
|
||||
{
|
||||
// Anti - completed
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||
#ifndef PLATFORM_N64
|
||||
|| LOCALPLAYERCOUNT() >= 3
|
||||
#endif
|
||||
) {
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||
menuPushRootDialog(&g_2PMissionEndscreenCompletedVMenuDialog, MENUROOT_MPENDSCREEN);
|
||||
} else {
|
||||
menuPushRootDialog(&g_2PMissionEndscreenCompletedHMenuDialog, MENUROOT_MPENDSCREEN);
|
||||
}
|
||||
} else {
|
||||
// Anti - failed or aborted
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||
#ifndef PLATFORM_N64
|
||||
|| LOCALPLAYERCOUNT() >= 3
|
||||
#endif
|
||||
) {
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||
menuPushRootDialog(&g_2PMissionEndscreenFailedVMenuDialog, MENUROOT_MPENDSCREEN);
|
||||
} else {
|
||||
menuPushRootDialog(&g_2PMissionEndscreenFailedHMenuDialog, MENUROOT_MPENDSCREEN);
|
||||
|
||||
+3
-15
@@ -847,7 +847,7 @@ void explosionInflictDamage(struct prop *expprop)
|
||||
minfrac = (minfrac * 0.7f + 0.3f) * type->damage;
|
||||
|
||||
if (g_Vars.antiplayernum >= 0
|
||||
&& EXPLOSION_OWNER_IS_ANTI_PLAYER(exp->owner)
|
||||
&& g_Vars.antiplayernum == exp->owner
|
||||
&& (obj->flags2 & OBJFLAG2_IMMUNETOANTI)) {
|
||||
// anti cannot damage this obj
|
||||
} else if (isfirstframe) {
|
||||
@@ -997,16 +997,8 @@ void explosionInflictDamage(struct prop *expprop)
|
||||
ownerprop = g_Vars.bond->prop;
|
||||
} else if (g_Vars.coopplayernum >= 0 && exp->owner == g_Vars.coopplayernum) {
|
||||
ownerprop = g_Vars.coop->prop;
|
||||
} else if (g_Vars.antiplayernum >= 0 && EXPLOSION_OWNER_IS_ANTI_PLAYER(exp->owner)) {
|
||||
#if PLATFORM_N64
|
||||
} else if (g_Vars.antiplayernum >= 0 && exp->owner == g_Vars.antiplayernum) {
|
||||
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);
|
||||
@@ -1220,12 +1212,8 @@ u32 explosionTick(struct prop *prop)
|
||||
|
||||
if (g_Vars.normmplayerisrunning) {
|
||||
chr = mpGetChrFromPlayerIndex(exp->owner);
|
||||
} else if (g_Vars.antiplayernum >= 0 && EXPLOSION_OWNER_IS_ANTI_PLAYER(exp->owner)) {
|
||||
#if PLATFORM_N64
|
||||
} else if (g_Vars.antiplayernum >= 0 && exp->owner == g_Vars.antiplayernum) {
|
||||
chr = g_Vars.anti->prop->chr;
|
||||
#else
|
||||
chr = mpGetChrFromPlayerIndex(exp->owner);
|
||||
#endif
|
||||
} else if (g_Vars.coopplayernum >= 0 && exp->owner == g_Vars.coopplayernum) {
|
||||
chr = g_Vars.coop->prop->chr;
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
|
||||
s32 g_FilelistKnownPlugCounts[5];
|
||||
|
||||
struct filelist *g_FileLists[MAX_LOCAL_PLAYERS] = { NULL };
|
||||
struct filelist *g_FileLists[MAX_PLAYERS] = { NULL };
|
||||
bool var80075bd0[] = { true, true, true, true };
|
||||
bool var80075be0[] = { false, false, false, false };
|
||||
u32 var80075bf0 = false;
|
||||
|
||||
+8
-8
@@ -25,7 +25,7 @@ struct fileguid g_FilemgrFileToCopy;
|
||||
struct fileguid var800a21e8;
|
||||
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
struct fileguid g_FilemgrFileToDelete[MAX_LOCAL_PLAYERS];
|
||||
struct fileguid g_FilemgrFileToDelete[MAX_PLAYERS];
|
||||
#else
|
||||
struct fileguid g_FilemgrFileToDelete;
|
||||
#endif
|
||||
@@ -970,7 +970,7 @@ void filemgrDeleteCurrentFile(void)
|
||||
filemgrPushErrorDialog(FILEERROR_DELETEFAILED);
|
||||
} else {
|
||||
// If deleting a loaded MP player, reset them to default
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (g_FilemgrFileToDelete[g_MpPlayerNum].fileid == g_PlayerConfigsArray[i].fileguid.fileid
|
||||
&& g_FilemgrFileToDelete[g_MpPlayerNum].deviceserial == g_PlayerConfigsArray[i].fileguid.deviceserial) {
|
||||
mpPlayerSetDefaults(i, true);
|
||||
@@ -997,7 +997,7 @@ void filemgrDeleteCurrentFile(void)
|
||||
filemgrPushErrorDialog(FILEERROR_DELETEFAILED);
|
||||
} else {
|
||||
// If deleting a loaded MP player, reset them to default
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (g_FilemgrFileToDelete.fileid == g_PlayerConfigsArray[i].fileguid.fileid
|
||||
&& g_FilemgrFileToDelete.deviceserial == g_PlayerConfigsArray[i].fileguid.deviceserial) {
|
||||
mpPlayerSetDefaults(i, true);
|
||||
@@ -1844,7 +1844,7 @@ bool filemgrIsFileInUse(struct filelistfile *file)
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
if ((g_MpSetup.chrslots & (1 << i))
|
||||
&& g_PlayerConfigsArray[i].fileguid.fileid == file->fileid
|
||||
&& g_PlayerConfigsArray[i].fileguid.deviceserial == file->deviceserial) {
|
||||
@@ -1982,7 +1982,7 @@ bool filemgrIsFileInUse(struct filelistfile *file)
|
||||
return true;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
if ((g_MpSetup.chrslots & (1 << i))
|
||||
&& g_PlayerConfigsArray[i].fileguid.fileid == file->fileid
|
||||
&& g_PlayerConfigsArray[i].fileguid.deviceserial == file->deviceserial) {
|
||||
@@ -2420,7 +2420,7 @@ MenuDialogHandlerResult pakChoosePakMenuDialog(s32 operation, struct menudialogd
|
||||
if (g_Vars.stagenum != STAGE_BOOTPAKMENU) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (g_Menus[g_MpPlayerNum].fm.unke24 & (1 << i)) {
|
||||
g_Vars.pakstocheck &= 0xfff0;
|
||||
g_Vars.pakstocheck |= 0x0008;
|
||||
@@ -2445,7 +2445,7 @@ MenuDialogHandlerResult pakChoosePakMenuDialog(s32 operation, struct menudialogd
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (g_Menus[g_MpPlayerNum].fm.unke24 & (1 << i)) {
|
||||
pak0f1169c8(i, STAGE_BOOTPAKMENU == g_Vars.stagenum);
|
||||
}
|
||||
@@ -2767,7 +2767,7 @@ MenuDialogHandlerResult filemgrMainMenuDialog(s32 operation, struct menudialogde
|
||||
mpInit(true);
|
||||
|
||||
// Set MP player names to "Player 1" through 4 if blank
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (g_PlayerConfigsArray[i].base.name[0] == '\0') {
|
||||
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));
|
||||
x = weapon->posx;
|
||||
|
||||
if (LOCALPLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||
if (PLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||
x -= 3.5f;
|
||||
|
||||
if (g_Vars.currentplayernum == 0) {
|
||||
@@ -178,7 +178,7 @@ f32 func0f0b131c(s32 hand)
|
||||
weapon = weaponFindById(bgunGetWeaponNum2(1));
|
||||
x = -weapon->posx;
|
||||
|
||||
if (LOCALPLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||
if (PLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||
x += 3.5f;
|
||||
|
||||
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 (arg5 + arg7 >= y + char1->baseline + char1->height + 2) {
|
||||
if (g_TextRotated90) {
|
||||
gSPTextureRectangleFlipEXT(gdl++,
|
||||
gSPTextureRectangleFlip(gdl++,
|
||||
((y - char1->baseline) - ((char1->height + 2) * var8007fad0)) * 4,
|
||||
x * 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);
|
||||
} else {
|
||||
gSPTextureRectangleEXT(gdl++,
|
||||
gSPTextureRectangle(gdl++,
|
||||
x * 4,
|
||||
(y + char1->baseline) * 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 {
|
||||
if (arg5 + arg7 >= y + char1->baseline) {
|
||||
gSPTextureRectangleEXT(gdl++,
|
||||
gSPTextureRectangle(gdl++,
|
||||
x * 4,
|
||||
(y + char1->baseline) * 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 {
|
||||
if (y + char1->baseline + char1->height + 2 >= arg5) {
|
||||
gSPTextureRectangleEXT(gdl++,
|
||||
gSPTextureRectangle(gdl++,
|
||||
x * 4,
|
||||
arg5 * 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 (j = 1; j < MAX_LOCAL_PLAYERS + 1; j++) {
|
||||
for (j = 1; j < MAX_PLAYERS + 1; j++) {
|
||||
challengeSetCompletedByAnyPlayerWithNumPlayers(i, j, false);
|
||||
}
|
||||
}
|
||||
@@ -362,7 +362,7 @@ s32 gamefileLoad(s32 device)
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
||||
for (j = 1; j < MAX_LOCAL_PLAYERS + 1; j++) {
|
||||
for (j = 1; j < MAX_PLAYERS + 1; j++) {
|
||||
challengeSetCompletedByAnyPlayerWithNumPlayers(i, j, savebufferReadBits(&buffer, 1));
|
||||
}
|
||||
}
|
||||
@@ -537,7 +537,7 @@ s32 gamefileSave(s32 device, s32 fileid, u16 deviceserial)
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
||||
for (j = 1; j < MAX_LOCAL_PLAYERS + 1; j++) {
|
||||
for (j = 1; j < MAX_PLAYERS + 1; j++) {
|
||||
savebufferOr(&buffer, challengeIsCompletedByAnyPlayerWithNumPlayers(i, j), 1);
|
||||
}
|
||||
}
|
||||
@@ -598,7 +598,7 @@ void gamefileUnlockEverything(void)
|
||||
|
||||
// unlock all challenges
|
||||
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); ++i) {
|
||||
for (j = 0; j < MAX_LOCAL_PLAYERS; ++j) {
|
||||
for (j = 0; j < MAX_PLAYERS; ++j) {
|
||||
g_MpChallenges[i].completions[j] = 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,12 +57,6 @@ u32 g_GfxSizesByPlayerCount[] = {
|
||||
0x00018000 * GFX_SIZE_MULTIPLIER,
|
||||
0x00020000 * GFX_SIZE_MULTIPLIER,
|
||||
0x00028000 * GFX_SIZE_MULTIPLIER,
|
||||
#ifndef PLATFORM_N64
|
||||
0x00030000 * GFX_SIZE_MULTIPLIER,
|
||||
0x00038000 * GFX_SIZE_MULTIPLIER,
|
||||
0x00040000 * GFX_SIZE_MULTIPLIER,
|
||||
0x00048000 * GFX_SIZE_MULTIPLIER,
|
||||
#endif
|
||||
};
|
||||
|
||||
u32 g_VtxSizesByPlayerCount[] = {
|
||||
@@ -70,12 +64,6 @@ u32 g_VtxSizesByPlayerCount[] = {
|
||||
0x00018000,
|
||||
0x00020000,
|
||||
0x00028000,
|
||||
#ifndef PLATFORM_N64
|
||||
0x00030000,
|
||||
0x00038000,
|
||||
0x00040000,
|
||||
0x00048000,
|
||||
#endif
|
||||
};
|
||||
|
||||
s32 g_GfxNumSwapsPerBuffer[NUM_GFXTASKS] = {0, 1};
|
||||
@@ -116,21 +104,11 @@ void gfxReset(void)
|
||||
// ******** Extra Amount required = %dK ber buffer\n
|
||||
// ******** Total of %dK (Double Buffered)\n
|
||||
g_GfxSizesByPlayerCount[PLAYERCOUNT() - 1] = (gfx + gfxtra) * GFX_SIZE_MULTIPLIER;
|
||||
#ifndef PLATFORM_N64
|
||||
if (PLAYERCOUNT() > MAX_LOCAL_PLAYERS) {
|
||||
g_GfxSizesByPlayerCount[PLAYERCOUNT() - 1] *= MAX_PLAYERS / MAX_LOCAL_PLAYERS;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (argFindByPrefix(1, "-mvtx")) {
|
||||
// Argument specified mtxvtx_size\n
|
||||
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
|
||||
|
||||
+15
-22
@@ -86,7 +86,7 @@ u8 hudmsgsAreActive(void)
|
||||
s32 hudmsgIsZoomRangeVisible(void)
|
||||
{
|
||||
return optionsGetShowZoomRange(g_Vars.currentplayerstats->mpindex)
|
||||
&& (LOCALPLAYERCOUNT() == 1
|
||||
&& (PLAYERCOUNT() == 1
|
||||
|| !g_Vars.mplayerisrunning
|
||||
|| g_Vars.coopplayernum >= 0
|
||||
|| g_Vars.antiplayernum >= 0)
|
||||
@@ -131,7 +131,7 @@ Gfx *hudmsgRenderMissionTimer(Gfx *gdl, u32 alpha)
|
||||
viewleft = viGetViewLeft() / g_ScaleX;
|
||||
viewtop = viGetViewTop();
|
||||
viewheight = viGetViewHeight();
|
||||
playercount = LOCALPLAYERCOUNT();
|
||||
playercount = PLAYERCOUNT();
|
||||
playernum = g_Vars.currentplayernum;
|
||||
|
||||
timery = viewheight;
|
||||
@@ -234,7 +234,7 @@ Gfx *hudmsgRenderZoomRange(Gfx *gdl, u32 alpha)
|
||||
texty = viewheight + viewtop - 1;
|
||||
maxzoom = 1.0f;
|
||||
weaponnum = g_Vars.currentplayer->hands[0].gset.weaponnum;
|
||||
playercount = LOCALPLAYERCOUNT();
|
||||
playercount = PLAYERCOUNT();
|
||||
|
||||
texty -= 17;
|
||||
|
||||
@@ -374,7 +374,7 @@ s32 hudmsg0f0ddb1c(s32 *arg0, s32 arg1)
|
||||
|
||||
*arg0 = 24;
|
||||
|
||||
if (LOCALPLAYERCOUNT() == 2
|
||||
if (PLAYERCOUNT() == 2
|
||||
&& optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||
&& (!g_InCutscene || g_MainIsEndscreen)) {
|
||||
result -= *arg0 * 2 / 3;
|
||||
@@ -388,7 +388,7 @@ s32 hudmsg0f0ddb1c(s32 *arg0, s32 arg1)
|
||||
|
||||
result = result + viewwidth - *arg0 - arg1 - 11;
|
||||
|
||||
if (LOCALPLAYERCOUNT() == 1 || (LOCALPLAYERCOUNT() == 2 && g_InCutscene && !g_MainIsEndscreen)) {
|
||||
if (PLAYERCOUNT() == 1 || (PLAYERCOUNT() == 2 && g_InCutscene && !g_MainIsEndscreen)) {
|
||||
result -= 16;
|
||||
|
||||
#if VERSION < VERSION_JPN_FINAL
|
||||
@@ -403,7 +403,7 @@ s32 hudmsg0f0ddb1c(s32 *arg0, s32 arg1)
|
||||
|
||||
*arg0 = 24;
|
||||
|
||||
if (LOCALPLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||
if (PLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||
result -= *arg0 * 2 / 3;
|
||||
|
||||
if (g_Vars.currentplayernum == 0) {
|
||||
@@ -415,7 +415,7 @@ s32 hudmsg0f0ddb1c(s32 *arg0, s32 arg1)
|
||||
|
||||
result = result + viewwidth - *arg0 - arg1 - 11;
|
||||
|
||||
if (LOCALPLAYERCOUNT() == 1) {
|
||||
if (PLAYERCOUNT() == 1) {
|
||||
result -= 16;
|
||||
}
|
||||
#endif
|
||||
@@ -857,7 +857,7 @@ void hudmsgCalculatePosition(struct hudmessage *msg)
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
s32 offset = (msg->alignh == HUDMSGALIGN_XMIDDLE) ? 10 : 0;
|
||||
|
||||
if (LOCALPLAYERCOUNT() >= 3) {
|
||||
if (PLAYERCOUNT() >= 3) {
|
||||
viewwidth -= offset;
|
||||
|
||||
if (g_Vars.currentplayernum == 0 || g_Vars.currentplayernum == 2) {
|
||||
@@ -865,7 +865,7 @@ void hudmsgCalculatePosition(struct hudmessage *msg)
|
||||
}
|
||||
}
|
||||
|
||||
if (LOCALPLAYERCOUNT() == 2 && (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || IS4MB())) {
|
||||
if (PLAYERCOUNT() == 2 && (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || IS4MB())) {
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
if (!g_InCutscene || g_MainIsEndscreen)
|
||||
#endif
|
||||
@@ -888,7 +888,7 @@ void hudmsgCalculatePosition(struct hudmessage *msg)
|
||||
|
||||
x = viewleft + v0 + msg->xmargin + 3;
|
||||
|
||||
if (LOCALPLAYERCOUNT() == 2
|
||||
if (PLAYERCOUNT() == 2
|
||||
&& (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || IS4MB())
|
||||
&& (!g_InCutscene || g_MainIsEndscreen)) {
|
||||
if (IS4MB()) {
|
||||
@@ -904,7 +904,7 @@ void hudmsgCalculatePosition(struct hudmessage *msg)
|
||||
x += 4;
|
||||
}
|
||||
}
|
||||
} else if (LOCALPLAYERCOUNT() >= 3) {
|
||||
} else if (PLAYERCOUNT() >= 3) {
|
||||
if ((msg->playernum % 2) == 0) {
|
||||
x--;
|
||||
} else {
|
||||
@@ -933,13 +933,13 @@ void hudmsgCalculatePosition(struct hudmessage *msg)
|
||||
case HUDMSGALIGN_BOTTOM:
|
||||
y = viewtop + viewheight - msg->height - msg->ymargin - 14;
|
||||
|
||||
if (LOCALPLAYERCOUNT() == 2 && (g_InCutscene == 0 || g_MainIsEndscreen)) {
|
||||
if (PLAYERCOUNT() == 2 && (g_InCutscene == 0 || g_MainIsEndscreen)) {
|
||||
if (IS4MB() || (optionsGetScreenSplit() != SCREENSPLIT_VERTICAL && msg->playernum == 0)) {
|
||||
y += 8;
|
||||
} else {
|
||||
y += 3;
|
||||
}
|
||||
} else if (LOCALPLAYERCOUNT() >= 3) {
|
||||
} else if (PLAYERCOUNT() >= 3) {
|
||||
if (msg->playernum <= 1) {
|
||||
y += 8;
|
||||
} else {
|
||||
@@ -987,13 +987,6 @@ void hudmsgCreateFromArgs(char *text, s32 type, s32 conf00, s32 conf01, s32 conf
|
||||
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++) {
|
||||
hash = hash + text[j];
|
||||
}
|
||||
@@ -1291,7 +1284,7 @@ void hudmsgsTick(void)
|
||||
&& msg->type != HUDMSGTYPE_CUTSCENESUBTITLE
|
||||
&& msg->type != HUDMSGTYPE_INGAMESUBTITLE
|
||||
#endif
|
||||
&& LOCALPLAYERCOUNT() == 1) {
|
||||
&& PLAYERCOUNT() == 1) {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
sndStart(var80095200, SFX_HUDMSG, NULL, -1, -1, -1, -1, -1);
|
||||
#else
|
||||
@@ -1390,7 +1383,7 @@ Gfx *hudmsgsRender(Gfx *gdl)
|
||||
s32 timerthing = 255;
|
||||
s32 spdc = true;
|
||||
#ifndef PLATFORM_N64
|
||||
const s32 playercount = LOCALPLAYERCOUNT();
|
||||
const s32 playercount = PLAYERCOUNT();
|
||||
#endif
|
||||
|
||||
#if PAL
|
||||
|
||||
+8
-47
@@ -97,8 +97,7 @@
|
||||
#include "lib/vi.h"
|
||||
#include "types.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#include "net/net.h"
|
||||
#include "net/netmsg.h"
|
||||
#include "debugger.h"
|
||||
#include "video.h"
|
||||
#endif
|
||||
|
||||
@@ -301,6 +300,8 @@ void lvReset(s32 stagenum)
|
||||
|
||||
g_MiscAudioHandle = NULL;
|
||||
|
||||
debuggerUpdatePropInfo(true);
|
||||
|
||||
musicReset();
|
||||
modelmgrSetLvResetting(true);
|
||||
surfaceReset();
|
||||
@@ -324,16 +325,6 @@ void lvReset(s32 stagenum)
|
||||
s32 i;
|
||||
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();
|
||||
bgReset(g_Vars.stagenum);
|
||||
bgBuildTables(g_Vars.stagenum);
|
||||
@@ -350,9 +341,9 @@ void lvReset(s32 stagenum)
|
||||
}
|
||||
|
||||
if (g_Vars.mplayerisrunning == false) {
|
||||
g_Vars.playerstats[0].mpindex = MAX_PLAYERS;
|
||||
g_PlayerConfigsArray[MAX_PLAYERS].contpad1 = 0;
|
||||
g_PlayerConfigsArray[MAX_PLAYERS].contpad2 = 1;
|
||||
g_Vars.playerstats[0].mpindex = 4;
|
||||
g_PlayerConfigsArray[4].contpad1 = 0;
|
||||
g_PlayerConfigsArray[4].contpad2 = 1;
|
||||
}
|
||||
|
||||
for (i = 0; i != ARRAYCOUNT(g_Vars.playerstats); i++) {
|
||||
@@ -475,12 +466,6 @@ void lvReset(s32 stagenum)
|
||||
pheadReset();
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode) {
|
||||
netSyncIdsAllocate();
|
||||
}
|
||||
#endif
|
||||
|
||||
modelmgrSetLvResetting(false);
|
||||
var80084018 = 1;
|
||||
schedResetArtifacts();
|
||||
@@ -1143,13 +1128,6 @@ Gfx *lvRender(Gfx *gdl)
|
||||
struct player *player;
|
||||
struct chrdata *chr;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode) {
|
||||
// tick all players, we'll skip the rendering
|
||||
forcesingleplayer = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
playercount = forcesingleplayer ? 1 : PLAYERCOUNT();
|
||||
|
||||
gSPClipRatio(gdl++, FRUSTRATIO_2);
|
||||
@@ -1271,6 +1249,7 @@ Gfx *lvRender(Gfx *gdl)
|
||||
#ifndef PLATFORM_N64
|
||||
// glares calculated earlier on PC, before prop matrices turn into garbage
|
||||
bgCalculateGlaresForVisibleRooms();
|
||||
debuggerUpdatePropInfo(false);
|
||||
#endif
|
||||
|
||||
// Calculate lookingatprop
|
||||
@@ -1742,21 +1721,12 @@ Gfx *lvRender(Gfx *gdl)
|
||||
}
|
||||
|
||||
if (g_Vars.currentplayer->dostartnewlife) {
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode != NETMODE_CLIENT)
|
||||
#endif
|
||||
playerStartNewLife();
|
||||
playerStartNewLife();
|
||||
}
|
||||
}
|
||||
|
||||
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 VERSION >= VERSION_NTSC_1_0
|
||||
&& playerHasSharedViewport()
|
||||
@@ -2309,9 +2279,6 @@ void lvTick(void)
|
||||
|
||||
if (elapsed < TICKS(g_MpTimeLimit60) && nexttime >= TICKS(g_MpTimeLimit60)) {
|
||||
// Match is ending due to time limit reached
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode != NETMODE_CLIENT)
|
||||
#endif
|
||||
mainEndStage();
|
||||
}
|
||||
|
||||
@@ -2365,12 +2332,6 @@ void lvTick(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode == NETMODE_CLIENT) {
|
||||
g_NumReasonsToEndMpMatch = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_NumReasonsToEndMpMatch > 0 && numdying == 0) {
|
||||
mainEndStage();
|
||||
}
|
||||
|
||||
+59
-240
@@ -33,9 +33,6 @@
|
||||
#include "lib/str.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#include "net/net.h"
|
||||
#endif
|
||||
|
||||
u8 g_InventoryWeapon;
|
||||
|
||||
@@ -44,11 +41,6 @@ struct menudialogdef g_CiControlPlayer2MenuDialog;
|
||||
struct menudialogdef g_CinemaMenuDialog;
|
||||
#ifndef PLATFORM_N64
|
||||
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
|
||||
|
||||
char *menuTextCurrentStageName(struct menuitem *item)
|
||||
@@ -748,7 +740,6 @@ MenuItemHandlerResult menuhandlerAcceptMission(s32 operation, struct menuitem *i
|
||||
setNumPlayers(1);
|
||||
}
|
||||
} else if (g_MissionConfig.isanti) {
|
||||
#ifdef PLATFORM_N64
|
||||
if (g_Vars.pendingantiplayernum == 1) {
|
||||
g_Vars.bondplayernum = 0;
|
||||
g_Vars.antiplayernum = 1;
|
||||
@@ -758,27 +749,7 @@ MenuItemHandlerResult menuhandlerAcceptMission(s32 operation, struct menuitem *i
|
||||
}
|
||||
|
||||
g_Vars.coopplayernum = -1;
|
||||
|
||||
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 {
|
||||
// Solo
|
||||
g_Vars.bondplayernum = 0;
|
||||
@@ -1566,8 +1537,6 @@ MenuItemHandlerResult menuhandlerAntiRadar(s32 operation, struct menuitem *item,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_N64
|
||||
|
||||
MenuItemHandlerResult menuhandlerAntiPlayer(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||
{
|
||||
const u16 labels[] = {L_OPTIONS_271, L_OPTIONS_272};
|
||||
@@ -1634,100 +1603,6 @@ struct menuitem g_AntiOptionsMenuItems[] = {
|
||||
{ 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 = {
|
||||
MENUDIALOGTYPE_DEFAULT,
|
||||
L_OPTIONS_266, // "Counter-Operative Options"
|
||||
@@ -2807,7 +2682,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_205, // "Sight on Screen"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerSightOnScreen,
|
||||
},
|
||||
{
|
||||
@@ -2815,7 +2690,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_206, // "Always Show Target"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerAlwaysShowTarget,
|
||||
},
|
||||
{
|
||||
@@ -2823,7 +2698,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_207, // "Show Zoom Range"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerShowZoomRange,
|
||||
},
|
||||
{
|
||||
@@ -2831,7 +2706,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_208, // "Ammo on Screen"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerAmmoOnScreen,
|
||||
},
|
||||
{
|
||||
@@ -2839,7 +2714,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_209, // "Show Gun Function"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerShowGunFunction,
|
||||
},
|
||||
{
|
||||
@@ -2847,7 +2722,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_210, // "Paintball"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerPaintball,
|
||||
},
|
||||
{
|
||||
@@ -2855,7 +2730,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_169, // "In-Game Subtitles"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerInGameSubtitles,
|
||||
},
|
||||
{
|
||||
@@ -2863,7 +2738,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_168, // "Cutscene Subtitles"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerCutsceneSubtitles,
|
||||
},
|
||||
{
|
||||
@@ -2871,7 +2746,7 @@ struct menuitem g_MissionDisplayOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_212, // "Show Mission Time"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerShowMissionTime,
|
||||
},
|
||||
{
|
||||
@@ -2908,7 +2783,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_145, // "Sight on Screen"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerSightOnScreen,
|
||||
},
|
||||
{
|
||||
@@ -2916,7 +2791,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_146, // "Target"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerAlwaysShowTarget,
|
||||
},
|
||||
{
|
||||
@@ -2924,7 +2799,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_147, // "Zoom Range"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerShowZoomRange,
|
||||
},
|
||||
{
|
||||
@@ -2932,7 +2807,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_148, // "Show Ammo"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerAmmoOnScreen,
|
||||
},
|
||||
{
|
||||
@@ -2940,7 +2815,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_149, // "Gun Function"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerShowGunFunction,
|
||||
},
|
||||
{
|
||||
@@ -2948,7 +2823,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_150, // "Paintball"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerPaintball,
|
||||
},
|
||||
{
|
||||
@@ -2960,7 +2835,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
||||
#else
|
||||
L_MPWEAPONS_169, // "In-Game Subtitles"
|
||||
#endif
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerInGameSubtitles,
|
||||
},
|
||||
{
|
||||
@@ -2972,7 +2847,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
||||
#else
|
||||
L_MPWEAPONS_168, // "Cutscene Subtitles"
|
||||
#endif
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerCutsceneSubtitles,
|
||||
},
|
||||
{
|
||||
@@ -2980,7 +2855,7 @@ struct menuitem g_2PMissionDisplayOptionsVMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_152, // "Mission Time"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerShowMissionTime,
|
||||
},
|
||||
{
|
||||
@@ -3017,7 +2892,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_205, // "Sight on Screen"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerSightOnScreen,
|
||||
},
|
||||
{
|
||||
@@ -3025,7 +2900,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_206, // "Always Show Target"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerAlwaysShowTarget,
|
||||
},
|
||||
{
|
||||
@@ -3033,7 +2908,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_207, // "Show Zoom Range"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerShowZoomRange,
|
||||
},
|
||||
{
|
||||
@@ -3041,7 +2916,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_208, // "Ammo on Screen"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerAmmoOnScreen,
|
||||
},
|
||||
{
|
||||
@@ -3049,7 +2924,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_209, // "Show Gun Function"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerShowGunFunction,
|
||||
},
|
||||
{
|
||||
@@ -3057,7 +2932,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_210, // "Paintball"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerPaintball,
|
||||
},
|
||||
{
|
||||
@@ -3065,7 +2940,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_169, // "In-Game Subtitles"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerInGameSubtitles,
|
||||
},
|
||||
{
|
||||
@@ -3073,7 +2948,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_168, // "Cutscene Subtitles"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerCutsceneSubtitles,
|
||||
},
|
||||
{
|
||||
@@ -3081,7 +2956,7 @@ struct menuitem g_CiDisplayMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_212, // "Show Mission Time"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerShowMissionTime,
|
||||
},
|
||||
{
|
||||
@@ -3120,7 +2995,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_205, // "Sight on Screen"
|
||||
MAX_PLAYERS + 1,
|
||||
0x00000005,
|
||||
menuhandlerSightOnScreen,
|
||||
},
|
||||
{
|
||||
@@ -3128,7 +3003,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_206, // "Always Show Target"
|
||||
MAX_PLAYERS + 1,
|
||||
0x00000005,
|
||||
menuhandlerAlwaysShowTarget,
|
||||
},
|
||||
{
|
||||
@@ -3136,7 +3011,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_207, // "Show Zoom Range"
|
||||
MAX_PLAYERS + 1,
|
||||
0x00000005,
|
||||
menuhandlerShowZoomRange,
|
||||
},
|
||||
{
|
||||
@@ -3144,7 +3019,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_208, // "Ammo on Screen"
|
||||
MAX_PLAYERS + 1,
|
||||
0x00000005,
|
||||
menuhandlerAmmoOnScreen,
|
||||
},
|
||||
{
|
||||
@@ -3152,7 +3027,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_209, // "Show Gun Function"
|
||||
MAX_PLAYERS + 1,
|
||||
0x00000005,
|
||||
menuhandlerShowGunFunction,
|
||||
},
|
||||
{
|
||||
@@ -3160,7 +3035,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_210, // "Paintball"
|
||||
MAX_PLAYERS + 1,
|
||||
0x00000005,
|
||||
menuhandlerPaintball,
|
||||
},
|
||||
{
|
||||
@@ -3168,7 +3043,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_169, // "In-Game Subtitles"
|
||||
MAX_PLAYERS + 1,
|
||||
0x00000005,
|
||||
menuhandlerInGameSubtitles,
|
||||
},
|
||||
{
|
||||
@@ -3176,7 +3051,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_168, // "Cutscene Subtitles"
|
||||
MAX_PLAYERS + 1,
|
||||
0x00000005,
|
||||
menuhandlerCutsceneSubtitles,
|
||||
},
|
||||
{
|
||||
@@ -3184,7 +3059,7 @@ struct menuitem g_CiDisplayPlayer2MenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_212, // "Show Mission Time"
|
||||
MAX_PLAYERS + 1,
|
||||
0x00000005,
|
||||
menuhandlerShowMissionTime,
|
||||
},
|
||||
{
|
||||
@@ -3229,7 +3104,7 @@ struct menuitem g_MissionControlOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_195, // "Reverse Pitch"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerReversePitch,
|
||||
},
|
||||
{
|
||||
@@ -3237,7 +3112,7 @@ struct menuitem g_MissionControlOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_196, // "Look Ahead"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerLookAhead,
|
||||
},
|
||||
{
|
||||
@@ -3245,7 +3120,7 @@ struct menuitem g_MissionControlOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_197, // "Head Roll"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerHeadRoll,
|
||||
},
|
||||
{
|
||||
@@ -3253,7 +3128,7 @@ struct menuitem g_MissionControlOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_198, // "Auto-Aim"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerAutoAim,
|
||||
},
|
||||
{
|
||||
@@ -3261,7 +3136,7 @@ struct menuitem g_MissionControlOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_199, // "Aim Control"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerAimControl,
|
||||
},
|
||||
{
|
||||
@@ -3307,7 +3182,7 @@ struct menuitem g_CiControlOptionsMenuItems2[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_271, // ""
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerReversePitch,
|
||||
},
|
||||
{
|
||||
@@ -3315,7 +3190,7 @@ struct menuitem g_CiControlOptionsMenuItems2[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_272, // ""
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerLookAhead,
|
||||
},
|
||||
{
|
||||
@@ -3323,7 +3198,7 @@ struct menuitem g_CiControlOptionsMenuItems2[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_273, // ""
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerHeadRoll,
|
||||
},
|
||||
{
|
||||
@@ -3331,7 +3206,7 @@ struct menuitem g_CiControlOptionsMenuItems2[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_274, // ""
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerAutoAim,
|
||||
},
|
||||
{
|
||||
@@ -3339,7 +3214,7 @@ struct menuitem g_CiControlOptionsMenuItems2[] = {
|
||||
0,
|
||||
0,
|
||||
L_MPWEAPONS_275, // ""
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerAimControl,
|
||||
},
|
||||
{
|
||||
@@ -3385,7 +3260,7 @@ struct menuitem g_CiControlOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_195, // "Reverse Pitch"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerReversePitch,
|
||||
},
|
||||
{
|
||||
@@ -3393,7 +3268,7 @@ struct menuitem g_CiControlOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_196, // "Look Ahead"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerLookAhead,
|
||||
},
|
||||
{
|
||||
@@ -3401,7 +3276,7 @@ struct menuitem g_CiControlOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_197, // "Head Roll"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerHeadRoll,
|
||||
},
|
||||
{
|
||||
@@ -3409,7 +3284,7 @@ struct menuitem g_CiControlOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_198, // "Auto-Aim"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerAutoAim,
|
||||
},
|
||||
{
|
||||
@@ -3417,7 +3292,7 @@ struct menuitem g_CiControlOptionsMenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_199, // "Aim Control"
|
||||
MAX_PLAYERS,
|
||||
0x00000004,
|
||||
menuhandlerAimControl,
|
||||
},
|
||||
{
|
||||
@@ -3462,7 +3337,7 @@ struct menuitem g_CiControlPlayer2MenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_195, // "Reverse Pitch"
|
||||
MAX_PLAYERS + 1,
|
||||
0x00000005,
|
||||
menuhandlerReversePitch,
|
||||
},
|
||||
{
|
||||
@@ -3470,7 +3345,7 @@ struct menuitem g_CiControlPlayer2MenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_196, // "Look Ahead"
|
||||
MAX_PLAYERS + 1,
|
||||
0x00000005,
|
||||
menuhandlerLookAhead,
|
||||
},
|
||||
{
|
||||
@@ -3478,7 +3353,7 @@ struct menuitem g_CiControlPlayer2MenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_197, // "Head Roll"
|
||||
MAX_PLAYERS + 1,
|
||||
0x00000005,
|
||||
menuhandlerHeadRoll,
|
||||
},
|
||||
{
|
||||
@@ -3486,7 +3361,7 @@ struct menuitem g_CiControlPlayer2MenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_198, // "Auto-Aim"
|
||||
MAX_PLAYERS + 1,
|
||||
0x00000005,
|
||||
menuhandlerAutoAim,
|
||||
},
|
||||
{
|
||||
@@ -3494,7 +3369,7 @@ struct menuitem g_CiControlPlayer2MenuItems[] = {
|
||||
0,
|
||||
0,
|
||||
L_OPTIONS_199, // "Aim Control"
|
||||
MAX_PLAYERS + 1,
|
||||
0x00000005,
|
||||
menuhandlerAimControl,
|
||||
},
|
||||
{
|
||||
@@ -3861,11 +3736,7 @@ struct menudialogdef g_CiOptionsViaPcMenuDialog = {
|
||||
L_OPTIONS_180, // "Options"
|
||||
g_CiOptionsMenuItems,
|
||||
menudialog0010559c,
|
||||
#ifdef PLATFORM_N64
|
||||
0,
|
||||
#else
|
||||
MENUDIALOGFLAG_IGNOREBACK,
|
||||
#endif
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -4975,7 +4846,7 @@ MenuItemHandlerResult menuhandlerMainMenuCooperative(s32 operation, struct menui
|
||||
MenuItemHandlerResult menuhandlerMainMenuCounterOperative(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||
{
|
||||
if (operation == MENUOP_CHECKDISABLED) {
|
||||
if ((joyGetConnectedControllers() & ~0x1) == 0) {
|
||||
if ((joyGetConnectedControllers() & 2) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -4994,11 +4865,6 @@ MenuDialogHandlerResult menudialogMainMenu(s32 operation, struct menudialogdef *
|
||||
switch (operation) {
|
||||
case MENUOP_OPEN:
|
||||
g_Menus[g_MpPlayerNum].main.unke2c = 0;
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode) {
|
||||
netDisconnect();
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case MENUOP_TICK:
|
||||
if (g_Menus[g_MpPlayerNum].curdialog &&
|
||||
@@ -5006,17 +4872,6 @@ MenuDialogHandlerResult menudialogMainMenu(s32 operation, struct menudialogdef *
|
||||
g_MissionConfig.iscoop = 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;
|
||||
}
|
||||
|
||||
@@ -5050,11 +4905,7 @@ struct menuitem g_MainMenuMenuItems[] = {
|
||||
{
|
||||
MENUITEMTYPE_SELECTABLE,
|
||||
0,
|
||||
#ifdef PLATFORM_N64
|
||||
MENUITEMFLAG_SELECTABLE_CLOSESDIALOG | MENUITEMFLAG_BIGFONT,
|
||||
#else
|
||||
MENUITEMFLAG_SELECTABLE_CLOSESDIALOG | MENUITEMFLAG_BIGFONT | MENUITEMFLAG_ALWAYSDISABLED,
|
||||
#endif
|
||||
L_MISC_446, // "Carrington Institute"
|
||||
0x00000001,
|
||||
NULL,
|
||||
@@ -5062,11 +4913,7 @@ struct menuitem g_MainMenuMenuItems[] = {
|
||||
{
|
||||
MENUITEMTYPE_SELECTABLE,
|
||||
0,
|
||||
#ifdef PLATFORM_N64
|
||||
MENUITEMFLAG_BIGFONT,
|
||||
#else
|
||||
MENUITEMFLAG_BIGFONT | MENUITEMFLAG_ALWAYSDISABLED,
|
||||
#endif
|
||||
(uintptr_t)&mainMenuTextLabel,
|
||||
0x00000002,
|
||||
menuhandlerMainMenuSoloMissions,
|
||||
@@ -5074,11 +4921,7 @@ struct menuitem g_MainMenuMenuItems[] = {
|
||||
{
|
||||
MENUITEMTYPE_SELECTABLE,
|
||||
1,
|
||||
#ifdef PLATFORM_N64
|
||||
MENUITEMFLAG_BIGFONT,
|
||||
#else
|
||||
MENUITEMFLAG_BIGFONT | MENUITEMFLAG_ALWAYSDISABLED,
|
||||
#endif
|
||||
(uintptr_t)&mainMenuTextLabel,
|
||||
0x00000003,
|
||||
menuhandlerMainMenuCombatSimulator,
|
||||
@@ -5086,11 +4929,7 @@ struct menuitem g_MainMenuMenuItems[] = {
|
||||
{
|
||||
MENUITEMTYPE_SELECTABLE,
|
||||
2,
|
||||
#ifdef PLATFORM_N64
|
||||
MENUITEMFLAG_BIGFONT,
|
||||
#else
|
||||
MENUITEMFLAG_BIGFONT | MENUITEMFLAG_ALWAYSDISABLED,
|
||||
#endif
|
||||
(uintptr_t)&mainMenuTextLabel,
|
||||
0x00000004,
|
||||
menuhandlerMainMenuCooperative,
|
||||
@@ -5098,45 +4937,29 @@ struct menuitem g_MainMenuMenuItems[] = {
|
||||
{
|
||||
MENUITEMTYPE_SELECTABLE,
|
||||
3,
|
||||
#ifdef PLATFORM_N64
|
||||
MENUITEMFLAG_BIGFONT,
|
||||
#else
|
||||
MENUITEMFLAG_BIGFONT | MENUITEMFLAG_ALWAYSDISABLED,
|
||||
#endif
|
||||
(uintptr_t)&mainMenuTextLabel,
|
||||
0x00000005,
|
||||
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,
|
||||
0,
|
||||
MENUITEMFLAG_SELECTABLE_OPENSDIALOG | MENUITEMFLAG_BIGFONT,
|
||||
L_OPTIONS_187, // "Change Agent..."
|
||||
0x00000007,
|
||||
0x00000006,
|
||||
(void *)&g_ChangeAgentMenuDialog,
|
||||
},
|
||||
/*
|
||||
#ifndef PLATFORM_N64
|
||||
{
|
||||
MENUITEMTYPE_SELECTABLE,
|
||||
0,
|
||||
MENUITEMFLAG_SELECTABLE_OPENSDIALOG | MENUITEMFLAG_BIGFONT | MENUITEMFLAG_LITERAL_TEXT,
|
||||
(uintptr_t)"Exit Game",
|
||||
0x00000008,
|
||||
0x00000007,
|
||||
(void *)&g_ExitGameMenuDialog,
|
||||
},
|
||||
#endif
|
||||
*/
|
||||
{ MENUITEMTYPE_END },
|
||||
};
|
||||
|
||||
@@ -5145,11 +4968,7 @@ struct menudialogdef g_CiMenuViaPcMenuDialog = {
|
||||
L_OPTIONS_116, // "Perfect Menu"
|
||||
g_MainMenuMenuItems,
|
||||
menudialogMainMenu,
|
||||
#ifdef PLATFORM_N64
|
||||
MENUDIALOGFLAG_STARTSELECTS,
|
||||
#else
|
||||
MENUDIALOGFLAG_STARTSELECTS | MENUDIALOGFLAG_IGNOREBACK,
|
||||
#endif
|
||||
&g_CiOptionsViaPcMenuDialog,
|
||||
};
|
||||
|
||||
|
||||
+7
-45
@@ -49,10 +49,9 @@
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#include "platform.h"
|
||||
#include "video.h"
|
||||
#include "input.h"
|
||||
#include "net/net.h"
|
||||
#include "platform.h"
|
||||
#define BLUR_OFS 10
|
||||
#else
|
||||
#define BLUR_OFS 30
|
||||
@@ -148,33 +147,6 @@ s32 g_MouseDimmedMode = false;
|
||||
s32 g_MouseEndDeferredSlider = false;
|
||||
#endif
|
||||
|
||||
s32 menuAlt1Pressed(s32 playerNum)
|
||||
{
|
||||
const s32 rshoulderKey = VK_JOY1_RSHOULDER + playerNum * INPUT_MAX_CONTROLLER_BUTTONS;
|
||||
|
||||
if (playerNum == 0) {
|
||||
return inputKeyJustPressed(VK_LCTRL) || inputKeyJustPressed(rshoulderKey);
|
||||
}
|
||||
|
||||
return inputKeyJustPressed(rshoulderKey);
|
||||
}
|
||||
|
||||
s32 menuAlt2Pressed(s32 playerNum)
|
||||
{
|
||||
const s32 lshoulderKey = VK_JOY1_LSHOULDER + playerNum * INPUT_MAX_CONTROLLER_BUTTONS;
|
||||
|
||||
if (playerNum == 0) {
|
||||
return inputKeyJustPressed(VK_LALT) || inputKeyJustPressed(lshoulderKey);
|
||||
}
|
||||
|
||||
return inputKeyJustPressed(lshoulderKey);
|
||||
}
|
||||
|
||||
s32 menuAltAnyPressed(s32 playerNum)
|
||||
{
|
||||
return menuAlt1Pressed(playerNum) || menuAlt2Pressed(playerNum);
|
||||
}
|
||||
|
||||
void menuPlaySound(s32 menusound)
|
||||
{
|
||||
s32 sound = -1;
|
||||
@@ -3563,7 +3535,7 @@ void menuClose(void)
|
||||
void func0f0f8120(void)
|
||||
{
|
||||
#ifdef AVOID_UB
|
||||
u32 mpindex = g_MpPlayerNum % MAX_LOCAL_PLAYERS;
|
||||
u32 mpindex = g_MpPlayerNum % MAX_PLAYERS;
|
||||
struct menudialog *prev = g_Menus[mpindex].curdialog;
|
||||
s32 i;
|
||||
#else
|
||||
@@ -3578,6 +3550,9 @@ void func0f0f8120(void)
|
||||
}
|
||||
|
||||
#ifdef AVOID_UB
|
||||
mpindex = g_MpPlayerNum;
|
||||
if (mpindex >= MAX_PLAYERS)
|
||||
mpindex -= MAX_PLAYERS;
|
||||
if (g_Menus[mpindex].curdialog == prev) {
|
||||
while (g_Menus[mpindex].depth > 0) {
|
||||
menuPopDialog();
|
||||
@@ -5547,7 +5522,7 @@ Gfx *menuRender(Gfx *gdl)
|
||||
} else {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
g_MpPlayerNum = i;
|
||||
gdl = menuRenderDialogs(gdl);
|
||||
}
|
||||
@@ -5580,20 +5555,7 @@ Gfx *menuRender(Gfx *gdl)
|
||||
|
||||
gdl = text0f153628(gdl);
|
||||
|
||||
#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++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
// Figure out what text will be displayed. The text calculated
|
||||
// here is for measuring purposes only and isn't rendered.
|
||||
// Amusingly, there's a %d placeholder in the text which isn't
|
||||
|
||||
+11
-14
@@ -24,7 +24,6 @@
|
||||
#include "types.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#include "input.h"
|
||||
#include "console.h"
|
||||
#define MENU_KEYBOARD_ROWS 6
|
||||
#else
|
||||
#define MENU_KEYBOARD_ROWS 5
|
||||
@@ -1601,17 +1600,15 @@ bool menuitemKeyboardTick(struct menuitem *item, struct menuinputs *inputs, u32
|
||||
}
|
||||
} else if (kb->row == 5) {
|
||||
#ifndef PLATFORM_N64
|
||||
if (!conIsOpen()) {
|
||||
if (g_MenuKeyboardPlayer == -1) {
|
||||
g_MenuKeyboardPlayer = g_MpPlayerNum;
|
||||
inputClearLastTextChar();
|
||||
inputStartTextInput();
|
||||
menuPlaySound(MENUSOUND_SELECT);
|
||||
} else {
|
||||
g_MenuKeyboardPlayer = -1;
|
||||
inputStopTextInput();
|
||||
menuPlaySound(MENUSOUND_KEYBOARDCANCEL);
|
||||
}
|
||||
if (g_MenuKeyboardPlayer == -1) {
|
||||
g_MenuKeyboardPlayer = g_MpPlayerNum;
|
||||
inputClearLastTextChar();
|
||||
inputStartTextInput();
|
||||
menuPlaySound(MENUSOUND_SELECT);
|
||||
} else {
|
||||
g_MenuKeyboardPlayer = -1;
|
||||
inputStopTextInput();
|
||||
menuPlaySound(MENUSOUND_KEYBOARDCANCEL);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
@@ -4371,7 +4368,7 @@ Gfx *menuitemControllerRenderText(Gfx *gdl, s32 curmode, struct menurendercontex
|
||||
// during development the second player in the 2.x styles had to
|
||||
// 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.
|
||||
if (curmode > CONTROLMODE_24 && curmode < CONTROLMODE_PC) {
|
||||
if (curmode > CONTROLMODE_24 && curmode != CONTROLMODE_PC) {
|
||||
if (textnum == menuitemControllerGetButtonAction(prevmode + 4, i)) {
|
||||
colour = labelcolour;
|
||||
}
|
||||
@@ -4456,7 +4453,7 @@ Gfx *menuitemControllerRender(Gfx *gdl, struct menurendercontext *context)
|
||||
data->prevmode = -1;
|
||||
}
|
||||
} 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->contfadetimer = 0;
|
||||
data->prevmode = -1;
|
||||
|
||||
+9
-52
@@ -27,9 +27,6 @@
|
||||
#include "lib/snd.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#include "net/net.h"
|
||||
#endif
|
||||
|
||||
u8 g_FileState = 0;
|
||||
u8 var80062944 = 0;
|
||||
@@ -221,19 +218,13 @@ void menuTick(void)
|
||||
viBlack(false);
|
||||
g_MpNumJoined = 0;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode) {
|
||||
g_Vars.mpsetupmenu = MPSETUPMENU_ADVSETUP;
|
||||
g_MpSetup.chrslots = 1;
|
||||
} else
|
||||
#endif
|
||||
if (g_Vars.usingadvsetup) {
|
||||
g_Vars.mpsetupmenu = MPSETUPMENU_ADVSETUP;
|
||||
} else {
|
||||
g_Vars.mpsetupmenu = MPSETUPMENU_GENERAL;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
g_Vars.waitingtojoin[i] = false;
|
||||
|
||||
if (g_MpSetup.chrslots & (1 << i)) {
|
||||
@@ -242,13 +233,6 @@ void menuTick(void)
|
||||
if (g_Vars.mpsetupmenu == MPSETUPMENU_ADVSETUP) {
|
||||
g_MpNumJoined++;
|
||||
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) {
|
||||
g_MpNumJoined++;
|
||||
|
||||
@@ -302,11 +286,7 @@ void menuTick(void)
|
||||
|
||||
if (g_MenuData.root == MENUROOT_MPSETUP || g_MenuData.root == MENUROOT_4MBMAINMENU) {
|
||||
if (g_MenuData.unk008 == -1) {
|
||||
#if MAX_PLAYERS > 4
|
||||
g_MpSetup.chrslots &= 0xff00;
|
||||
#else
|
||||
g_MpSetup.chrslots &= 0xfff0;
|
||||
#endif
|
||||
}
|
||||
|
||||
g_MpNumJoined = 0;
|
||||
@@ -321,23 +301,11 @@ 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();
|
||||
challengePerformSanityChecks();
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
g_MpPlayerNum = i;
|
||||
|
||||
if (g_Menus[g_MpPlayerNum].curdialog) {
|
||||
@@ -349,7 +317,7 @@ void menuTick(void)
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
g_MpPlayerNum = i;
|
||||
|
||||
if (g_Menus[g_MpPlayerNum].curdialog) {
|
||||
@@ -373,7 +341,7 @@ void menuTick(void)
|
||||
// Limit to 2 players? But in a roundabout kind of way
|
||||
canjoin = true;
|
||||
|
||||
for (j = 0; j < MAX_LOCAL_PLAYERS; j++) {
|
||||
for (j = 0; j < MAX_PLAYERS; j++) {
|
||||
if (g_Vars.waitingtojoin[j]) {
|
||||
canjoin = false;
|
||||
}
|
||||
@@ -387,12 +355,6 @@ void menuTick(void)
|
||||
canjoin = true;
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode) {
|
||||
canjoin = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_BossFile.locktype == MPLOCKTYPE_CHALLENGE) {
|
||||
g_PlayerConfigsArray[i].base.team = 0;
|
||||
}
|
||||
@@ -564,12 +526,7 @@ void menuTick(void)
|
||||
func0f0fd548(4);
|
||||
}
|
||||
|
||||
#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
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (g_MpSetup.chrslots & (1 << i)) {
|
||||
if (g_Vars.coopplayernum >= 0) {
|
||||
if (g_Vars.stagenum == STAGE_DEEPSEA) {
|
||||
@@ -659,12 +616,12 @@ void menuTick(void)
|
||||
} else if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
|
||||
struct mpplayerconfig tmp;
|
||||
|
||||
tmp = g_PlayerConfigsArray[MAX_PLAYERS];
|
||||
g_PlayerConfigsArray[MAX_PLAYERS] = g_PlayerConfigsArray[0];
|
||||
tmp = g_PlayerConfigsArray[4];
|
||||
g_PlayerConfigsArray[4] = g_PlayerConfigsArray[0];
|
||||
g_PlayerConfigsArray[0] = tmp;
|
||||
|
||||
tmp = g_PlayerConfigsArray[MAX_PLAYERS + 1];
|
||||
g_PlayerConfigsArray[MAX_PLAYERS + 1] = g_PlayerConfigsArray[1];
|
||||
tmp = g_PlayerConfigsArray[5];
|
||||
g_PlayerConfigsArray[5] = g_PlayerConfigsArray[1];
|
||||
g_PlayerConfigsArray[1] = tmp;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,9 +19,6 @@
|
||||
#include "lib/main.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#include "net/net.h"
|
||||
#endif
|
||||
|
||||
struct menudialogdef g_MpEndscreenChallengeCompletedMenuDialog;
|
||||
struct menudialogdef g_MpEndscreenIndGameOverMenuDialog;
|
||||
@@ -105,11 +102,6 @@ MenuItemHandlerResult menuhandlerMpEndGame(s32 operation, struct menuitem *item,
|
||||
{
|
||||
if (operation == MENUOP_SET) {
|
||||
g_Vars.currentplayer->aborted = true;
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode == NETMODE_CLIENT) {
|
||||
netDisconnect();
|
||||
} else
|
||||
#endif
|
||||
mainEndStage();
|
||||
}
|
||||
|
||||
@@ -173,11 +165,6 @@ MenuItemHandlerResult menuhandlerMpPause(s32 operation, struct menuitem *item, u
|
||||
}
|
||||
|
||||
if (operation == MENUOP_CHECKHIDDEN) {
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
if (PLAYERCOUNT() == 1) {
|
||||
return true;
|
||||
}
|
||||
@@ -800,11 +787,7 @@ void mpPushPauseDialog(void)
|
||||
menuPushRootDialog(&g_MpPausePlayerRankingMenuDialog, MENUROOT_MPPAUSE);
|
||||
}
|
||||
} else {
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL
|
||||
#ifndef PLATFORM_N64
|
||||
|| LOCALPLAYERCOUNT() >= 3
|
||||
#endif
|
||||
) {
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||
menuPushRootDialog(&g_2PMissionPauseVMenuDialog, MENUROOT_MPPAUSE);
|
||||
} else {
|
||||
menuPushRootDialog(&g_2PMissionPauseHMenuDialog, MENUROOT_MPPAUSE);
|
||||
@@ -848,9 +831,6 @@ void mpPushEndscreenDialog(u32 arg0, u32 playernum)
|
||||
&& g_PlayerConfigsArray[g_MpPlayerNum].fileguid.fileid == 0
|
||||
&& g_PlayerConfigsArray[g_MpPlayerNum].fileguid.deviceserial == 0) {
|
||||
g_PlayerConfigsArray[g_MpPlayerNum].options |= OPTION_ASKEDSAVEPLAYER;
|
||||
#ifndef PLATFORM_N64
|
||||
if (!g_NetMode)
|
||||
#endif
|
||||
menuPushDialog(&g_MpEndscreenSavePlayerMenuDialog);
|
||||
}
|
||||
}
|
||||
|
||||
+49
-93
@@ -28,12 +28,9 @@
|
||||
#include "lib/lib_317f0.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#include "net/net.h"
|
||||
#include "fs.h"
|
||||
#include "system.h"
|
||||
#include "mpsetups.h"
|
||||
#endif
|
||||
|
||||
// bss
|
||||
struct chrdata *g_MpAllChrPtrs[MAX_MPCHRS];
|
||||
@@ -41,7 +38,7 @@ struct mpchrconfig *g_MpAllChrConfigPtrs[MAX_MPCHRS];
|
||||
s32 g_MpNumChrs;
|
||||
u32 var800ac534;
|
||||
struct mpbotconfig g_BotConfigsArray[MAX_BOTS];
|
||||
u8 g_MpSimulantDifficultiesPerNumPlayers[MAX_BOTS][MAX_LOCAL_PLAYERS];
|
||||
u8 g_MpSimulantDifficultiesPerNumPlayers[MAX_BOTS][MAX_PLAYERS];
|
||||
struct mpplayerconfig g_PlayerConfigsArray[MAX_MPPLAYERCONFIGS];
|
||||
u8 g_AmBotCommands[9];
|
||||
struct mpsetup g_MpSetup;
|
||||
@@ -146,7 +143,7 @@ struct mpweapon g_MpWeapons[NUM_MPWEAPONS] = {
|
||||
.usereloads = false, \
|
||||
}
|
||||
|
||||
struct extplayerconfig g_PlayerExtCfg[MAX_LOCAL_PLAYERS] = {
|
||||
struct extplayerconfig g_PlayerExtCfg[MAX_PLAYERS] = {
|
||||
PLAYER_EXT_CFG_DEFAULT,
|
||||
PLAYER_EXT_CFG_DEFAULT,
|
||||
PLAYER_EXT_CFG_DEFAULT,
|
||||
@@ -161,18 +158,11 @@ struct extplayerconfig g_PlayerExtCfg[MAX_LOCAL_PLAYERS] = {
|
||||
* value 0 will return 0.1
|
||||
* value 127 will return 1
|
||||
* value 255 will return 10
|
||||
* in a netgame it's always 1
|
||||
*/
|
||||
f32 mpHandicapToDamageScale(u8 value)
|
||||
{
|
||||
f32 tmp;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode) {
|
||||
return 1.f;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (value < 127) {
|
||||
return (value / 127.0f) * (value / 127.0f) * 0.9f + 0.1f;
|
||||
}
|
||||
@@ -206,38 +196,22 @@ void mpStartMatch(void)
|
||||
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_MpSetup.options & MPOPTION_AUTORANDOMWEAPON_START) {
|
||||
if (g_MpWeaponSetNum == WEAPONSET_RANDOM
|
||||
|| g_MpWeaponSetNum == WEAPONSET_RANDOMFIVE) {
|
||||
mpApplyWeaponSet();
|
||||
}
|
||||
}
|
||||
|
||||
if (g_NetMode != NETMODE_CLIENT)
|
||||
#endif
|
||||
{
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_MpSetup.options & MPOPTION_AUTORANDOMWEAPON_START) {
|
||||
if (g_MpWeaponSetNum == WEAPONSET_RANDOM || g_MpWeaponSetNum == WEAPONSET_RANDOMFIVE) {
|
||||
mpApplyWeaponSet();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
mpConfigureQuickTeamSimulants();
|
||||
mpConfigureQuickTeamSimulants();
|
||||
|
||||
if (!challengeIsFeatureUnlocked(MPFEATURE_ONEHITKILLS)) {
|
||||
g_MpSetup.options &= ~MPOPTION_ONEHITKILLS;
|
||||
}
|
||||
if (!challengeIsFeatureUnlocked(MPFEATURE_ONEHITKILLS)) {
|
||||
g_MpSetup.options &= ~MPOPTION_ONEHITKILLS;
|
||||
}
|
||||
|
||||
if (!challengeIsFeatureUnlocked(MPFEATURE_SLOWMOTION)) {
|
||||
g_MpSetup.options &= ~(MPOPTION_SLOWMOTION_ON | MPOPTION_SLOWMOTION_SMART);
|
||||
}
|
||||
if (!challengeIsFeatureUnlocked(MPFEATURE_SLOWMOTION)) {
|
||||
g_MpSetup.options &= ~(MPOPTION_SLOWMOTION_ON | MPOPTION_SLOWMOTION_SMART);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
@@ -280,15 +254,7 @@ void mpReset(void)
|
||||
g_Vars.lvmpbotlevel = true;
|
||||
}
|
||||
|
||||
#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
|
||||
{
|
||||
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
|
||||
struct mpplayerconfig tmp;
|
||||
|
||||
tmp = g_PlayerConfigsArray[MAX_PLAYERS];
|
||||
@@ -471,7 +437,7 @@ void mpPlayerSetDefaults(s32 playernum, bool autonames)
|
||||
g_PlayerConfigsArray[playernum].controlmode = CONTROLMODE_11;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_PlayerExtCfg[playernum % MAX_LOCAL_PLAYERS].extcontrols) {
|
||||
if (g_PlayerExtCfg[playernum % MAX_PLAYERS].extcontrols) {
|
||||
g_PlayerConfigsArray[playernum].controlmode = CONTROLMODE_PC;
|
||||
}
|
||||
#endif
|
||||
@@ -539,9 +505,9 @@ void mpPlayerSetDefaults(s32 playernum, bool autonames)
|
||||
g_PlayerConfigsArray[playernum].survivormedals = 0;
|
||||
g_PlayerConfigsArray[playernum].title = MPPLAYERTITLE_BEGINNER;
|
||||
|
||||
if (playernum < MAX_LOCAL_PLAYERS) {
|
||||
if (playernum < MAX_PLAYERS) {
|
||||
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
||||
for (j = 1; j <= MAX_LOCAL_PLAYERS; j++) {
|
||||
for (j = 1; j <= MAX_PLAYERS; j++) {
|
||||
challengeSetCompletedByPlayerWithNumPlayers(playernum, i, j, false);
|
||||
}
|
||||
}
|
||||
@@ -1425,7 +1391,7 @@ Gfx *mpRenderModalText(Gfx *gdl)
|
||||
&& g_Vars.currentplayer->redbloodfinished
|
||||
&& g_Vars.currentplayer->deathanimfinished
|
||||
&& !(g_Vars.coopplayernum >= 0 && ((g_Vars.bond->isdead && g_Vars.coop->isdead) || !g_Vars.currentplayer->coopcanrestart || g_InCutscene))
|
||||
&& !(g_Vars.antiplayernum >= 0 && ((PLAYER_IS_NOT_ANTI(g_Vars.currentplayer) || g_InCutscene)))
|
||||
&& !(g_Vars.antiplayernum >= 0 && ((g_Vars.currentplayer != g_Vars.anti || g_InCutscene)))
|
||||
&& g_NumReasonsToEndMpMatch == 0) {
|
||||
// Render "Press START" text
|
||||
gdl = text0f153628(gdl);
|
||||
@@ -2573,12 +2539,10 @@ void mpEndMatch(void)
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode != NETMODE_CLIENT) {
|
||||
if (g_MpSetup.options & MPOPTION_AUTORANDOMWEAPON_END) {
|
||||
if (g_MpWeaponSetNum == WEAPONSET_RANDOM
|
||||
|| g_MpWeaponSetNum == WEAPONSET_RANDOMFIVE) {
|
||||
mpApplyWeaponSet();
|
||||
}
|
||||
if (g_MpSetup.options & MPOPTION_AUTORANDOMWEAPON_END) {
|
||||
if (g_MpWeaponSetNum == WEAPONSET_RANDOM
|
||||
|| g_MpWeaponSetNum == WEAPONSET_RANDOMFIVE) {
|
||||
mpApplyWeaponSet();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -2740,10 +2704,10 @@ void mpFindUnusedHeadAndBody(u8 *mpheadnum, u8 *mpbodynum)
|
||||
|
||||
s32 mpChooseRandomLockPlayer(void)
|
||||
{
|
||||
s32 start = rngRandom() % MAX_PLAYERS;
|
||||
s32 start = rngRandom() % 4;
|
||||
s32 i;
|
||||
|
||||
for (i = (start + 1) % MAX_PLAYERS;; i = (i + 1) % MAX_PLAYERS) {
|
||||
for (i = (start + 1) % 4;; i = (i + 1) % 4) {
|
||||
if ((g_MpSetup.chrslots & (1 << i)) || i == start) {
|
||||
break;
|
||||
}
|
||||
@@ -3187,11 +3151,11 @@ void mpCreateBotFromProfile(s32 botnum, u8 profilenum)
|
||||
g_BotConfigsArray[botnum].type = g_BotProfiles[profilenum].type;
|
||||
g_BotConfigsArray[botnum].difficulty = g_BotProfiles[profilenum].difficulty;
|
||||
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
g_MpSimulantDifficultiesPerNumPlayers[botnum][i] = g_BotConfigsArray[botnum].difficulty;
|
||||
}
|
||||
|
||||
g_MpSetup.chrslots |= 1 << (botnum + MAX_PLAYERS);
|
||||
g_MpSetup.chrslots |= 1 << (botnum + 4);
|
||||
strcpy(g_BotConfigsArray[botnum].base.name, "Sim\n");
|
||||
g_BotConfigsArray[botnum].base.team = team;
|
||||
|
||||
@@ -3220,7 +3184,7 @@ void mpSetBotDifficulty(s32 botnum, s32 difficulty)
|
||||
|
||||
g_BotConfigsArray[botnum].difficulty = difficulty;
|
||||
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
g_MpSimulantDifficultiesPerNumPlayers[botnum][i] = g_BotConfigsArray[botnum].difficulty;
|
||||
}
|
||||
}
|
||||
@@ -3234,7 +3198,7 @@ s32 mpGetSlotForNewBot(void)
|
||||
{
|
||||
s32 i = 0;
|
||||
|
||||
while (i < MAX_BOTS - 1 && g_MpSetup.chrslots & (1 << (i + MAX_PLAYERS))) {
|
||||
while (i < MAX_BOTS - 1 && g_MpSetup.chrslots & (1 << (i + 4))) {
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -3243,7 +3207,7 @@ s32 mpGetSlotForNewBot(void)
|
||||
|
||||
void mpRemoveSimulant(s32 index)
|
||||
{
|
||||
g_MpSetup.chrslots &= ~(1 << (index + MAX_PLAYERS));
|
||||
g_MpSetup.chrslots &= ~(1 << (index + 4));
|
||||
g_BotConfigsArray[index].base.name[0] = '\0';
|
||||
func0f1881d4(index);
|
||||
mpGenerateBotNames();
|
||||
@@ -3266,11 +3230,7 @@ void mpCopySimulant(s32 index)
|
||||
|
||||
bool mpHasSimulants(void)
|
||||
{
|
||||
#if MAX_PLAYERS > 4
|
||||
if ((g_MpSetup.chrslots & 0xff00) != 0) {
|
||||
#else
|
||||
if ((g_MpSetup.chrslots & 0xfff0) != 0) {
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3282,7 +3242,7 @@ bool mpHasUnusedBotSlots(void)
|
||||
s32 numvacant = challengeIsFeatureUnlocked(MPFEATURE_8BOTS) ? MAX_BOTS : 4;
|
||||
s32 i;
|
||||
|
||||
for (i = MAX_PLAYERS; i < MAX_MPCHRS; i++) {
|
||||
for (i = 4; i < MAX_MPCHRS; i++) {
|
||||
if (g_MpSetup.chrslots & (1 << i)) {
|
||||
numvacant--;
|
||||
}
|
||||
@@ -3300,9 +3260,9 @@ bool mpIsSimSlotEnabled(s32 slot)
|
||||
s32 numfree = MAX_BOTS;
|
||||
s32 i;
|
||||
|
||||
if ((g_MpSetup.chrslots & (1 << (slot + MAX_PLAYERS))) == 0) {
|
||||
if ((g_MpSetup.chrslots & (1 << (slot + 4))) == 0) {
|
||||
for (i = 0; i < MAX_BOTS; i++) {
|
||||
if (g_MpSetup.chrslots & (1 << (i + MAX_PLAYERS))) {
|
||||
if (g_MpSetup.chrslots & (1 << (i + 4))) {
|
||||
numfree--;
|
||||
}
|
||||
}
|
||||
@@ -3354,9 +3314,9 @@ void mpGenerateBotNames(void)
|
||||
}
|
||||
|
||||
// Count the number of bots using each profile (MeatSim, TurtleSim etc)
|
||||
for (i = MAX_PLAYERS; i < MAX_MPCHRS; i++) {
|
||||
for (i = 4; i < MAX_MPCHRS; i++) {
|
||||
if (g_MpSetup.chrslots & (1 << i)) {
|
||||
profilenum = mpFindBotProfile(g_BotConfigsArray[i - MAX_PLAYERS].type, g_BotConfigsArray[i - MAX_PLAYERS].difficulty);
|
||||
profilenum = mpFindBotProfile(g_BotConfigsArray[i - 4].type, g_BotConfigsArray[i - 4].difficulty);
|
||||
|
||||
if (profilenum >= 0 && profilenum < ARRAYCOUNT(g_BotProfiles)) {
|
||||
counts[profilenum]++;
|
||||
@@ -3375,20 +3335,20 @@ void mpGenerateBotNames(void)
|
||||
}
|
||||
}
|
||||
|
||||
for (i = MAX_PLAYERS; i < MAX_MPCHRS; i++) {
|
||||
for (i = 4; i < MAX_MPCHRS; i++) {
|
||||
if (g_MpSetup.chrslots & (1 << i)) {
|
||||
profilenum = mpFindBotProfile(g_BotConfigsArray[i - MAX_PLAYERS].type, g_BotConfigsArray[i - MAX_PLAYERS].difficulty);
|
||||
profilenum = mpFindBotProfile(g_BotConfigsArray[i - 4].type, g_BotConfigsArray[i - 4].difficulty);
|
||||
|
||||
if (profilenum >= 0 && profilenum < ARRAYCOUNT(g_BotProfiles)) {
|
||||
if (counts[profilenum] >= 0) {
|
||||
// Multiple bots using this profile - append the number
|
||||
counts[profilenum]++;
|
||||
sprintf(name, "%s:%d\n", langGet(g_BotProfiles[profilenum].name), counts[profilenum]);
|
||||
strcpy(g_BotConfigsArray[i - MAX_PLAYERS].base.name, name);
|
||||
strcpy(g_BotConfigsArray[i - 4].base.name, name);
|
||||
} else {
|
||||
// One bots using this profile - just use the profile name
|
||||
sprintf(name, "%s\n", langGet(g_BotProfiles[profilenum].name));
|
||||
strcpy(g_BotConfigsArray[i - MAX_PLAYERS].base.name, name);
|
||||
strcpy(g_BotConfigsArray[i - 4].base.name, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3437,7 +3397,7 @@ s32 func0f18d074(s32 index)
|
||||
|
||||
for (i = 0; i < MAX_BOTS; i++) {
|
||||
if (&g_BotConfigsArray[i].base == g_MpAllChrConfigPtrs[index]) {
|
||||
return i + MAX_PLAYERS;
|
||||
return i + 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3559,13 +3519,13 @@ void mpplayerfileLoadWad(s32 playernum, struct savebuffer *buffer, s32 arg2)
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
// override with PC controls if enabled in the config
|
||||
if (g_PlayerExtCfg[playernum % MAX_LOCAL_PLAYERS].extcontrols) {
|
||||
if (g_PlayerExtCfg[playernum % MAX_PLAYERS].extcontrols) {
|
||||
g_PlayerConfigsArray[playernum].controlmode = CONTROLMODE_PC;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
||||
for (j = 1; j < MAX_LOCAL_PLAYERS + 1; j++) {
|
||||
for (j = 1; j < MAX_PLAYERS + 1; j++) {
|
||||
challengeSetCompletedByPlayerWithNumPlayers(playernum, i, j, savebufferReadBits(buffer, 1));
|
||||
}
|
||||
}
|
||||
@@ -3705,7 +3665,7 @@ void mpplayerfileSaveWad(s32 playernum, struct savebuffer *buffer)
|
||||
savebufferOr(buffer, g_PlayerConfigsArray[playernum].options, 12);
|
||||
|
||||
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) {
|
||||
for (j = 1; j < MAX_LOCAL_PLAYERS + 1; j++) {
|
||||
for (j = 1; j < MAX_PLAYERS + 1; j++) {
|
||||
savebufferOr(buffer, challengeIsCompletedByPlayerWithNumPlayers(playernum, i, j), 1);
|
||||
}
|
||||
}
|
||||
@@ -3890,7 +3850,7 @@ void mpApplyConfig(struct mpconfigfull *config)
|
||||
for (i = 0; i < MAX_BOTS; i++) {
|
||||
g_BotConfigsArray[i].type = config->config.simulants[i].type;
|
||||
|
||||
for (j = 0; j < MAX_LOCAL_PLAYERS; j++) {
|
||||
for (j = 0; j < MAX_PLAYERS; j++) {
|
||||
g_MpSimulantDifficultiesPerNumPlayers[i][j] = config->config.simulants[i].difficulties[j];
|
||||
}
|
||||
|
||||
@@ -3947,15 +3907,11 @@ void mp0f18dec4(s32 slot)
|
||||
mpApplyConfig(config);
|
||||
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
#if MAX_PLAYERS > 4
|
||||
g_MpSetup.chrslots &= 0xff;
|
||||
#else
|
||||
g_MpSetup.chrslots &= 0x0f;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < MAX_BOTS; i++) {
|
||||
if (g_BotConfigsArray[i].difficulty != BOTDIFF_DISABLED) {
|
||||
g_MpSetup.chrslots |= 1 << (i + MAX_PLAYERS);
|
||||
g_MpSetup.chrslots |= 1 << (i + 4);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -4016,12 +3972,12 @@ void mpsetupfileLoadWad(struct savebuffer *buffer, u8 version)
|
||||
g_BotConfigsArray[i].type = savebufferReadBits(buffer, 5);
|
||||
g_BotConfigsArray[i].difficulty = savebufferReadBits(buffer, 3);
|
||||
|
||||
for (j = 0; j < MAX_LOCAL_PLAYERS; j++) {
|
||||
for (j = 0; j < MAX_PLAYERS; j++) {
|
||||
g_MpSimulantDifficultiesPerNumPlayers[i][j] = g_BotConfigsArray[i].difficulty;
|
||||
}
|
||||
|
||||
if (g_BotConfigsArray[i].difficulty != BOTDIFF_DISABLED) {
|
||||
g_MpSetup.chrslots |= 1 << (i + MAX_PLAYERS);
|
||||
g_MpSetup.chrslots |= 1 << (i + 4);
|
||||
}
|
||||
|
||||
g_BotConfigsArray[i].base.mpheadnum = savebufferReadBits(buffer, 7);
|
||||
@@ -4048,7 +4004,7 @@ void mpsetupfileLoadWad(struct savebuffer *buffer, u8 version)
|
||||
g_MpSetup.scorelimit = savebufferReadBits(buffer, 7);
|
||||
g_MpSetup.teamscorelimit = savebufferReadBits(buffer, 9);
|
||||
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
g_PlayerConfigsArray[i].base.team = savebufferReadBits(buffer, 3);
|
||||
}
|
||||
|
||||
@@ -4064,7 +4020,7 @@ void mpsetupfileSaveWad(struct savebuffer *buffer)
|
||||
savebufferWriteString_ext(buffer, g_MpSetup.name, MPSETUP_MAXNAME + 1);
|
||||
|
||||
for (i = 0; i < MAX_BOTS; i++) {
|
||||
if (g_MpSetup.chrslots & (1 << (i + MAX_PLAYERS))) {
|
||||
if (g_MpSetup.chrslots & (1 << (i + 4))) {
|
||||
numsims++;
|
||||
}
|
||||
}
|
||||
@@ -4080,7 +4036,7 @@ void mpsetupfileSaveWad(struct savebuffer *buffer)
|
||||
for (i = 0; i < MAX_BOTS; i++) {
|
||||
savebufferOr(buffer, g_BotConfigsArray[i].type, 5);
|
||||
|
||||
if (g_MpSetup.chrslots & (1 << (i + MAX_PLAYERS))) {
|
||||
if (g_MpSetup.chrslots & (1 << (i + 4))) {
|
||||
savebufferOr(buffer, g_BotConfigsArray[i].difficulty, 3);
|
||||
} else {
|
||||
savebufferOr(buffer, BOTDIFF_DISABLED, 3);
|
||||
@@ -4116,7 +4072,7 @@ void mpsetupfileSaveWad(struct savebuffer *buffer)
|
||||
savebufferOr(buffer, g_MpSetup.scorelimit, 7);
|
||||
savebufferOr(buffer, g_MpSetup.teamscorelimit, 9);
|
||||
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
savebufferOr(buffer, g_PlayerConfigsArray[i].base.team, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1039,7 +1039,7 @@ struct prop *scenarioCreateObj(s32 modelnum, s16 padnum, f32 arg2, u32 flags, u3
|
||||
*/
|
||||
void scenarioCreateHudmsg(s32 playernum, char *message)
|
||||
{
|
||||
if (playernum >= 0 && playernum < LOCALPLAYERCOUNT()) {
|
||||
if (playernum >= 0 && playernum < PLAYERCOUNT()) {
|
||||
s32 prevplayernum = g_Vars.currentplayernum;
|
||||
|
||||
setCurrentPlayerNum(playernum);
|
||||
|
||||
+37
-65
@@ -24,12 +24,9 @@
|
||||
#include "data.h"
|
||||
#include "gbiex.h"
|
||||
#include "types.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#include "net/net.h"
|
||||
#include "system.h"
|
||||
#include "input.h"
|
||||
#include "mpsetups.h"
|
||||
#endif
|
||||
|
||||
struct menuitem g_MpCharacterMenuItems[];
|
||||
struct menudialogdef g_MpAddSimulantMenuDialog;
|
||||
@@ -46,6 +43,33 @@ extern struct menudialogdef g_FilemgrErrorMenuDialog;
|
||||
extern s32 g_MpWeaponSetNum;
|
||||
#endif
|
||||
|
||||
static inline s32 menuAlt1Pressed(s32 playerNum)
|
||||
{
|
||||
const s32 rshoulderKey = VK_JOY1_RSHOULDER + playerNum * INPUT_MAX_CONTROLLER_BUTTONS;
|
||||
|
||||
if (playerNum == 0) {
|
||||
return inputKeyJustPressed(VK_LCTRL) || inputKeyJustPressed(rshoulderKey);
|
||||
}
|
||||
|
||||
return inputKeyJustPressed(rshoulderKey);
|
||||
}
|
||||
|
||||
static inline s32 menuAlt2Pressed(s32 playerNum)
|
||||
{
|
||||
const s32 lshoulderKey = VK_JOY1_LSHOULDER + playerNum * INPUT_MAX_CONTROLLER_BUTTONS;
|
||||
|
||||
if (playerNum == 0) {
|
||||
return inputKeyJustPressed(VK_LALT) || inputKeyJustPressed(lshoulderKey);
|
||||
}
|
||||
|
||||
return inputKeyJustPressed(lshoulderKey);
|
||||
}
|
||||
|
||||
static inline s32 menuAltPressed(s32 playerNum)
|
||||
{
|
||||
return menuAlt1Pressed(playerNum) || menuAlt2Pressed(playerNum);
|
||||
}
|
||||
|
||||
MenuItemHandlerResult menuhandlerMpDropOut(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||
{
|
||||
if (operation == MENUOP_SET) {
|
||||
@@ -2395,7 +2419,7 @@ MenuItemHandlerResult mpLoadPlayerMenuHandler(s32 operation, struct menuitem *it
|
||||
file = &g_FileLists[0]->files[data->list.value];
|
||||
available = true;
|
||||
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (file->fileid == g_PlayerConfigsArray[i].fileguid.fileid
|
||||
&& file->deviceserial == g_PlayerConfigsArray[i].fileguid.deviceserial) {
|
||||
if ((g_MpSetup.chrslots & (1 << i)) == 0) {
|
||||
@@ -2526,15 +2550,6 @@ MenuItemHandlerResult menuhandlerMpHandicapPlayer(s32 operation, struct menuitem
|
||||
char *mpMenuTextHandicapPlayerName(struct menuitem *item)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -2579,7 +2594,7 @@ MenuDialogHandlerResult menudialogMpSimulant(s32 operation, struct menudialogdef
|
||||
MenuDialogHandlerResult mpLoadSettingsDialogHandler(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data)
|
||||
{
|
||||
if (operation == MENUOP_TICK) {
|
||||
if (menuAltAnyPressed(g_MpPlayerNum)) {
|
||||
if (menuAltPressed(g_MpPlayerNum)) {
|
||||
u8 presets = g_Menus[g_MpPlayerNum].mpsetup.showpresets;
|
||||
g_Menus[g_MpPlayerNum].mpsetup.showpresets = 1 - presets;
|
||||
}
|
||||
@@ -2862,40 +2877,6 @@ struct menuitem g_MpHandicapsMenuItems[] = {
|
||||
0x000000ff,
|
||||
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,
|
||||
0,
|
||||
@@ -2994,7 +2975,7 @@ MenuItemHandlerResult mpAddChangeSimulantMenuHandler(s32 operation, struct menui
|
||||
if (botnum < 0) {
|
||||
botnum = mpGetSlotForNewBot();
|
||||
creating = 1;
|
||||
} else if ((g_MpSetup.chrslots & (1 << (botnum + MAX_PLAYERS))) == 0) {
|
||||
} else if ((g_MpSetup.chrslots & (1 << (botnum + 4))) == 0) {
|
||||
creating = 1;
|
||||
}
|
||||
|
||||
@@ -3252,7 +3233,7 @@ MenuItemHandlerResult menuhandlerMpSimulantSlot(s32 operation, struct menuitem *
|
||||
case MENUOP_SET:
|
||||
g_Menus[g_MpPlayerNum].mpsetup.slotindex = item->param;
|
||||
|
||||
if ((g_MpSetup.chrslots & (1 << (item->param + MAX_PLAYERS))) == 0) {
|
||||
if ((g_MpSetup.chrslots & (1 << (item->param + 4))) == 0) {
|
||||
menuPushDialog(&g_MpAddSimulantMenuDialog);
|
||||
} else if (IS4MB()) {
|
||||
menuPushDialog(&g_MpEditSimulant4MbMenuDialog);
|
||||
@@ -3278,7 +3259,7 @@ char *mpMenuTextSimulantName(struct menuitem *item)
|
||||
{
|
||||
s32 index = item->param;
|
||||
|
||||
if (g_BotConfigsArray[index].base.name[0] == '\0' || (g_MpSetup.chrslots & 1 << (index + MAX_PLAYERS)) == 0) {
|
||||
if (g_BotConfigsArray[index].base.name[0] == '\0' || (g_MpSetup.chrslots & 1 << (index + 4)) == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -3290,7 +3271,7 @@ char *func0f17d3dc(struct menuitem *item)
|
||||
s32 index = item->param;
|
||||
|
||||
if (g_BotConfigsArray[index].base.name[0] == '\0'
|
||||
|| ((g_MpSetup.chrslots & 1 << (index + MAX_PLAYERS)) == 0)) {
|
||||
|| ((g_MpSetup.chrslots & 1 << (index + 4)) == 0)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -3688,7 +3669,7 @@ MenuItemHandlerResult menuhandlerMpHumansVsSimulants(s32 operation, struct menui
|
||||
if (g_MpSetup.chrslots & (1 << i)) {
|
||||
struct mpchrconfig *mpchr = MPCHR(i);
|
||||
|
||||
mpchr->team = i < MAX_PLAYERS ? 0 : 1;
|
||||
mpchr->team = i < 4 ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3701,7 +3682,7 @@ MenuItemHandlerResult menuhandlerMpHumansVsSimulants(s32 operation, struct menui
|
||||
MenuItemHandlerResult menuhandlerMpHumanSimulantPairs(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||
{
|
||||
if (operation == MENUOP_SET) {
|
||||
u8 team_ids[MAX_PLAYERS] = {0, 1, 2, 3, 4, 5, 6, 7};
|
||||
u8 team_ids[4] = {0, 1, 2, 3};
|
||||
s32 i;
|
||||
s32 playerindex = 0;
|
||||
s32 simindex = 0;
|
||||
@@ -3710,7 +3691,7 @@ MenuItemHandlerResult menuhandlerMpHumanSimulantPairs(s32 operation, struct menu
|
||||
if (g_MpSetup.chrslots & (1 << i)) {
|
||||
struct mpchrconfig *mpchr = MPCHR(i);
|
||||
|
||||
if (i < MAX_PLAYERS) {
|
||||
if (i < 4) {
|
||||
mpchr->team = team_ids[playerindex++];
|
||||
} else {
|
||||
mpchr->team = team_ids[simindex++];
|
||||
@@ -3733,15 +3714,6 @@ char *mpMenuTextChrNameForTeamSetup(struct menuitem *item)
|
||||
struct mpchrconfig *mpchr = mpGetChrConfigBySlotNum(item->param);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -5489,7 +5461,7 @@ void mpCloseDialogsForNewSetup(void)
|
||||
s32 k;
|
||||
|
||||
// Loop through each player
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
g_MpPlayerNum = i;
|
||||
|
||||
// If they have a menu open
|
||||
|
||||
+2
-2
@@ -343,7 +343,7 @@ bool musicIsAnyPlayerInAmbientRoom(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 0; i < LOCALPLAYERCOUNT(); i++) {
|
||||
for (i = 0; i < PLAYERCOUNT(); i++) {
|
||||
if (g_Vars.players[i]->prop
|
||||
&& g_Vars.players[i]->prop->rooms
|
||||
&& g_Vars.players[i]->prop->rooms[0] != -1) {
|
||||
@@ -521,7 +521,7 @@ void _musicStartMpDeath(f32 arg0)
|
||||
void musicStartMpDeath(void)
|
||||
{
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_MusicDisableMpDeath || (g_NetMode && g_Vars.currentplayernum != 0)) {
|
||||
if (g_MusicDisableMpDeath) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -324,7 +324,7 @@ Gfx *nbombCreateGdl(void)
|
||||
Gfx *gdl;
|
||||
s32 index = 0;
|
||||
|
||||
if (LOCALPLAYERCOUNT() >= 2) {
|
||||
if (PLAYERCOUNT() >= 2) {
|
||||
index = 1;
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -234,7 +234,7 @@ struct pak g_Paks[5]; // controller paks + EEPROM
|
||||
u32 var800a317c;
|
||||
#endif
|
||||
|
||||
OSPfs g_Pfses[MAX_LOCAL_PLAYERS];
|
||||
OSPfs g_Pfses[MAX_PLAYERS];
|
||||
u32 var800a3320;
|
||||
u32 var800a3324;
|
||||
u32 var800a3328;
|
||||
@@ -4425,7 +4425,7 @@ void pak0f11c6d0(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
switch (g_Paks[i].state) {
|
||||
case PAKSTATE_PROBE:
|
||||
case PAKSTATE_MEM_DISPATCH:
|
||||
@@ -5441,14 +5441,14 @@ void pakDisableRumbleForAllPlayers(void)
|
||||
s32 i;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (g_Paks[i].type == PAKTYPE_RUMBLE) {
|
||||
g_Paks[i].rumblestate = RUMBLESTATE_DISABLED_STOPPING;
|
||||
joyStopRumble(i, true);
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
pakDisableRumbleForPlayer(i);
|
||||
}
|
||||
#endif
|
||||
@@ -5459,13 +5459,13 @@ void pakEnableRumbleForAllPlayers(void)
|
||||
s32 i;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_FINAL
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (g_Paks[i].type == PAKTYPE_RUMBLE && g_Paks[i].rumblestate == RUMBLESTATE_DISABLED_STOPPED) {
|
||||
g_Paks[i].rumblestate = RUMBLESTATE_ENABLING;
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
pakEnableRumbleForPlayer(i);
|
||||
}
|
||||
#endif
|
||||
@@ -5989,7 +5989,7 @@ bool gbpakIsAnyPerfectDark(void)
|
||||
#ifdef PLATFORM_N64
|
||||
s8 i;
|
||||
|
||||
for (i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (gbpakIdentifyGame(i) == GBGAME_PD) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+17
-138
@@ -74,8 +74,7 @@
|
||||
#include "platform.h"
|
||||
#include "video.h"
|
||||
#include "input.h"
|
||||
#include "net/net.h"
|
||||
#include "net/netmsg.h"
|
||||
#include "debugger.h"
|
||||
#endif
|
||||
|
||||
s32 g_DefaultWeapons[2];
|
||||
@@ -185,10 +184,7 @@ u32 var80070748 = 0;
|
||||
u32 var8007074c = 0;
|
||||
|
||||
bool g_PlayersWithControl[] = {
|
||||
true, true, true, true,
|
||||
#if MAX_PLAYERS > 4
|
||||
true, true, true, true
|
||||
#endif
|
||||
};
|
||||
|
||||
bool g_PlayerInvincible = false;
|
||||
@@ -607,7 +603,7 @@ void playerStartNewLife(void)
|
||||
if (cmd);
|
||||
if (cmd);
|
||||
|
||||
if (g_Vars.antiplayernum < 0 || PLAYER_IS_NOT_ANTI(g_Vars.currentplayer)) {
|
||||
if (g_Vars.antiplayernum < 0 || g_Vars.currentplayer != g_Vars.anti) {
|
||||
while (cmd[0] != INTROCMD_END) {
|
||||
switch (cmd[0]) {
|
||||
case INTROCMD_SPAWN:
|
||||
@@ -981,7 +977,7 @@ void playerSpawn(void)
|
||||
}
|
||||
|
||||
if (g_Vars.mplayerisrunning) {
|
||||
if (g_Vars.antiplayernum >= 0 && PLAYER_IS_ANTI(g_Vars.currentplayer)) {
|
||||
if (g_Vars.antiplayernum >= 0 && g_Vars.currentplayer == g_Vars.anti) {
|
||||
numsqdists = 0;
|
||||
force = false;
|
||||
|
||||
@@ -1156,12 +1152,6 @@ void playerSpawn(void)
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -1204,7 +1194,7 @@ void playerChooseBodyAndHead(s32 *bodynum, s32 *headnum, s32 *arg2)
|
||||
bool solo;
|
||||
|
||||
if (g_Vars.antiplayernum >= 0
|
||||
&& PLAYER_IS_ANTI(g_Vars.currentplayer)
|
||||
&& g_Vars.currentplayer == g_Vars.anti
|
||||
&& g_Vars.antiheadnum >= 0
|
||||
&& g_Vars.antibodynum >= 0) {
|
||||
*headnum = g_Vars.antiheadnum;
|
||||
@@ -1546,7 +1536,7 @@ void playerTickChrBody(void)
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (g_Vars.antiplayernum >= 0
|
||||
&& PLAYER_IS_ANTI(g_Vars.currentplayer)
|
||||
&& g_Vars.currentplayer == g_Vars.anti
|
||||
&& g_Vars.currentplayer->vv_eyeheight > 159) {
|
||||
g_Vars.currentplayer->vv_eyeheight = 159;
|
||||
}
|
||||
@@ -2107,15 +2097,6 @@ void playerTickCutscene(bool arg0)
|
||||
}
|
||||
}
|
||||
#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)
|
||||
@@ -2902,12 +2883,6 @@ s16 playerGetFbHeight(void)
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
bool playerHasSharedViewport(void)
|
||||
{
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
|
||||
&& menuGetRoot() == MENUROOT_MPENDSCREEN
|
||||
&& var8009dfc0 == 0) {
|
||||
@@ -2928,14 +2903,14 @@ s16 playerGetViewportWidth(void)
|
||||
if ((!g_InCutscene || g_MainIsEndscreen) && menuGetRoot() != MENUROOT_COOPCONTINUE)
|
||||
#endif
|
||||
{
|
||||
if (LOCALPLAYERCOUNT() >= 3) {
|
||||
if (PLAYERCOUNT() >= 3) {
|
||||
// 3/4 players
|
||||
width = g_ViModes[g_ViRes].width / 2;
|
||||
|
||||
if (g_Vars.currentplayernum == 0 || g_Vars.currentplayernum == 2) {
|
||||
width--;
|
||||
}
|
||||
} else if (LOCALPLAYERCOUNT() == 2) {
|
||||
} else if (PLAYERCOUNT() == 2) {
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || g_Vars.fourmeg2player) {
|
||||
// 2 players vsplit
|
||||
width = g_ViModes[g_ViRes].width / 2;
|
||||
@@ -2968,7 +2943,7 @@ s16 playerGetViewportLeft(void)
|
||||
#endif
|
||||
s16 left;
|
||||
|
||||
if (LOCALPLAYERCOUNT() >= 3 && something != 0) {
|
||||
if (PLAYERCOUNT() >= 3 && something != 0) {
|
||||
if (g_Vars.currentplayernum == 1 || g_Vars.currentplayernum == 3) {
|
||||
// 3/4 players - right side
|
||||
left = g_ViModes[g_ViRes].width / 2 + g_ViModes[g_ViRes].fbwidth - g_ViModes[g_ViRes].width;
|
||||
@@ -2976,7 +2951,7 @@ s16 playerGetViewportLeft(void)
|
||||
// 3/4 players - left side
|
||||
left = g_ViModes[g_ViRes].fbwidth - g_ViModes[g_ViRes].width;
|
||||
}
|
||||
} else if (LOCALPLAYERCOUNT() == 2 && something != 0) {
|
||||
} else if (PLAYERCOUNT() == 2 && something != 0) {
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || g_Vars.fourmeg2player) {
|
||||
if (g_Vars.currentplayernum == 1) {
|
||||
// 2 players vsplit - right side
|
||||
@@ -3001,7 +2976,7 @@ s16 playerGetViewportHeight(void)
|
||||
{
|
||||
s16 height;
|
||||
|
||||
if (LOCALPLAYERCOUNT() >= 2
|
||||
if (PLAYERCOUNT() >= 2
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
&& !playerHasSharedViewport()
|
||||
#else
|
||||
@@ -3016,7 +2991,7 @@ s16 playerGetViewportHeight(void)
|
||||
height = tmp / 2;
|
||||
}
|
||||
|
||||
if (LOCALPLAYERCOUNT() == 2) {
|
||||
if (PLAYERCOUNT() == 2) {
|
||||
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||
height = tmp;
|
||||
} else if (g_Vars.currentplayernum == 0 && IS8MB()) {
|
||||
@@ -3052,7 +3027,7 @@ s16 playerGetViewportTop(void)
|
||||
{
|
||||
s16 top;
|
||||
|
||||
if (LOCALPLAYERCOUNT() >= 2
|
||||
if (PLAYERCOUNT() >= 2
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
&& !playerHasSharedViewport()
|
||||
#else
|
||||
@@ -3063,12 +3038,12 @@ s16 playerGetViewportTop(void)
|
||||
top = g_ViModes[g_ViRes].fulltop;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (optionsGetScreenSplit() != SCREENSPLIT_VERTICAL || LOCALPLAYERCOUNT() != 2)
|
||||
if (optionsGetScreenSplit() != SCREENSPLIT_VERTICAL || PLAYERCOUNT() != 2)
|
||||
#else
|
||||
if (optionsGetScreenSplit() != SCREENSPLIT_VERTICAL)
|
||||
#endif
|
||||
{
|
||||
if (LOCALPLAYERCOUNT() == 2
|
||||
if (PLAYERCOUNT() == 2
|
||||
&& g_Vars.currentplayernum == 1
|
||||
&& optionsGetScreenSplit() != SCREENSPLIT_VERTICAL
|
||||
&& !g_Vars.fourmeg2player) {
|
||||
@@ -3595,11 +3570,6 @@ void playerTick(bool arg0)
|
||||
bool pause = false;
|
||||
f32 newspeed;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (mode == CONTROLMODE_NA) {
|
||||
// TODO
|
||||
} else
|
||||
#endif
|
||||
if (mode == CONTROLMODE_23
|
||||
|| mode == CONTROLMODE_24
|
||||
|| mode == CONTROLMODE_22
|
||||
@@ -4774,15 +4744,8 @@ Gfx *playerRenderHud(Gfx *gdl)
|
||||
chr->chrflags |= CHRCFLAG_HIDDEN;
|
||||
}
|
||||
|
||||
if (g_Vars.antiplayernum >= 0 && PLAYER_IS_ANTI(g_Vars.currentplayer)) {
|
||||
if (g_Vars.antiplayernum >= 0 && g_Vars.currentplayer == g_Vars.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()) {
|
||||
g_Vars.currentplayer->dostartnewlife = true;
|
||||
}
|
||||
@@ -4796,12 +4759,8 @@ Gfx *playerRenderHud(Gfx *gdl)
|
||||
f32 stealhealth;
|
||||
f32 shield;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
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();
|
||||
canrestart = joyGetButtons(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000)
|
||||
&& !mpIsPaused();
|
||||
|
||||
// Get ready to respawn.
|
||||
// The other player's health will be halved.
|
||||
@@ -4907,13 +4866,6 @@ 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)
|
||||
&& !mpIsPaused()
|
||||
&& g_NumReasonsToEndMpMatch == 0) {
|
||||
@@ -4997,12 +4949,6 @@ void playerDie(bool force)
|
||||
struct chrdata *chr = g_Vars.currentplayer->prop->chr;
|
||||
s32 shooter;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode == NETMODE_CLIENT) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (chr->lastshooter >= 0 && chr->timeshooter > 0) {
|
||||
shooter = chr->lastshooter;
|
||||
} else {
|
||||
@@ -5010,12 +4956,6 @@ void playerDie(bool 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)
|
||||
@@ -5938,64 +5878,3 @@ void player0f0c3320(Mtxf *matrices, s32 count)
|
||||
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
|
||||
+1
-36
@@ -10,9 +10,6 @@
|
||||
#include "lib/rng.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#include "net/net.h"
|
||||
#endif
|
||||
|
||||
void playermgrInit(void)
|
||||
{
|
||||
@@ -29,16 +26,10 @@ void playermgrInit(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[1] = NULL;
|
||||
g_Vars.players[2] = NULL;
|
||||
g_Vars.players[3] = NULL;
|
||||
#endif
|
||||
|
||||
g_Vars.currentplayer = NULL;
|
||||
g_Vars.currentplayerindex = 0;
|
||||
@@ -57,16 +48,10 @@ void playermgrReset(void)
|
||||
|
||||
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[1] = NULL;
|
||||
g_Vars.players[2] = NULL;
|
||||
g_Vars.players[3] = NULL;
|
||||
#endif
|
||||
|
||||
if (count > 0) {
|
||||
s32 i;
|
||||
@@ -75,12 +60,6 @@ void playermgrAllocatePlayers(s32 count)
|
||||
playermgrAllocatePlayer(i);
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode && g_StageNum != STAGE_TITLE && g_StageNum != STAGE_CITRAINING) {
|
||||
netPlayersAllocate();
|
||||
}
|
||||
#endif
|
||||
|
||||
setCurrentPlayerNum(0);
|
||||
g_Vars.bond = g_Vars.players[g_Vars.bondplayernum];
|
||||
|
||||
@@ -612,7 +591,7 @@ void playermgrAllocatePlayer(s32 index)
|
||||
g_Vars.players[index]->introanimnum = 0;
|
||||
g_Vars.players[index]->lastsighton = 0;
|
||||
|
||||
for (i = 0; i < ARRAYCOUNT(g_Vars.players[index]->targetset); i++) {
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
g_Vars.players[index]->targetset[i] = 0;
|
||||
}
|
||||
|
||||
@@ -664,12 +643,6 @@ void playermgrAllocatePlayer(s32 index)
|
||||
g_Vars.players[index]->disguised = 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.bondcollisions = true;
|
||||
}
|
||||
@@ -833,14 +806,6 @@ void playermgrShuffle(void)
|
||||
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
|
||||
for (i = 0; i < MAX_PLAYERS - 1; i++) {
|
||||
s32 otherindex = rngRandom() % (MAX_PLAYERS - i);
|
||||
|
||||
@@ -148,12 +148,6 @@ void playerReset(void)
|
||||
g_PlayersWithControl[1] = true;
|
||||
g_PlayersWithControl[2] = 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;
|
||||
|
||||
playerSetTickMode(TICKMODE_GE_FADEIN);
|
||||
@@ -186,8 +180,7 @@ void playerReset(void)
|
||||
cmd = (struct cmd32 *)((uintptr_t)cmd + 8);
|
||||
break;
|
||||
case INTROCMD_WEAPON:
|
||||
if (cmd->param3 == 0 && PLAYER_IS_NOT_ANTI(g_Vars.currentplayer)) {
|
||||
|
||||
if (cmd->param3 == 0 && g_Vars.currentplayer != g_Vars.anti) {
|
||||
modelmgrLoadProjectileModeldefs(cmd->param1);
|
||||
|
||||
if (cmd->param2 >= 0) {
|
||||
@@ -214,7 +207,7 @@ void playerReset(void)
|
||||
cmd = (struct cmd32 *)((uintptr_t)cmd + 16);
|
||||
break;
|
||||
case INTROCMD_AMMO:
|
||||
if (cmd->param3 == 0 && PLAYER_IS_NOT_ANTI(g_Vars.currentplayer)) {
|
||||
if (cmd->param3 == 0 && g_Vars.currentplayer != g_Vars.anti) {
|
||||
bgunSetAmmoQuantity(cmd->param1, cmd->param2);
|
||||
}
|
||||
cmd = (struct cmd32 *)((uintptr_t)cmd + 16);
|
||||
|
||||
+1
-26
@@ -39,10 +39,6 @@
|
||||
#include "lib/lib_317f0.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#include "net/net.h"
|
||||
#include "net/netmsg.h"
|
||||
#endif
|
||||
|
||||
s16 *g_RoomPropListChunkIndexes;
|
||||
struct roomproplistchunk *g_RoomPropListChunks;
|
||||
@@ -171,10 +167,6 @@ struct prop *propAllocate(void)
|
||||
prop->propupdate60err = 2;
|
||||
prop->opawallhits = 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.allocstateindex++;
|
||||
@@ -207,9 +199,6 @@ void propFree(struct prop *prop)
|
||||
prop->prev = NULL;
|
||||
prop->chr = NULL;
|
||||
prop->rooms[0] = -1;
|
||||
#ifndef PLATFORM_N64
|
||||
prop->syncid = 0;
|
||||
#endif
|
||||
g_Vars.freeprops = prop;
|
||||
}
|
||||
|
||||
@@ -1626,13 +1615,6 @@ bool currentPlayerInteract(bool eyespy)
|
||||
prop = propFindForInteract(eyespy);
|
||||
|
||||
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) {
|
||||
case PROPTYPE_OBJ:
|
||||
case PROPTYPE_WEAPON:
|
||||
@@ -1651,12 +1633,6 @@ bool currentPlayerInteract(bool eyespy)
|
||||
|
||||
propExecuteTickOperation(prop, op);
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode == NETMODE_SERVER) {
|
||||
netmsgSvcPropUseWrite(&g_NetMsgRel, prop, g_Vars.currentplayer->client, op);
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2473,8 +2449,7 @@ void propsTestForPickup(void)
|
||||
|
||||
if (g_Vars.currentplayer->bondmovemode != MOVEMODE_CUTSCENE
|
||||
&& !g_PlayerInvincible
|
||||
&& PLAYER_IS_NOT_ANTI(g_Vars.currentplayer)
|
||||
) {
|
||||
&& g_Vars.currentplayer != g_Vars.anti) {
|
||||
roomsCopy(g_Vars.currentplayer->prop->rooms, allrooms);
|
||||
|
||||
for (i = 0; g_Vars.currentplayer->prop->rooms[i] != -1; i++) {
|
||||
|
||||
+28
-143
@@ -78,8 +78,8 @@
|
||||
#include "types.h"
|
||||
#include "string.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#include "net/net.h"
|
||||
#include "net/netmsg.h"
|
||||
#include "system.h"
|
||||
#include "debugger.h"
|
||||
#endif
|
||||
|
||||
void rng2SetSeed(u32 seed);
|
||||
@@ -159,13 +159,6 @@ bool doorCallLift(struct prop *doorprop, bool allowclose)
|
||||
struct doorobj *door = doorprop->door;
|
||||
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) {
|
||||
struct linkliftdoorobj *link = g_LiftDoors;
|
||||
|
||||
@@ -5105,11 +5098,6 @@ void liftGoToStop(struct liftobj *lift, s32 stopnum)
|
||||
// Sanity check to make sure lift is actually not moving
|
||||
if (lift->dist == 0 && lift->speed == 0) {
|
||||
lift->levelaim = stopnum;
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode == NETMODE_SERVER) {
|
||||
netmsgSvcPropLiftWrite(&g_NetMsgRel, lift->base.prop);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -5156,12 +5144,6 @@ void liftGoToStop(struct liftobj *lift, s32 stopnum)
|
||||
lift->speed = -lift->speed;
|
||||
lift->levelaim = stopnum;
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode == NETMODE_SERVER) {
|
||||
netmsgSvcPropLiftWrite(&g_NetMsgRel, lift->base.prop);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6688,12 +6670,6 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
|
||||
}
|
||||
|
||||
if (projectile->speed.f[0] == 0.0f && projectile->speed.f[2] == 0.0f && projectile->unk0dc == 0.0f) {
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode == NETMODE_SERVER) {
|
||||
// sliding object has stopped, sync the final position just in case
|
||||
netmsgSvcPropMoveWrite(&g_NetMsgRel, prop, NULL);
|
||||
}
|
||||
#endif
|
||||
objFreeProjectile(obj);
|
||||
}
|
||||
|
||||
@@ -6731,6 +6707,10 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
|
||||
|| prop->pos.y < -20000.0f || prop->pos.y > 32000.0f
|
||||
|| prop->pos.x < -32000.0f || prop->pos.x > 32000.0f
|
||||
|| prop->pos.z < -32000.0f || prop->pos.z > 32000.0f) {
|
||||
if (g_DebuggerActive) {
|
||||
sysLogPrintf(LOG_WARNING, "DBG: prop %p (%02x) obj %p (%02x) at (%.2f, %.2f, %.2f) expired",
|
||||
prop, prop->type, obj, obj->type, prop->pos.x, prop->pos.y, prop->pos.z);
|
||||
}
|
||||
obj->hidden |= OBJHFLAG_DELETING;
|
||||
}
|
||||
|
||||
@@ -8154,13 +8134,6 @@ void liftTick(struct prop *prop)
|
||||
stop = (stop + 1) % 4;
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
@@ -9163,7 +9136,7 @@ void autogunTickShoot(struct prop *autogunprop)
|
||||
// (ie. autogun is a Defense autogun or a thrown laptop)
|
||||
if (g_Vars.normmplayerisrunning
|
||||
|| (targetprop && (targetprop->type == PROPTYPE_CHR))
|
||||
|| (g_Vars.antiplayernum >= 0 && targetprop && PROP_IS_FOR_ANTI_PLAYER(targetprop))) {
|
||||
|| (g_Vars.antiplayernum >= 0 && targetprop && targetprop == g_Vars.anti->prop)) {
|
||||
if (cdExamLos08(&gunpos, gunrooms, &hitpos, CDTYPE_ALL, GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cdGetPos(&hitpos, 11480, "prop/propobj.c");
|
||||
@@ -10920,6 +10893,16 @@ u32 objTick(struct prop *prop)
|
||||
u32 padnum;
|
||||
struct defaultobj *newparent;
|
||||
|
||||
if (g_DebuggerActive) {
|
||||
if (obj->type != OBJTYPE_HOVERCAR && prop->pos.y <= -20000.f) {
|
||||
if ((obj->hidden & OBJHFLAG_FALLOUT) == 0) {
|
||||
sysLogPrintf(LOG_WARNING, "DBG: prop %p (%02x) obj %p (%02x) at (%.2f, %.2f, %.2f) fell out of world",
|
||||
prop, prop->type, obj, obj->type, prop->pos.x, prop->pos.y, prop->pos.z);
|
||||
obj->hidden |= OBJHFLAG_FALLOUT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (prop->timetoregen > 0) {
|
||||
// Prop is taken/unavailable
|
||||
regenning = true;
|
||||
@@ -11040,7 +11023,7 @@ s32 objTickPlayer(struct prop *prop)
|
||||
|
||||
if (obj->hidden & OBJHFLAG_ISRETICK) {
|
||||
obj->hidden &= ~OBJHFLAG_ISRETICK;
|
||||
} else if ((obj->hidden & OBJHFLAG_PROJECTILE) && obj->projectile && (obj->projectile->flags & PROJECTILEFLAG_SLIDING) == 0) {
|
||||
} else if ((obj->hidden & OBJHFLAG_PROJECTILE) && (obj->projectile->flags & PROJECTILEFLAG_SLIDING) == 0) {
|
||||
prop->flags &= ~PROPFLAG_ONTHISSCREENTHISTICK;
|
||||
obj->hidden |= OBJHFLAG_ISRETICK;
|
||||
return TICKOP_RETICK;
|
||||
@@ -14252,12 +14235,6 @@ void objBounce(struct defaultobj *obj, struct coord *gundir2d)
|
||||
projectile->speed.z += 3.3333333f * dir.z;
|
||||
projectile->ownerprop = g_Vars.currentplayer->prop;
|
||||
projectile->bouncecount = 1;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode == NETMODE_SERVER) {
|
||||
netmsgSvcPropMoveWrite(&g_NetMsgRel, obj->prop, &rot);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14335,11 +14312,6 @@ void objApplyMomentum(struct defaultobj *obj, struct coord *speed, f32 rotation,
|
||||
projectile->unk0ec = 0.07852732f;
|
||||
projectile->unk0f0 = 6.6666665f;
|
||||
}
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode == NETMODE_SERVER) {
|
||||
netmsgSvcPropMoveWrite(&g_NetMsgRel, obj->prop, NULL);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -14370,12 +14342,6 @@ void objApplyMomentum(struct defaultobj *obj, struct coord *speed, f32 rotation,
|
||||
projectile->unk0ec = 0.07852732f;
|
||||
projectile->unk0f0 = 1.6666666f;
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode == NETMODE_SERVER) {
|
||||
netmsgSvcPropMoveWrite(&g_NetMsgRel, obj->prop, NULL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15415,23 +15381,6 @@ 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)
|
||||
{
|
||||
#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;
|
||||
}
|
||||
} else if (g_NetMode == NETMODE_SERVER) {
|
||||
if (obj->prop && obj->prop->type != PROPTYPE_CHR) {
|
||||
// chr damage is handled by a separate message
|
||||
netmsgSvcPropDamageWrite(&g_NetMsgRel, obj->prop, damage, pos, weaponnum, playernum);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Store the attacker playernum into the object's "hidden" field
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
// ...but not for deployed laptop guns in multiplayer, because those bits
|
||||
@@ -15962,10 +15911,7 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Vars.antiplayernum < 0
|
||||
|| PLAYER_IS_NOT_ANTI(g_Vars.currentplayer)
|
||||
|| (obj->flags2 & OBJFLAG2_IMMUNETOANTI) == 0) {
|
||||
|
||||
if (g_Vars.antiplayernum < 0 || g_Vars.currentplayer != g_Vars.anti || (obj->flags2 & OBJFLAG2_IMMUNETOANTI) == 0) {
|
||||
if (hit->hitthing.texturenum != 10000) {
|
||||
f32 damage = gsetGetDamage(&shotdata->gset);
|
||||
|
||||
@@ -16022,10 +15968,6 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
|
||||
pushdir.y = shotdata->gundir3d.y;
|
||||
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);
|
||||
} else {
|
||||
bool bounce = false;
|
||||
@@ -16048,13 +15990,6 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
|
||||
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) {
|
||||
objBounce(obj, &shotdata->gundir2d);
|
||||
}
|
||||
@@ -16913,7 +16848,7 @@ void ammotypePlayPickupSound(u32 ammotype)
|
||||
case AMMOTYPE_CLOAK:
|
||||
case AMMOTYPE_BOOST:
|
||||
case AMMOTYPE_TOKEN:
|
||||
playerSndStart(var80095200, SFX_PICKUP_AMMO, NULL, g_Vars.currentplayernum, -1, -1, -1);
|
||||
sndStart(var80095200, SFX_PICKUP_AMMO, NULL, -1, -1, -1, -1, -1);
|
||||
break;
|
||||
case AMMOTYPE_REMOTE_MINE:
|
||||
case AMMOTYPE_PROXY_MINE:
|
||||
@@ -16922,10 +16857,10 @@ void ammotypePlayPickupSound(u32 ammotype)
|
||||
case AMMOTYPE_MICROCAMERA:
|
||||
case AMMOTYPE_PLASTIQUE:
|
||||
case AMMOTYPE_ECM_MINE:
|
||||
playerSndStart(var80095200, SFX_PICKUP_MINE, NULL, g_Vars.currentplayernum, -1, -1, -1);
|
||||
sndStart(var80095200, SFX_PICKUP_MINE, NULL, -1, -1, -1, -1, -1);
|
||||
break;
|
||||
case AMMOTYPE_KNIFE:
|
||||
playerSndStart(var80095200, SFX_PICKUP_KNIFE, NULL, g_Vars.currentplayernum, -1, -1, -1);
|
||||
sndStart(var80095200, SFX_PICKUP_KNIFE, NULL, -1, -1, -1, -1, -1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -16990,7 +16925,7 @@ void weaponPlayPickupSound(s32 weaponnum)
|
||||
sound = SFX_PICKUP_GUN;
|
||||
}
|
||||
|
||||
playerSndStart(var80095200, sound, NULL, g_Vars.currentplayernum, -1, -1, -1);
|
||||
sndStart(var80095200, sound, NULL, -1, -1, -1, -1, -1);
|
||||
}
|
||||
|
||||
void ammotypeGetPickupMessage(char *dst, s32 ammotype, s32 qty)
|
||||
@@ -17303,7 +17238,7 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
|
||||
switch (obj->type) {
|
||||
case OBJTYPE_KEY:
|
||||
if (g_Vars.in_cutscene == false) {
|
||||
playerSndStart(var80095200, SFX_PICKUP_KEYCARD, NULL, g_Vars.currentplayernum, -1, -1, -1);
|
||||
sndStart(var80095200, SFX_PICKUP_KEYCARD, NULL, -1, -1, -1, -1, -1);
|
||||
}
|
||||
|
||||
if (showhudmsg) {
|
||||
@@ -17343,7 +17278,7 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
|
||||
}
|
||||
|
||||
if (g_Vars.in_cutscene == false) {
|
||||
playerSndStart(var80095200, SFX_PICKUP_AMMO, NULL, g_Vars.currentplayernum, -1, -1, -1);
|
||||
sndStart(var80095200, SFX_PICKUP_AMMO, NULL, -1, -1, -1, -1, -1);
|
||||
}
|
||||
|
||||
result = TICKOP_FREE;
|
||||
@@ -17363,11 +17298,6 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
|
||||
|
||||
if (sp64) {
|
||||
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;
|
||||
@@ -17378,11 +17308,6 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
|
||||
|
||||
if (sp64) {
|
||||
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;
|
||||
@@ -17496,7 +17421,7 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
|
||||
playerSetShieldFrac(((struct shieldobj *) prop->obj)->amount);
|
||||
|
||||
if (!g_Vars.in_cutscene) {
|
||||
playerSndStart(var80095200, SFX_PICKUP_SHIELD, NULL, g_Vars.currentplayernum, -1, -1, -1);
|
||||
sndStart(var80095200, SFX_PICKUP_SHIELD, NULL, -1, -1, -1, -1, -1);
|
||||
}
|
||||
|
||||
if (showhudmsg) {
|
||||
@@ -17533,7 +17458,7 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
|
||||
case OBJTYPE_TINTEDGLASS:
|
||||
default:
|
||||
if (g_Vars.in_cutscene == false) {
|
||||
playerSndStart(var80095200, SFX_PICKUP_KEYCARD, NULL, g_Vars.currentplayernum, -1, -1, -1);
|
||||
sndStart(var80095200, SFX_PICKUP_KEYCARD, NULL, -1, -1, -1, -1, -1);
|
||||
}
|
||||
|
||||
if (showhudmsg) {
|
||||
@@ -17550,13 +17475,6 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
|
||||
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) {
|
||||
objFree(obj, false, obj->hidden2 & OBJH2FLAG_CANREGEN);
|
||||
return TICKOP_FREE;
|
||||
@@ -17581,13 +17499,6 @@ s32 objTestForPickup(struct prop *prop)
|
||||
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 (obj->flags & OBJFLAG_UNCOLLECTABLE) {
|
||||
return TICKOP_NONE;
|
||||
@@ -19173,13 +19084,6 @@ void doorsCheckAutomatic(void)
|
||||
s16 *propnumptr;
|
||||
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);
|
||||
propnumptr = propnums;
|
||||
|
||||
@@ -19956,11 +19860,6 @@ void doorSetMode(struct doorobj *door, s32 newmode)
|
||||
} else {
|
||||
door->mode = newmode;
|
||||
}
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode == NETMODE_SERVER) {
|
||||
netmsgSvcPropDoorWrite(&g_NetMsgRel, door->base.prop, g_Vars.currentplayer->client);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21071,7 +20970,7 @@ Gfx *countdownTimerRender(Gfx *gdl)
|
||||
u32 stack;
|
||||
s32 viewright = viGetViewLeft() + (viGetViewWidth() >> 1);
|
||||
s32 y = viGetViewTop() + viGetViewHeight() - 18;
|
||||
s32 playercount = LOCALPLAYERCOUNT();
|
||||
s32 playercount = PLAYERCOUNT();
|
||||
char *fmt = ":\n";
|
||||
|
||||
if (playercount == 2) {
|
||||
@@ -21326,13 +21225,6 @@ void weaponCreateForPlayerDrop(s32 weaponnum)
|
||||
struct chrdata *chr;
|
||||
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;
|
||||
prop = weaponCreateForChr(chr, playermgrGetModelOfWeapon(weaponnum), weaponnum, OBJFLAG_WEAPON_AICANNOTUSE, NULL, NULL);
|
||||
|
||||
@@ -21343,13 +21235,6 @@ void weaponCreateForPlayerDrop(s32 weaponnum)
|
||||
if (weaponnum == WEAPON_BRIEFCASE2) {
|
||||
scenarioHandleDroppedToken(chr, prop);
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_NetMode == NETMODE_SERVER) {
|
||||
netmsgSvcPropSpawnWrite(&g_NetMsgRel, prop);
|
||||
netmsgSvcPropMoveWrite(&g_NetMsgRel, prop, NULL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-10
@@ -338,7 +338,7 @@ void psTickChannel(s32 channelnum)
|
||||
|
||||
if (lvIsPaused()
|
||||
|| (mpIsPaused() && (channel->flags2 & PSFLAG2_MPPAUSABLE))
|
||||
|| (mpIsPaused() && LOCALPLAYERCOUNT() == 1)) {
|
||||
|| (mpIsPaused() && PLAYERCOUNT() == 1)) {
|
||||
channel->currentvol = -1;
|
||||
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
|
||||
for (i = 0; i < LOCALPLAYERCOUNT(); i++) {
|
||||
for (i = 0; i < PLAYERCOUNT(); i++) {
|
||||
struct player *player = g_Vars.players[i];
|
||||
s32 camroom;
|
||||
|
||||
@@ -1283,17 +1283,12 @@ s32 psCalculatePan2(struct coord *pos, s32 arg1, f32 arg2, struct pschannel *cha
|
||||
s32 degrees;
|
||||
f32 f2;
|
||||
|
||||
if (LOCALPLAYERCOUNT() < 2) {
|
||||
#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;
|
||||
if (PLAYERCOUNT() < 2) {
|
||||
struct coord *campos = &g_Vars.currentplayer->cam_pos;
|
||||
f32 sp3c;
|
||||
f32 sp38;
|
||||
|
||||
f2 = -(atan2f(pos->x - campos->x, pos->z - campos->z) * 180.0f / M_PI + player->vv_theta);
|
||||
f2 = -(atan2f(pos->x - campos->x, pos->z - campos->z) * 180.0f / M_PI + g_Vars.currentplayer->vv_theta);
|
||||
|
||||
if (arg2 >= 0.0f) {
|
||||
sp3c = sinf(0.017453292f * f2);
|
||||
|
||||
+2
-2
@@ -252,7 +252,7 @@ Gfx *radarRender(Gfx *gdl)
|
||||
|
||||
tconfig = g_TexRadarConfigs;
|
||||
playernum = g_Vars.currentplayernum;
|
||||
playercount = LOCALPLAYERCOUNT();
|
||||
playercount = PLAYERCOUNT();
|
||||
|
||||
if (g_Vars.mplayerisrunning) {
|
||||
if (g_Vars.normmplayerisrunning && (g_MpSetup.options & MPOPTION_NORADAR)) {
|
||||
@@ -341,7 +341,7 @@ Gfx *radarRender(Gfx *gdl)
|
||||
gDPSetSubpixelOffsetEXT(gdl++, 0, 0);
|
||||
if (!(g_MpSetup.options & MPOPTION_NOPLAYERONRADAR)) {
|
||||
#endif
|
||||
for (i = 0; i < PLAYERCOUNT(); i++) {
|
||||
for (i = 0; i < playercount; i++) {
|
||||
if (i != playernum) {
|
||||
if (g_Vars.players[i]->isdead == false
|
||||
&& (g_Vars.players[i]->prop->chr->hidden & CHRHFLAG_CLOAKED) == 0
|
||||
|
||||
@@ -12,17 +12,7 @@ void roomsReset(void)
|
||||
{
|
||||
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;
|
||||
#endif
|
||||
|
||||
g_RoomMtxAges = mempAlloc(ALIGN16(g_RoomMtxNumSlots), 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;
|
||||
}
|
||||
|
||||
if ((g_MpSetup.chrslots & (1 << (slotnum + MAX_PLAYERS)))
|
||||
if ((g_MpSetup.chrslots & (1 << (slotnum + 4)))
|
||||
&& mpIsSimSlotEnabled(slotnum)) {
|
||||
botmgrAllocateBot(chrnum, slotnum);
|
||||
chrnum++;
|
||||
|
||||
+3
-3
@@ -519,7 +519,7 @@ Gfx *sightDrawAimer(Gfx *gdl, s32 x, s32 y, s32 radius, s32 cornergap, u32 colou
|
||||
#endif
|
||||
|
||||
// Draw the lines that span most of the viewport
|
||||
if (LOCALPLAYERCOUNT() == 1) {
|
||||
if (PLAYERCOUNT() == 1) {
|
||||
gDPHudRectangle(gdl++, viewleft + 48, y, x - radius + 2, y);
|
||||
gDPHudRectangle(gdl++, x + radius - 2, y, viewright - 49, y);
|
||||
gDPHudRectangle(gdl++, x, viewtop + 10, x, y - radius + 2);
|
||||
@@ -1323,7 +1323,7 @@ Gfx *sightDrawZoom(Gfx *gdl, bool sighton, f32 crossx, f32 crossy)
|
||||
cornerheight *= frac;
|
||||
}
|
||||
|
||||
if (LOCALPLAYERCOUNT() >= 2) {
|
||||
if (PLAYERCOUNT() >= 2) {
|
||||
cornerheight *= 2;
|
||||
}
|
||||
|
||||
@@ -1625,7 +1625,7 @@ Gfx *sightDraw(Gfx *gdl, bool sighton, s32 sight)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (LOCALPLAYERCOUNT() >= 2 && g_Vars.coopplayernum < 0 && g_Vars.antiplayernum < 0) {
|
||||
if (PLAYERCOUNT() >= 2 && g_Vars.coopplayernum < 0 && g_Vars.antiplayernum < 0) {
|
||||
sight = SIGHT_DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -53,7 +53,7 @@ void zbufAllocate(void)
|
||||
if (IS4MB()) {
|
||||
g_ZbufWidth = MAX(320, FBALLOC_WIDTH_LO);
|
||||
|
||||
if (g_Vars.normmplayerisrunning && LOCALPLAYERCOUNT() >= 2) {
|
||||
if (g_Vars.normmplayerisrunning && PLAYERCOUNT() >= 2) {
|
||||
g_ZbufHeight = MAX(220, FBALLOC_HEIGHT_LO) / 2;
|
||||
} else {
|
||||
g_ZbufHeight = MAX(220, FBALLOC_HEIGHT_LO);
|
||||
@@ -61,7 +61,7 @@ void zbufAllocate(void)
|
||||
} else {
|
||||
g_ZbufWidth = MAX(640, FBALLOC_WIDTH_HI);
|
||||
|
||||
if (g_Vars.normmplayerisrunning && LOCALPLAYERCOUNT() >= 2) {
|
||||
if (g_Vars.normmplayerisrunning && PLAYERCOUNT() >= 2) {
|
||||
g_ZbufHeight = MAX(220, FBALLOC_HEIGHT_HI);
|
||||
} else {
|
||||
g_ZbufHeight = MAX(220, FBALLOC_HEIGHT_HI);
|
||||
@@ -101,7 +101,7 @@ Gfx *zbufConfigureRdp(Gfx *gdl)
|
||||
uintptr_t addr;
|
||||
|
||||
if (g_Vars.normmplayerisrunning
|
||||
&& (g_Vars.currentplayernum >= 2 || (LOCALPLAYERCOUNT() == 2 && g_Vars.currentplayernum == 1))) {
|
||||
&& (g_Vars.currentplayernum >= 2 || (PLAYERCOUNT() == 2 && g_Vars.currentplayernum == 1))) {
|
||||
subamount = playerGetFbWidth() * playerGetFbHeight();
|
||||
|
||||
if (IS4MB() || optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
|
||||
@@ -136,7 +136,7 @@ Gfx *zbufClear(Gfx *gdl)
|
||||
gDPSetFillColor(gdl++, 0xfffcfffc);
|
||||
gDPSetScissorFrac(gdl++, G_SC_NON_INTERLACE, 0, 0, playerGetFbWidth() * 4.0f, playerGetFbHeight() * 4.0f);
|
||||
|
||||
if (LOCALPLAYERCOUNT() <= 2) {
|
||||
if (PLAYERCOUNT() <= 2) {
|
||||
left = 0;
|
||||
right = playerGetFbWidth() - 1;
|
||||
} 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 menu g_Menus[MAX_PLAYERS];
|
||||
extern struct menudata g_MenuData;
|
||||
extern struct activemenu g_AmMenus[MAX_LOCAL_PLAYERS];
|
||||
extern struct activemenu g_AmMenus[MAX_PLAYERS];
|
||||
extern s32 g_AmIndex;
|
||||
extern u32 g_CheatsActiveBank0;
|
||||
extern u32 g_CheatsActiveBank1;
|
||||
@@ -196,7 +196,7 @@ extern struct covercandidate *g_CoverCandidates;
|
||||
extern u16 g_NumSpecialCovers;
|
||||
extern u16 *g_SpecialCoverNums;
|
||||
extern struct pak g_Paks[5];
|
||||
extern OSPfs g_Pfses[MAX_LOCAL_PLAYERS];
|
||||
extern OSPfs g_Pfses[MAX_PLAYERS];
|
||||
extern u32 g_SkyStageNum;
|
||||
extern bool g_SkyLightningActive;
|
||||
extern struct explosion *g_Explosions;
|
||||
@@ -285,7 +285,7 @@ extern struct chrdata *g_MpAllChrPtrs[MAX_MPCHRS];
|
||||
extern struct mpchrconfig *g_MpAllChrConfigPtrs[MAX_MPCHRS];
|
||||
extern s32 g_MpNumChrs;
|
||||
extern struct mpbotconfig g_BotConfigsArray[MAX_BOTS];
|
||||
extern u8 g_MpSimulantDifficultiesPerNumPlayers[MAX_BOTS][MAX_LOCAL_PLAYERS];
|
||||
extern u8 g_MpSimulantDifficultiesPerNumPlayers[MAX_BOTS][MAX_PLAYERS];
|
||||
extern struct mpplayerconfig g_PlayerConfigsArray[MAX_MPPLAYERCONFIGS];
|
||||
extern u8 g_AmBotCommands[9];
|
||||
extern struct mpsetup g_MpSetup;
|
||||
|
||||
+4
-35
@@ -20,21 +20,14 @@
|
||||
#define MAX_CHRWAYPOINTS 6
|
||||
#define MAX_EXPLOSIONS 6
|
||||
#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_MPPLAYERCONFIGS (MAX_PLAYERS + MAX_COOPCHRS)
|
||||
#define MAX_MPPLAYERCONFIGS (MAX_PLAYERS + 2)
|
||||
#define MAX_OBJECTIVES 10
|
||||
#define MAX_LOCAL_PLAYERS 4
|
||||
#define MAX_PLAYERS 8
|
||||
#define MAX_PLAYERS 4
|
||||
#define MAX_PROPSPERROOMCHUNK 7
|
||||
#define MAX_ROOMPROPLISTCHUNKS 256
|
||||
#define MAX_SQUADRONS 16
|
||||
#define MAX_TEAMS 8
|
||||
#define MAX_PLAYERNAME 15
|
||||
|
||||
#define NUM_BOTDIFFS 6
|
||||
#define NUM_CYCLEABLE_WEAPONS 45
|
||||
@@ -75,9 +68,7 @@
|
||||
#define SECSTOTIME60(secs) (secs * 60)
|
||||
#define PFS(device) (device == SAVEDEVICE_GAMEPAK ? NULL : &g_Pfses[device])
|
||||
|
||||
#if MAX_PLAYERS > 4
|
||||
#define PLAYERCOUNT() playerGetCount()
|
||||
#elif MAX_PLAYERS == 4
|
||||
#if 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))
|
||||
#elif MAX_PLAYERS >= 3
|
||||
#define PLAYERCOUNT() ((g_Vars.players[0] ? 1 : 0) + (g_Vars.players[1] ? 1 : 0) + (g_Vars.players[2] ? 1 : 0))
|
||||
@@ -87,20 +78,6 @@
|
||||
#define PLAYERCOUNT() 1
|
||||
#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 FUNCISSEC() (VALIDWEAPON() && (g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].gunfuncs[(g_Vars.currentplayer->gunctrl.weaponnum - 1) >> 3] & (1 << ((g_Vars.currentplayer->gunctrl.weaponnum - 1) & 7))))
|
||||
|
||||
@@ -720,7 +697,6 @@
|
||||
#define CONTROLMODE_23 6
|
||||
#define CONTROLMODE_24 7
|
||||
#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_NOCONTROL 0x10
|
||||
@@ -3221,6 +3197,7 @@
|
||||
#define OBJHFLAG_BLOCKEDPATH 0x02000000
|
||||
#define OBJHFLAG_MOUNTED 0x04000000 // for hoverbike
|
||||
#define OBJHFLAG_GRABBED 0x08000000
|
||||
#define OBJHFLAG_FALLOUT 0x10000000
|
||||
|
||||
// obj->hidden2
|
||||
#define OBJH2FLAG_HASOPA 0x01 // obj has opaque polygons (ie. most objects)
|
||||
@@ -4740,8 +4717,6 @@ enum weaponnum {
|
||||
#define BUTTON_UI_ACCEPT BUTTON_ACCEPT_WPNFORWARD
|
||||
#define BUTTON_UI_CANCEL BUTTON_CANCEL_USE
|
||||
|
||||
#define LOCALPLAYERCOUNT() PLAYERCOUNT()
|
||||
|
||||
#else
|
||||
|
||||
// xbla behavior
|
||||
@@ -4786,12 +4761,6 @@ enum weaponnum {
|
||||
#define MPSETUP_MAXNAME 17
|
||||
#define MPSETUP_BLOCKSIZE 80
|
||||
|
||||
#define NETMODE_NONE 0
|
||||
#define NETMODE_SERVER 1
|
||||
#define NETMODE_CLIENT 2
|
||||
|
||||
#define LOCALPLAYERCOUNT() playerGetLocalCount()
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+4
-12
@@ -15,7 +15,6 @@
|
||||
#define bool s32
|
||||
#define ubool u32
|
||||
|
||||
extern s32 g_StageNum;
|
||||
extern u8 *g_StackLeftAddrs[NUM_THREADS];
|
||||
extern u8 *g_StackRightAddrs[NUM_THREADS];
|
||||
extern u8 *g_StackAllocatedPos;
|
||||
@@ -304,7 +303,7 @@ extern struct menudialogdef g_MpConfirmChallenge4MbMenuDialog;
|
||||
extern struct menudialogdef g_MainMenu4MbMenuDialog;
|
||||
extern struct menudialogdef g_MpEditSimulant4MbMenuDialog;
|
||||
extern struct menudialogdef g_AdvancedSetup4MbMenuDialog;
|
||||
extern struct filelist *g_FileLists[MAX_LOCAL_PLAYERS];
|
||||
extern struct filelist *g_FileLists[MAX_PLAYERS];
|
||||
extern bool var80075bd0[];
|
||||
extern struct headanim g_HeadAnims[2];
|
||||
extern s32 var80075d60;
|
||||
@@ -513,8 +512,6 @@ extern u8 g_ChrBioSlot;
|
||||
extern u8 g_HangarBioSlot;
|
||||
extern u8 g_DtSlot;
|
||||
extern u8 var80088bb4;
|
||||
extern u64 g_RngSeed;
|
||||
extern u64 g_Rng2Seed;
|
||||
extern struct vtxstoretype g_VtxstoreTypes[4];
|
||||
extern struct menudialogdef g_FrWeaponListMenuDialog;
|
||||
extern struct menudialogdef g_FrTrainingInfoInGameMenuDialog;
|
||||
@@ -534,7 +531,7 @@ extern struct menudialogdef g_HangarListMenuDialog;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
|
||||
extern struct extplayerconfig g_PlayerExtCfg[MAX_LOCAL_PLAYERS];
|
||||
extern struct extplayerconfig g_PlayerExtCfg[MAX_PLAYERS];
|
||||
|
||||
extern struct weathercfg g_WeatherConfig[WEATHERCFG_MAX_STAGES];
|
||||
extern const struct weathercfg g_DefaultWeatherConfig;
|
||||
@@ -568,16 +565,11 @@ extern s32 g_MpWeaponRandomFilterNum;
|
||||
extern struct mpsetupfile g_MpSetupFile;
|
||||
extern s16 g_MpCurrentSetup;
|
||||
|
||||
extern s32 g_NetMode;
|
||||
|
||||
#define PLAYER_EXTCFG() g_PlayerExtCfg[g_Vars.currentplayerstats->mpindex & 3]
|
||||
#define PLAYER_DEFAULT_FOV playerGetDefaultFovY(g_Vars.currentplayerstats->mpindex)
|
||||
#define ADJUST_ZOOM_FOV(x) ((x) * playerGetZoomFovMult(g_Vars.currentplayerstats->mpindex))
|
||||
#define PLAYER_DEFAULT_FOV (PLAYER_EXTCFG().fovy)
|
||||
|
||||
#define TEX_FILTER_2D g_TexFilter2D
|
||||
|
||||
s32 playerGetCount(void);
|
||||
s32 playerGetLocalCount(void);
|
||||
#define ADJUST_ZOOM_FOV(x) ((x) * PLAYER_EXTCFG().fovzoommult)
|
||||
|
||||
#else // PLATFORM_N64
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ void bgLoadFile(void *memaddr, u32 offset, u32 len);
|
||||
s32 bgGetStageIndex(s32 stagenum);
|
||||
f32 bgCalculatePortalSurfaceArea(s32 portal);
|
||||
u8 bgCalculatePortalAlpha(s32 portal);
|
||||
u32 not(u32 arg);
|
||||
u32 bgNot(u32 arg);
|
||||
u32 bgXorBabebabe(u32 value);
|
||||
void bgReset(s32 stagenum);
|
||||
void bgBuildTables(s32 stagenum);
|
||||
|
||||
@@ -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 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 *bgunCreateThrownProjectile(s32 handnum, struct gset *gset);
|
||||
void bgunCreateThrownProjectile(s32 handnum, struct gset *gset);
|
||||
void bgunUpdateHeldRocket(s32 handnum);
|
||||
void bgunCreateHeldRocket(s32 handnum, struct weaponfunc_shootprojectile *func);
|
||||
void bgunFreeHeldRocket(s32 handnum);
|
||||
|
||||
@@ -203,7 +203,6 @@ 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);
|
||||
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 chrCheckCoverOutOfSight(struct chrdata *chr, s32 covernum, bool soft);
|
||||
s32 chrAssignCoverByCriteria(struct chrdata *chr, u16 arg1, s32 arg2);
|
||||
|
||||
@@ -113,10 +113,6 @@ MenuItemHandlerResult menuhandlerRepairPak(s32 operation, struct menuitem *item,
|
||||
MenuItemHandlerResult menuhandlerRetrySavePak(s32 operation, struct menuitem *item, union handlerdata *data);
|
||||
MenuItemHandlerResult menuhandlerWarnRepairPak(s32 operation, struct menuitem *item, union handlerdata *data);
|
||||
|
||||
s32 menuAlt1Pressed(s32 playerNum);
|
||||
s32 menuAlt2Pressed(s32 playerNum);
|
||||
s32 menuAltAnyPressed(s32 playerNum);
|
||||
|
||||
extern const char var7f1b2658[];
|
||||
extern const char var7f1b265c[];
|
||||
extern const char var7f1b2660[];
|
||||
|
||||
@@ -107,16 +107,5 @@ void playerSetCamPropertiesWithRoom(struct coord *pos, struct coord *up, struct
|
||||
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 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
|
||||
+6
-21
@@ -230,7 +230,7 @@ struct g_vars {
|
||||
/*0x488*/ s32 totalkills;
|
||||
/*0x48c*/ bool useperimshoot;
|
||||
/*0x490*/ s32 mpsetupmenu;
|
||||
/*0x494*/ s8 waitingtojoin[MAX_LOCAL_PLAYERS];
|
||||
/*0x494*/ s8 waitingtojoin[MAX_PLAYERS];
|
||||
/*0x498*/ s32 unk000498;
|
||||
/*0x49c*/ bool usingadvsetup;
|
||||
/*0x4a0*/ s32 unk0004a0;
|
||||
@@ -251,7 +251,7 @@ struct g_vars {
|
||||
/*0x4d6*/ s8 autocutfinished; // true if cutscene reached natural end
|
||||
/*0x4d7*/ s8 autocutgroupskip; // true if pressed start during auto cutscene
|
||||
/*0x4d8*/ s32 joydisableframestogo;
|
||||
/*0x4dc*/ u8 playertojoymap[MAX_LOCAL_PLAYERS];
|
||||
/*0x4dc*/ u8 playertojoymap[MAX_PLAYERS];
|
||||
/*0x4e0*/ u8 fourmeg2player;
|
||||
/*0x4e1*/ u8 remakewallhitvtx;
|
||||
/*0x4e2*/ u8 cutsceneskip60ths;
|
||||
@@ -324,9 +324,6 @@ struct prop {
|
||||
/*0x3f*/ u8 active : 1;
|
||||
/*0x40*/ struct wallhit *opawallhits; // opaque
|
||||
/*0x44*/ struct wallhit *xluwallhits; // translucent
|
||||
#ifndef PLATFORM_N64
|
||||
/*0x48*/ u32 syncid;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct packedpad {
|
||||
@@ -2823,9 +2820,6 @@ struct player {
|
||||
/*0x1c72*/ s16 amdowntime; // for alt-modes, used like invdowntime and amdowntime
|
||||
#ifndef PLATFORM_N64
|
||||
/*0x1c74*/ f32 swivelpos[2];
|
||||
/*0x1c84*/ u32 ucmd;
|
||||
/*0x1c88*/ bool isremote;
|
||||
/*0x1c8c*/ struct netclient *client;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -4014,7 +4008,7 @@ struct gamefile {
|
||||
};
|
||||
|
||||
struct mpchrconfig {
|
||||
/*0x00*/ char name[MAX_PLAYERNAME];
|
||||
/*0x00*/ char name[15];
|
||||
/*0x0f*/ u8 mpheadnum;
|
||||
/*0x10*/ u8 mpbodynum;
|
||||
/*0x11*/ u8 team;
|
||||
@@ -4058,9 +4052,6 @@ struct mpplayerconfig {
|
||||
/*0x96*/ u8 newtitle;
|
||||
/*0x97*/ u8 gunfuncs[6];
|
||||
/*0x9d*/ u8 handicap;
|
||||
#ifndef PLATFORM_N64
|
||||
/*0x9e*/ struct netclient *client;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct mpbotconfig {
|
||||
@@ -4102,15 +4093,9 @@ struct mpsetup {
|
||||
/**
|
||||
* Each bit signifies that a player or sim is participating.
|
||||
*
|
||||
* In the original game:
|
||||
* Bits 0x000f are for players
|
||||
* Bits 0x0ff0 are for sims
|
||||
* 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;
|
||||
/*0x800acba0*/ u8 weapons[NUM_MPWEAPONSLOTS];
|
||||
@@ -4174,7 +4159,7 @@ struct challenge {
|
||||
// Same structure as availability, however each byte determines how many
|
||||
// players it was completed with. So completions[0] is for completions with
|
||||
// a single player and completions[3] is for completions with 4 players.
|
||||
/*0x05*/ u8 completions[MAX_LOCAL_PLAYERS];
|
||||
/*0x05*/ u8 completions[MAX_PLAYERS];
|
||||
|
||||
// Array of features which will become unlocked once the challenge is
|
||||
// available. The array is automatically populated at runtime based on what
|
||||
@@ -4806,7 +4791,7 @@ struct menudata {
|
||||
/*0x014*/ u8 bg;
|
||||
/*0x015*/ u8 nextbg;
|
||||
/*0x016*/ u8 screenshottimer;
|
||||
/*0x017*/ u8 playerjoinalpha[MAX_LOCAL_PLAYERS];
|
||||
/*0x017*/ u8 playerjoinalpha[MAX_PLAYERS];
|
||||
/*0x01b*/ s8 bannernum;
|
||||
/*0x01c*/ struct menumodel hudpiece;
|
||||
/*0x5d4*/ u8 unk5d4;
|
||||
@@ -5026,7 +5011,7 @@ struct mpconfigsim {
|
||||
u8 mpheadnum;
|
||||
u8 mpbodynum;
|
||||
u8 team;
|
||||
u8 difficulties[MAX_LOCAL_PLAYERS];
|
||||
u8 difficulties[MAX_PLAYERS];
|
||||
};
|
||||
|
||||
struct mpconfig {
|
||||
|
||||
@@ -294,7 +294,6 @@ u32 mempGetPoolFree(u8 poolnum, u32 bank)
|
||||
return pool->rightpos - pool->leftpos;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
u32 mempGetPoolSize(u8 poolnum, u32 bank)
|
||||
{
|
||||
struct memorypool *pool;
|
||||
@@ -307,7 +306,6 @@ u32 mempGetPoolSize(u8 poolnum, u32 bank)
|
||||
|
||||
return pool->rightpos - pool->start;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
void *mempAllocFromPackedWord(u32 word)
|
||||
|
||||
Loaded 100 of 102 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user