Compare commits
47
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cf3165be0 | ||
|
|
309d459a70 | ||
|
|
b59cf405f9 | ||
|
|
e1430f7bc7 | ||
|
|
bf70beb88a | ||
|
|
a951622f6a | ||
|
|
d7db0d68dc | ||
|
|
2b9224cc3f | ||
|
|
0a750cd3bc | ||
|
|
0e8a32612f | ||
|
|
3c6882203b | ||
|
|
0464a8b0c7 | ||
|
|
599eda96aa | ||
|
|
421d735052 | ||
|
|
73bc64f9da | ||
|
|
5d807d65e5 | ||
|
|
88d86a6e60 | ||
|
|
b2cdbaae60 | ||
|
|
9160431556 | ||
|
|
2f9a400cf3 | ||
|
|
c39073dd9e | ||
|
|
f03692b840 | ||
|
|
617e8fdd55 | ||
|
|
d5252bd3b3 | ||
|
|
94f46c3ce6 | ||
|
|
c3e709231d | ||
|
|
7878e01e3f | ||
|
|
4631844c9f | ||
|
|
0c440d240c | ||
|
|
5c7be85977 | ||
|
|
c401926c0b | ||
|
|
e0e8be8d46 | ||
|
|
957d3f7229 | ||
|
|
7e47b9b6ba | ||
|
|
6e91e00289 | ||
|
|
a539f38e72 | ||
|
|
4f21d8f983 | ||
|
|
38a248193e | ||
|
|
934f2d347c | ||
|
|
02c928b198 | ||
|
|
7cc8939ec5 | ||
|
|
b0c28a5299 | ||
|
|
4002000cd8 | ||
|
|
8433d04a12 | ||
|
|
04aa365858 | ||
|
|
a1f141bef9 | ||
|
|
fdf26f6d5e |
No files matched your search
@@ -0,0 +1,62 @@
|
|||||||
|
name: macOS
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "mac-ci-test"]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "mac-ci-test"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
continue-on-error: true
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
arch:
|
||||||
|
- runner: macos-latest
|
||||||
|
name: aarch64
|
||||||
|
- runner: macos-15-intel
|
||||||
|
name: x86_64
|
||||||
|
|
||||||
|
name: ${{ matrix.arch.name }}
|
||||||
|
runs-on: ${{ matrix.arch.runner }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6.0.1
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: brew install --formula sdl2 sdl2_mixer game-music-emu libopenmpt
|
||||||
|
|
||||||
|
- name: Download Kart assets
|
||||||
|
run: |
|
||||||
|
curl -L \
|
||||||
|
-o AssetsLinuxOnly.zip \
|
||||||
|
"https://github.com/STJr/Kart-Public/releases/download/v1.6/AssetsLinuxOnly.zip"
|
||||||
|
|
||||||
|
- name: Extract Kart assets
|
||||||
|
run: |
|
||||||
|
mkdir -p assets/installer
|
||||||
|
unzip -q AssetsLinuxOnly.zip -d assets/installer
|
||||||
|
|
||||||
|
- name: Configure CMake
|
||||||
|
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
|
||||||
|
|
||||||
|
- name: Build SRB2Kart-Saturn
|
||||||
|
run: ninja -C build
|
||||||
|
|
||||||
|
#idk what im doing here tbh i pray this works
|
||||||
|
- name: Package DMG
|
||||||
|
run: |
|
||||||
|
cd build
|
||||||
|
cpack -G DragNDrop
|
||||||
|
|
||||||
|
#- name: Upload build artifact
|
||||||
|
# uses: actions/upload-artifact@v6.0.0
|
||||||
|
# with:
|
||||||
|
# name: srb2kartsaturn-macOS-${{ matrix.arch.name }}-${{ github.sha }}
|
||||||
|
# path: build/bin
|
||||||
|
|
||||||
|
- name: Upload DMG
|
||||||
|
uses: actions/upload-artifact@v6.0.0
|
||||||
|
with:
|
||||||
|
name: srb2kartsaturn-macOS-${{ matrix.arch.name }}-${{ github.sha }}
|
||||||
|
path: build/*.dmg
|
||||||
+1
-1
@@ -29,7 +29,7 @@ if("${SRB2_CPACK_GENERATOR}" STREQUAL "")
|
|||||||
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||||
set(SRB2_CPACK_GENERATOR "TGZ")
|
set(SRB2_CPACK_GENERATOR "TGZ")
|
||||||
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
||||||
set(SRB2_CPACK_GENERATOR "TGZ")
|
set(SRB2_CPACK_GENERATOR "DragNDrop")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -247,6 +247,9 @@ set(SRB2_CONFIG_ASAN OFF CACHE BOOL
|
|||||||
set(SRB2_CONFIG_UBSAN OFF CACHE BOOL
|
set(SRB2_CONFIG_UBSAN OFF CACHE BOOL
|
||||||
"Compile with UndefinedBehaviorSanitizer (libubsan).")
|
"Compile with UndefinedBehaviorSanitizer (libubsan).")
|
||||||
|
|
||||||
|
set(SRB2_CONFIG_MUMBLE ON CACHE BOOL
|
||||||
|
"Enable Mumble support")
|
||||||
|
|
||||||
set(SRB2_CONFIG_SATURNPAK ON CACHE BOOL
|
set(SRB2_CONFIG_SATURNPAK ON CACHE BOOL
|
||||||
"Enable Saturn specific special packet. Required for using the newer resynch system")
|
"Enable Saturn specific special packet. Required for using the newer resynch system")
|
||||||
set(SRB2_CONFIG_SATURNJOIN ON CACHE BOOL
|
set(SRB2_CONFIG_SATURNJOIN ON CACHE BOOL
|
||||||
@@ -275,6 +278,7 @@ if(${SRB2_CONFIG_HAVE_BLUA})
|
|||||||
lua_hooklib.c
|
lua_hooklib.c
|
||||||
lua_hudlib.c
|
lua_hudlib.c
|
||||||
lua_hudlib_drawlist.c
|
lua_hudlib_drawlist.c
|
||||||
|
lua_profile.cpp
|
||||||
lua_infolib.c
|
lua_infolib.c
|
||||||
lua_maplib.c
|
lua_maplib.c
|
||||||
lua_mathlib.c
|
lua_mathlib.c
|
||||||
@@ -290,6 +294,7 @@ if(${SRB2_CONFIG_HAVE_BLUA})
|
|||||||
lua_hook.h
|
lua_hook.h
|
||||||
lua_hud.h
|
lua_hud.h
|
||||||
lua_hudlib_drawlist.h
|
lua_hudlib_drawlist.h
|
||||||
|
lua_profile.h
|
||||||
lua_libs.h
|
lua_libs.h
|
||||||
lua_script.h
|
lua_script.h
|
||||||
lua_udatalib.h
|
lua_udatalib.h
|
||||||
|
|||||||
@@ -246,10 +246,6 @@ ifdef STATIC
|
|||||||
libs+=-static
|
libs+=-static
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter $(CC) $(CXX),gcc g++))
|
|
||||||
opts+=-mno-ms-bitfields
|
|
||||||
endif
|
|
||||||
|
|
||||||
# build with profiling information
|
# build with profiling information
|
||||||
ifdef PROFILEMODE
|
ifdef PROFILEMODE
|
||||||
opts+=-pg
|
opts+=-pg
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ ifdef VALGRIND
|
|||||||
VALGRIND_PKGCONFIG?=valgrind
|
VALGRIND_PKGCONFIG?=valgrind
|
||||||
VALGRIND_LDFLAGS=
|
VALGRIND_LDFLAGS=
|
||||||
$(eval $(call Use_pkg_config,VALGRIND))
|
$(eval $(call Use_pkg_config,VALGRIND))
|
||||||
ZDEBUG=1
|
#ZDEBUG=1 we enable this by default
|
||||||
opts+=-DHAVE_VALGRIND
|
opts+=-DHAVE_VALGRIND
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -99,3 +99,4 @@ lua_skinlib.c
|
|||||||
lua_thinkerlib.c
|
lua_thinkerlib.c
|
||||||
lua_udatalib.c
|
lua_udatalib.c
|
||||||
lua_glib.c
|
lua_glib.c
|
||||||
|
lua_profile.cpp
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
// BLANKART
|
// DR. ROBOTNIK'S RING RACERS
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
|
// Copyright (C) 2025 by Ronald "Eidolon" Kinard
|
||||||
// Copyright (C) 2024 by Kart Krew
|
// Copyright (C) 2025 by Kart Krew
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
// SONIC ROBO BLAST 2 KART
|
// DR. ROBOTNIK'S RING RACERS
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
|
// Copyright (C) 2025 by Ronald "Eidolon" Kinard
|
||||||
// Copyright (C) 2024 by Kart Krew
|
// Copyright (C) 2025 by Kart Krew
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// SONIC ROBO BLAST 2 KART
|
// DR. ROBOTNIK'S RING RACERS
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
|
// Copyright (C) 2025 by Ronald "Eidolon" Kinard
|
||||||
// Copyright (C) 2024 by Kart Krew
|
// Copyright (C) 2025 by Kart Krew
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// BLANKART
|
// DR. ROBOTNIK'S RING RACERS
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
|
// Copyright (C) 2025 by Ronald "Eidolon" Kinard
|
||||||
// Copyright (C) 2024 by Kart Krew
|
// Copyright (C) 2025 by Kart Krew
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// SONIC ROBO BLAST 2 KART
|
// DR. ROBOTNIK'S RING RACERS
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
|
// Copyright (C) 2025 by Ronald "Eidolon" Kinard
|
||||||
// Copyright (C) 2024 by Kart Krew
|
// Copyright (C) 2025 by Kart Krew
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|||||||
+44
-38
@@ -1629,8 +1629,8 @@ static boolean CL_SendJoin(void)
|
|||||||
netbuffer->u.clientcfg.packetversion = PACKETVERSION;
|
netbuffer->u.clientcfg.packetversion = PACKETVERSION;
|
||||||
netbuffer->u.clientcfg.version = VERSION;
|
netbuffer->u.clientcfg.version = VERSION;
|
||||||
netbuffer->u.clientcfg.subversion = SUBVERSION;
|
netbuffer->u.clientcfg.subversion = SUBVERSION;
|
||||||
strncpy(netbuffer->u.clientcfg.application, SRB2APPLICATION,
|
strncpy(netbuffer->u.clientcfg.application, SRB2APPLICATION, sizeof(netbuffer->u.clientcfg.application)-1);
|
||||||
sizeof(netbuffer->u.clientcfg.application));
|
netbuffer->u.clientcfg.application[sizeof(netbuffer->u.clientcfg.application)-1] = '\0';
|
||||||
#ifdef SATURNJOIN
|
#ifdef SATURNJOIN
|
||||||
netbuffer->u.clientcfg.issaturn = ISSATURN;
|
netbuffer->u.clientcfg.issaturn = ISSATURN;
|
||||||
#endif
|
#endif
|
||||||
@@ -1655,88 +1655,91 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
|||||||
|
|
||||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||||
|
|
||||||
|
serverinfo_pak *serverinfo = &netbuffer->u.serverinfo;
|
||||||
|
|
||||||
netbuffer->packettype = PT_SERVERINFO;
|
netbuffer->packettype = PT_SERVERINFO;
|
||||||
netbuffer->u.serverinfo._255 = 255;
|
serverinfo->_255 = 255;
|
||||||
netbuffer->u.serverinfo.packetversion = PACKETVERSION;
|
serverinfo->packetversion = PACKETVERSION;
|
||||||
netbuffer->u.serverinfo.version = VERSION;
|
serverinfo->version = VERSION;
|
||||||
netbuffer->u.serverinfo.subversion = SUBVERSION;
|
serverinfo->subversion = SUBVERSION;
|
||||||
strncpy(netbuffer->u.serverinfo.application, SRB2APPLICATION,
|
strncpy(serverinfo->application, SRB2APPLICATION, sizeof(serverinfo->application)-1);
|
||||||
sizeof netbuffer->u.serverinfo.application);
|
serverinfo->application[sizeof(serverinfo->application)-1] = '\0';
|
||||||
// return back the time value so client can compute their ping
|
// return back the time value so client can compute their ping
|
||||||
netbuffer->u.serverinfo.time = (tic_t)LONG(servertime);
|
serverinfo->time = (tic_t)LONG(servertime);
|
||||||
netbuffer->u.serverinfo.leveltime = (tic_t)LONG(leveltime);
|
serverinfo->leveltime = (tic_t)LONG(leveltime);
|
||||||
|
|
||||||
// force 1 player
|
// force 1 player
|
||||||
if (UseFakeSeed())
|
if (UseFakeSeed())
|
||||||
netbuffer->u.serverinfo.numberofplayer = (UINT8)1;
|
serverinfo->numberofplayer = (UINT8)1;
|
||||||
else
|
else
|
||||||
netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumPlayers();
|
serverinfo->numberofplayer = (UINT8)D_NumPlayers();
|
||||||
|
|
||||||
netbuffer->u.serverinfo.maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value));
|
serverinfo->maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value));
|
||||||
|
|
||||||
// SRB2Kart: Vanilla's gametype constants for MS support
|
// SRB2Kart: Vanilla's gametype constants for MS support
|
||||||
netbuffer->u.serverinfo.gametype = (UINT8)((gt == GT_MATCH) ? VANILLA_GT_MATCH : VANILLA_GT_RACE);
|
serverinfo->gametype = (UINT8)((gt == GT_MATCH) ? VANILLA_GT_MATCH : VANILLA_GT_RACE);
|
||||||
|
|
||||||
netbuffer->u.serverinfo.modifiedgame = (UINT8)modifiedgame;
|
serverinfo->modifiedgame = (UINT8)modifiedgame;
|
||||||
netbuffer->u.serverinfo.cheatsenabled = CV_CheatsEnabled();
|
serverinfo->cheatsenabled = CV_CheatsEnabled();
|
||||||
|
|
||||||
netbuffer->u.serverinfo.kartvars = (UINT8) (
|
serverinfo->kartvars = (UINT8) (
|
||||||
(cv_kartspeed.value & SV_SPEEDMASK) |
|
(cv_kartspeed.value & SV_SPEEDMASK) |
|
||||||
(dedicated ? SV_DEDICATED : 0)
|
(dedicated ? SV_DEDICATED : 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
CopyCaretColors(netbuffer->u.serverinfo.servername, cv_servername.string,
|
CopyCaretColors(serverinfo->servername, cv_servername.string, MAXSERVERNAME);
|
||||||
MAXSERVERNAME);
|
|
||||||
strncpy(netbuffer->u.serverinfo.mapname, G_BuildMapName(gamemap), sizeof(netbuffer->u.serverinfo.mapname)-1);
|
|
||||||
|
|
||||||
memcpy(netbuffer->u.serverinfo.mapmd5, mapmd5, sizeof(netbuffer->u.serverinfo.mapmd5));
|
strncpy(serverinfo->mapname, G_BuildMapName(gamemap), sizeof(serverinfo->mapname)-1);
|
||||||
|
serverinfo->mapname[sizeof(serverinfo->mapname)-1] = '\0';
|
||||||
|
|
||||||
netbuffer->u.serverinfo.iszone = 0;
|
memcpy(serverinfo->mapmd5, mapmd5, sizeof(serverinfo->mapmd5));
|
||||||
|
|
||||||
memset(netbuffer->u.serverinfo.maptitle, 0, sizeof(netbuffer->u.serverinfo.maptitle));
|
serverinfo->iszone = 0;
|
||||||
memset(netbuffer->u.serverinfo.httpsource, 0, MAX_MIRROR_LENGTH);
|
|
||||||
|
memset(serverinfo->maptitle, 0, sizeof(serverinfo->maptitle));
|
||||||
|
memset(serverinfo->httpsource, 0, MAX_MIRROR_LENGTH);
|
||||||
|
|
||||||
if (!(mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU) && mapheaderinfo[gamemap-1]->lvlttl[0])
|
if (!(mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU) && mapheaderinfo[gamemap-1]->lvlttl[0])
|
||||||
{
|
{
|
||||||
strncpy(netbuffer->u.serverinfo.maptitle, mapheaderinfo[gamemap-1]->lvlttl, sizeof(netbuffer->u.serverinfo.maptitle)-1);
|
strncpy(serverinfo->maptitle, mapheaderinfo[gamemap-1]->lvlttl, sizeof(serverinfo->maptitle)-1);
|
||||||
|
|
||||||
if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE))
|
if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE))
|
||||||
{
|
{
|
||||||
if (mapheaderinfo[gamemap-1]->zonttl[0])
|
if (mapheaderinfo[gamemap-1]->zonttl[0])
|
||||||
{
|
{
|
||||||
strncat(netbuffer->u.serverinfo.maptitle, " ", sizeof(netbuffer->u.serverinfo.maptitle)-1);
|
strncat(serverinfo->maptitle, " ", sizeof(serverinfo->maptitle)-1);
|
||||||
strncat(netbuffer->u.serverinfo.maptitle, mapheaderinfo[gamemap-1]->zonttl,
|
strncat(serverinfo->maptitle, mapheaderinfo[gamemap-1]->zonttl, sizeof(serverinfo->maptitle)-1);
|
||||||
sizeof(netbuffer->u.serverinfo.maptitle)-1);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
netbuffer->u.serverinfo.iszone = 1; // ms and clients will append this themselves
|
serverinfo->iszone = 1; // ms and clients will append this themselves
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapheaderinfo[gamemap-1]->actnum[0])
|
if (mapheaderinfo[gamemap-1]->actnum[0])
|
||||||
{
|
{
|
||||||
strncat(netbuffer->u.serverinfo.maptitle, " ", sizeof(netbuffer->u.serverinfo.maptitle)-1);
|
strncat(serverinfo->maptitle, " ", sizeof(serverinfo->maptitle)-1);
|
||||||
strncat(netbuffer->u.serverinfo.maptitle, mapheaderinfo[gamemap-1]->actnum,
|
strncat(serverinfo->maptitle, mapheaderinfo[gamemap-1]->actnum, sizeof(serverinfo->maptitle)-1);
|
||||||
sizeof(netbuffer->u.serverinfo.maptitle)-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
strncpy(netbuffer->u.serverinfo.maptitle, "Unknown", 33);
|
{
|
||||||
|
strncpy(serverinfo->maptitle, "Unknown", sizeof(serverinfo->maptitle)-1);
|
||||||
|
}
|
||||||
|
|
||||||
netbuffer->u.serverinfo.maptitle[32] = '\0';
|
serverinfo->maptitle[sizeof(serverinfo->maptitle)-1] = '\0';
|
||||||
|
|
||||||
netbuffer->u.serverinfo.actnum = 0; //mapheaderinfo[gamemap-1]->actnum
|
serverinfo->actnum = 0; //mapheaderinfo[gamemap-1]->actnum
|
||||||
|
|
||||||
mirror_length = strlen(httpurl);
|
mirror_length = strlen(httpurl);
|
||||||
if (mirror_length > MAX_MIRROR_LENGTH)
|
if (mirror_length > MAX_MIRROR_LENGTH)
|
||||||
mirror_length = MAX_MIRROR_LENGTH;
|
mirror_length = MAX_MIRROR_LENGTH;
|
||||||
|
|
||||||
if (snprintf(netbuffer->u.serverinfo.httpsource, mirror_length+1, "%s", httpurl) < 0)
|
if (snprintf(serverinfo->httpsource, mirror_length+1, "%s", httpurl) < 0)
|
||||||
// If there's an encoding error, send nothing, we accept that the above may be truncated
|
// If there's an encoding error, send nothing, we accept that the above may be truncated
|
||||||
strncpy(netbuffer->u.serverinfo.httpsource, "", mirror_length);
|
strncpy(serverinfo->httpsource, "", mirror_length);
|
||||||
|
|
||||||
netbuffer->u.serverinfo.httpsource[MAX_MIRROR_LENGTH-1] = '\0';
|
serverinfo->httpsource[MAX_MIRROR_LENGTH-1] = '\0';
|
||||||
|
|
||||||
p = PutFileNeeded(0);
|
p = PutFileNeeded(0);
|
||||||
|
|
||||||
@@ -6873,7 +6876,10 @@ boolean TryRunTics(tic_t realtics)
|
|||||||
DEBFILE(va("============ Running tic %d (local %d)\n", gametic, leveltime));
|
DEBFILE(va("============ Running tic %d (local %d)\n", gametic, leveltime));
|
||||||
|
|
||||||
if (update_stats)
|
if (update_stats)
|
||||||
|
{
|
||||||
|
ps_prevtictime = ps_tictime;
|
||||||
PS_START_TIMING(ps_tictime);
|
PS_START_TIMING(ps_tictime);
|
||||||
|
}
|
||||||
|
|
||||||
G_Ticker((gametic % NEWTICRATERATIO) == 0);
|
G_Ticker((gametic % NEWTICRATERATIO) == 0);
|
||||||
ExtraDataTicker();
|
ExtraDataTicker();
|
||||||
|
|||||||
@@ -79,6 +79,7 @@
|
|||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
|
|
||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
|
#include "lua_profile.h"
|
||||||
|
|
||||||
/* Manually defined asset hashes for non-CMake builds
|
/* Manually defined asset hashes for non-CMake builds
|
||||||
* Last updated 2015 / 05 / 03 - SRB2 v2.1.15 - srb2.srb
|
* Last updated 2015 / 05 / 03 - SRB2 v2.1.15 - srb2.srb
|
||||||
@@ -644,6 +645,11 @@ static boolean D_Display(void)
|
|||||||
|
|
||||||
CON_Drawer(); // Ha, i LIED!
|
CON_Drawer(); // Ha, i LIED!
|
||||||
|
|
||||||
|
if (cv_lua_profile.value > 0)
|
||||||
|
{
|
||||||
|
LUA_RenderTimers();
|
||||||
|
}
|
||||||
|
|
||||||
PS_START_TIMING(ps_swaptime);
|
PS_START_TIMING(ps_swaptime);
|
||||||
I_FinishUpdate(); // page flip or blit buffer
|
I_FinishUpdate(); // page flip or blit buffer
|
||||||
PS_STOP_TIMING(ps_swaptime);
|
PS_STOP_TIMING(ps_swaptime);
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
#include "lua_hook.h"
|
#include "lua_hook.h"
|
||||||
|
#include "lua_profile.h"
|
||||||
#include "m_cond.h"
|
#include "m_cond.h"
|
||||||
#include "m_anigif.h"
|
#include "m_anigif.h"
|
||||||
#include "k_kart.h" // SRB2kart
|
#include "k_kart.h" // SRB2kart
|
||||||
@@ -506,6 +507,9 @@ static CV_PossibleValue_t ps_descriptor_cons_t[] = {
|
|||||||
{1, "Average"}, {2, "SD"}, {3, "Minimum"}, {4, "Maximum"}, {0, NULL}};
|
{1, "Average"}, {2, "SD"}, {3, "Minimum"}, {4, "Maximum"}, {0, NULL}};
|
||||||
consvar_t cv_ps_descriptor = {"ps_descriptor", "Average", 0, ps_descriptor_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_ps_descriptor = {"ps_descriptor", "Average", 0, ps_descriptor_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
|
//consvar_t cv_lua_profile = {"lua_profile", "0").values(CV_Unsigned).onchange(lua_profile_OnChange).description("Show hook timings over an average of N tics");
|
||||||
|
consvar_t cv_lua_profile = {"lua_profile", "0", CV_CALL, CV_Unsigned, lua_profile_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
// only there to better keep track of it globally
|
// only there to better keep track of it globally
|
||||||
consvar_t cv_director = {"director", "Off", CV_HIDEN, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_director = {"director", "Off", CV_HIDEN, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
@@ -600,6 +604,12 @@ void D_RegisterServerCommands(void)
|
|||||||
Forceskin_cons_t[i].value = 0;
|
Forceskin_cons_t[i].value = 0;
|
||||||
Forceskin_cons_t[i].strvalue = NULL;
|
Forceskin_cons_t[i].strvalue = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set default player names
|
||||||
|
// Monster Iestyn (12/08/19): not sure where else I could have actually put this, but oh well
|
||||||
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
|
sprintf(player_names[i], "Player %d", 1 + i);
|
||||||
|
|
||||||
RegisterNetXCmd(XD_NAMEANDCOLOR, Got_NameAndColor);
|
RegisterNetXCmd(XD_NAMEANDCOLOR, Got_NameAndColor);
|
||||||
RegisterNetXCmd(XD_WEAPONPREF, Got_WeaponPref);
|
RegisterNetXCmd(XD_WEAPONPREF, Got_WeaponPref);
|
||||||
RegisterNetXCmd(XD_MAP, Got_Mapcmd);
|
RegisterNetXCmd(XD_MAP, Got_Mapcmd);
|
||||||
@@ -934,6 +944,8 @@ void D_RegisterClientCommands(void)
|
|||||||
CV_RegisterVar(&cv_palette);
|
CV_RegisterVar(&cv_palette);
|
||||||
CV_RegisterVar(&cv_palettenum);
|
CV_RegisterVar(&cv_palettenum);
|
||||||
|
|
||||||
|
CV_RegisterVar(&cv_lua_profile);
|
||||||
|
|
||||||
// m_menu.c
|
// m_menu.c
|
||||||
CV_RegisterVar(&cv_chatheight);
|
CV_RegisterVar(&cv_chatheight);
|
||||||
CV_RegisterVar(&cv_chatwidth);
|
CV_RegisterVar(&cv_chatwidth);
|
||||||
|
|||||||
@@ -189,6 +189,8 @@ extern consvar_t cv_ps_thinkframe_page;
|
|||||||
extern consvar_t cv_ps_samplesize;
|
extern consvar_t cv_ps_samplesize;
|
||||||
extern consvar_t cv_ps_descriptor;
|
extern consvar_t cv_ps_descriptor;
|
||||||
|
|
||||||
|
extern consvar_t cv_lua_profile;
|
||||||
|
|
||||||
extern consvar_t cv_director, cv_kartdebugdirector, cv_showdirectorhud;
|
extern consvar_t cv_director, cv_kartdebugdirector, cv_showdirectorhud;
|
||||||
|
|
||||||
extern consvar_t cv_showtrackaddon;
|
extern consvar_t cv_showtrackaddon;
|
||||||
|
|||||||
+2
-3
@@ -1616,8 +1616,7 @@ static void CURLGetFile(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
HTTP_login *
|
HTTP_login *CURLGetLogin(const char *url, HTTP_login ***return_prev_next)
|
||||||
CURLGetLogin (const char *url, HTTP_login ***return_prev_next)
|
|
||||||
{
|
{
|
||||||
HTTP_login * login;
|
HTTP_login * login;
|
||||||
HTTP_login ** prev_next;
|
HTTP_login ** prev_next;
|
||||||
@@ -1627,7 +1626,7 @@ CURLGetLogin (const char *url, HTTP_login ***return_prev_next)
|
|||||||
( login = (*prev_next));
|
( login = (*prev_next));
|
||||||
prev_next = &login->next
|
prev_next = &login->next
|
||||||
){
|
){
|
||||||
if (fastcmp(login->url, url) != 0)
|
if (fastcmp(login->url, url))
|
||||||
{
|
{
|
||||||
if (return_prev_next)
|
if (return_prev_next)
|
||||||
(*return_prev_next) = prev_next;
|
(*return_prev_next) = prev_next;
|
||||||
|
|||||||
+2
-2
@@ -211,12 +211,12 @@ void D_SetupProtocol(void)
|
|||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
if (!fastcmp(buffer, "no"))
|
if (fastcmp(buffer, "no"))
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (fastcmp(buffer, exe_path))
|
else if (!fastcmp(buffer, exe_path))
|
||||||
{
|
{
|
||||||
// overwrite
|
// overwrite
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|||||||
+3
-24
@@ -453,34 +453,13 @@ consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, dr
|
|||||||
static CV_PossibleValue_t cechotoggle_t[] = {{0, "Off"}, {1, "On"}, {2, "Console"}, {0, NULL}};
|
static CV_PossibleValue_t cechotoggle_t[] = {{0, "Off"}, {1, "On"}, {2, "Console"}, {0, NULL}};
|
||||||
consvar_t cv_cechotoggle = {"show_cecho", "On", CV_SAVE, cechotoggle_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_cechotoggle = {"show_cecho", "On", CV_SAVE, cechotoggle_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
#if MAXPLAYERS > 16
|
|
||||||
#error "please update player_name table using the new value for MAXPLAYERS"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SEENAMES
|
#ifdef SEENAMES
|
||||||
player_t *seenplayer = NULL; // player we're aiming at right now
|
player_t *seenplayer = NULL; // player we're aiming at right now
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char player_names[MAXPLAYERS][MAXPLAYERNAME+1] =
|
// now automatically allocated in D_RegisterServerCommands
|
||||||
{
|
// so that it doesn't have to be updated depending on the value of MAXPLAYERS
|
||||||
"Player 1",
|
char player_names[MAXPLAYERS][MAXPLAYERNAME+1];
|
||||||
"Player 2",
|
|
||||||
"Player 3",
|
|
||||||
"Player 4",
|
|
||||||
"Player 5",
|
|
||||||
"Player 6",
|
|
||||||
"Player 7",
|
|
||||||
"Player 8",
|
|
||||||
"Player 9",
|
|
||||||
"Player 10",
|
|
||||||
"Player 11",
|
|
||||||
"Player 12",
|
|
||||||
"Player 13",
|
|
||||||
"Player 14",
|
|
||||||
"Player 15",
|
|
||||||
"Player 16"
|
|
||||||
}; // SRB2kart - removed Players 17 through 32
|
|
||||||
|
|
||||||
INT32 player_name_changes[MAXPLAYERS] = {};
|
INT32 player_name_changes[MAXPLAYERS] = {};
|
||||||
|
|
||||||
INT16 rw_maximums[NUM_WEAPONS] =
|
INT16 rw_maximums[NUM_WEAPONS] =
|
||||||
|
|||||||
@@ -998,7 +998,7 @@ static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
|
|||||||
const char *flatname = W_CheckNameForNum(flatlumpnum);
|
const char *flatname = W_CheckNameForNum(flatlumpnum);
|
||||||
|
|
||||||
// hack for gba rainbow roads cyan floors
|
// hack for gba rainbow roads cyan floors
|
||||||
if (UNLIKELY(memcmp(flatname, "GBA_RRF5", 8) == 0 && flatname[8] == 0))
|
if (UNLIKELY(flatname && memcmp(flatname, "GBA_RRF5", 8) == 0 && flatname[8] == 0))
|
||||||
{
|
{
|
||||||
glMipmap->flags &= ~TF_CHROMAKEYED;
|
glMipmap->flags &= ~TF_CHROMAKEYED;
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-10
@@ -1101,8 +1101,8 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
|||||||
|
|
||||||
// Found a break
|
// Found a break
|
||||||
// The heights are clamped to ensure the polygon doesn't cross itself.
|
// The heights are clamped to ensure the polygon doesn't cross itself.
|
||||||
bot = std::clamp(bheight, realbot, top);
|
bot = std::min(std::max(bheight, realbot), top);
|
||||||
endbot = std::clamp(endbheight, endrealbot, endtop);
|
endbot = std::min(std::max(endbheight, endrealbot), endtop);
|
||||||
|
|
||||||
Surf->PolyColor.s.alpha = alpha;
|
Surf->PolyColor.s.alpha = alpha;
|
||||||
|
|
||||||
@@ -3235,6 +3235,18 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
|
|||||||
if (!spr->mobj)
|
if (!spr->mobj)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Ceiling scenery have no shadow.
|
||||||
|
if ((spr->mobj->flags & (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY)) == (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Debris have no corona or shadow.
|
||||||
|
if (spr->mobj->flags2 & MF2_DEBRIS)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Without this, your shadow shows on the floor, even after you die and fall through the ground.
|
||||||
|
if (spr->mobj->z < spr->mobj->floorz)
|
||||||
|
return;
|
||||||
|
|
||||||
R_GetShadowZ(spr->mobj, &floorslope);
|
R_GetShadowZ(spr->mobj, &floorslope);
|
||||||
|
|
||||||
mobjfloor = HWR_OpaqueFloorAtPos(
|
mobjfloor = HWR_OpaqueFloorAtPos(
|
||||||
@@ -3495,10 +3507,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
|
|||||||
hwrpatch = static_cast<GLPatch_t *>(gpatch->hardware);
|
hwrpatch = static_cast<GLPatch_t *>(gpatch->hardware);
|
||||||
|
|
||||||
// Draw shadow BEFORE sprite
|
// Draw shadow BEFORE sprite
|
||||||
if (UNLIKELY(cv_shadow.value // Shadows enabled
|
if (UNLIKELY(cv_shadow.value))
|
||||||
&& (sprmo->flags & (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY)) != (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY) // Ceiling scenery have no shadow.
|
|
||||||
&& !(sprmo->flags2 & MF2_DEBRIS) // Debris have no corona or shadow.
|
|
||||||
&& (sprmo->z >= sprmo->floorz))) // Without this, your shadow shows on the floor, even after you die and fall through the ground.
|
|
||||||
{
|
{
|
||||||
////////////////////
|
////////////////////
|
||||||
// SHADOW SPRITE! //
|
// SHADOW SPRITE! //
|
||||||
@@ -3824,10 +3833,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw shadow BEFORE sprite
|
// Draw shadow BEFORE sprite
|
||||||
if (UNLIKELY(cv_shadow.value // Shadows enabled
|
if (UNLIKELY(cv_shadow.value))
|
||||||
&& (sprmo->flags & (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY)) != (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY) // Ceiling scenery have no shadow.
|
|
||||||
&& !(sprmo->flags2 & MF2_DEBRIS) // Debris have no corona or shadow.
|
|
||||||
&& (sprmo->z >= sprmo->floorz))) // Without this, your shadow shows on the floor, even after you die and fall through the ground.
|
|
||||||
{
|
{
|
||||||
////////////////////
|
////////////////////
|
||||||
// SHADOW SPRITE! //
|
// SHADOW SPRITE! //
|
||||||
|
|||||||
@@ -3581,6 +3581,10 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
skin = K_GetMobjSkin(mo);
|
skin = K_GetMobjSkin(mo);
|
||||||
|
|
||||||
|
if (!skin)
|
||||||
|
return;
|
||||||
|
|
||||||
minimaphead = (skinlocal ? localfacemmapprefix : facemmapprefix)[K_GetMobjSkinNum(skin, skinlocal)];
|
minimaphead = (skinlocal ? localfacemmapprefix : facemmapprefix)[K_GetMobjSkinNum(skin, skinlocal)];
|
||||||
|
|
||||||
if (minimaphead == NULL)
|
if (minimaphead == NULL)
|
||||||
@@ -3784,6 +3788,9 @@ static void K_drawKartMinimap(void)
|
|||||||
|
|
||||||
mobj_t *mobj = players[localplayers[i]].mo;
|
mobj_t *mobj = players[localplayers[i]].mo;
|
||||||
|
|
||||||
|
if (!mobj)
|
||||||
|
continue;
|
||||||
|
|
||||||
// dont draw for no contestants
|
// dont draw for no contestants
|
||||||
boolean playertimedout = (mobj->health <= 0 && players[localplayers[i]].pflags & PF_TIMEOVER);
|
boolean playertimedout = (mobj->health <= 0 && players[localplayers[i]].pflags & PF_TIMEOVER);
|
||||||
|
|
||||||
|
|||||||
@@ -3087,6 +3087,8 @@ static int lib_gPlayerDeviceRumble(lua_State *L)
|
|||||||
if (!player)
|
if (!player)
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
|
||||||
|
if (demo.playback) return 0;
|
||||||
|
|
||||||
pnum = P_GetLocalPlayerNumForPlayer(player);
|
pnum = P_GetLocalPlayerNumForPlayer(player);
|
||||||
|
|
||||||
// Not a local player
|
// Not a local player
|
||||||
|
|||||||
+49
-3
@@ -25,6 +25,7 @@
|
|||||||
#include "lua_libs.h"
|
#include "lua_libs.h"
|
||||||
#include "lua_hook.h"
|
#include "lua_hook.h"
|
||||||
#include "lua_hud.h" // hud_running errors
|
#include "lua_hud.h" // hud_running errors
|
||||||
|
#include "lua_profile.h"
|
||||||
|
|
||||||
/* =========================================================================
|
/* =========================================================================
|
||||||
ABSTRACTION
|
ABSTRACTION
|
||||||
@@ -445,11 +446,54 @@ FUNCINLINE static ATTRINLINE void get_hook_from_table(Hook_State *hook, int n)
|
|||||||
lua_getref(gL, hookRefs[hook->id]);
|
lua_getref(gL, hookRefs[hook->id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int pcall(Hook_State *hook)
|
||||||
|
{
|
||||||
|
return lua_pcall(gL, hook->values, hook->results, EINDEX);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *hook_name(Hook_State *hook)
|
||||||
|
{
|
||||||
|
if (hud_running)
|
||||||
|
{
|
||||||
|
return hudHookNames[hook->hook_type];
|
||||||
|
}
|
||||||
|
else if (hook->string)
|
||||||
|
{
|
||||||
|
return stringHookNames[hook->hook_type];
|
||||||
|
}
|
||||||
|
//else if (hook->mobj_type > 0)
|
||||||
|
else if (hook->mobj_type != NONMOHOOK)
|
||||||
|
{
|
||||||
|
return mobjHookNames[hook->hook_type];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return hookNames[hook->hook_type];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int pcall_timed_or_untimed(Hook_State *hook)
|
||||||
|
{
|
||||||
|
if (!hud_running && cv_lua_profile.value > 0)
|
||||||
|
{
|
||||||
|
lua_timer_t *timer = LUA_BeginFunctionTimer(gL, -1 - hook->values, hook_name(hook));
|
||||||
|
int k = pcall(hook);
|
||||||
|
LUA_EndFunctionTimer(timer);
|
||||||
|
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return pcall(hook);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int call_single_hook_no_copy(Hook_State *hook)
|
static int call_single_hook_no_copy(Hook_State *hook)
|
||||||
{
|
{
|
||||||
hook_important = hook->important;
|
hook_important = hook->important;
|
||||||
|
|
||||||
if (lua_pcall(gL, hook->values, hook->results, EINDEX) == 0)
|
//if (lua_pcall(gL, hook->values, hook->results, EINDEX) == 0)
|
||||||
|
if (pcall_timed_or_untimed(hook) == 0)
|
||||||
{
|
{
|
||||||
if (hook->results > 0)
|
if (hook->results > 0)
|
||||||
{
|
{
|
||||||
@@ -540,7 +584,6 @@ FUNCINLINE static ATTRINLINE int call_mobj_type_hooks(Hook_State *hook, mobjtype
|
|||||||
|| hook->hook_type == MOBJ_HOOK(MobjCollide )
|
|| hook->hook_type == MOBJ_HOOK(MobjCollide )
|
||||||
|| hook->hook_type == MOBJ_HOOK(MobjMoveCollide)
|
|| hook->hook_type == MOBJ_HOOK(MobjMoveCollide)
|
||||||
|| hook->hook_type == MOBJ_HOOK(MobjFuse )
|
|| hook->hook_type == MOBJ_HOOK(MobjFuse )
|
||||||
|| hook->hook_type == MOBJ_HOOK(MobjThinker )
|
|
||||||
|| hook->hook_type == MOBJ_HOOK(BossThinker )
|
|| hook->hook_type == MOBJ_HOOK(BossThinker )
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
@@ -760,7 +803,7 @@ static void hook_think_frame(int type)
|
|||||||
const hook_t * map = &hookIds[type];
|
const hook_t * map = &hookIds[type];
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
const boolean perfstats = (cv_perfstats.value >= 3);
|
const boolean perfstats = (cv_perfstats.value >= PS_THINKFRAME);
|
||||||
|
|
||||||
if (prepare_hook(&hook, 0, type))
|
if (prepare_hook(&hook, 0, type))
|
||||||
{
|
{
|
||||||
@@ -1018,6 +1061,9 @@ void LUA_HookNetArchive(lua_CFunction archFunc, savebuffer_t *save)
|
|||||||
lua_pushcclosure(gL, archFunc, 2);
|
lua_pushcclosure(gL, archFunc, 2);
|
||||||
// stack: tables, savebuffer_t, archFunc
|
// stack: tables, savebuffer_t, archFunc
|
||||||
|
|
||||||
|
// Manually set the hook's variables here since we don't call prepare_hook
|
||||||
|
hook.hook_type = HOOK(NetVars);
|
||||||
|
hook.mobj_type = NONMOHOOK; // Force mobj_type to be NONMOHOOK so the mobj_type check get skipped
|
||||||
init_hook_call(&hook, 0, res_none);
|
init_hook_call(&hook, 0, res_none);
|
||||||
call_mapped(&hook, map);
|
call_mapped(&hook, map);
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -22,7 +22,8 @@
|
|||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
#include "lua_libs.h"
|
#include "lua_libs.h"
|
||||||
#include "lua_hud.h" // hud_running errors
|
#include "lua_hud.h" // hud_running errors
|
||||||
#include "lua_hook.h" // cmd errors
|
#include "lua_hook.h" // hook_cmd_running errors
|
||||||
|
#include "lua_profile.h"
|
||||||
|
|
||||||
boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor);
|
boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor);
|
||||||
state_t *astate = NULL;
|
state_t *astate = NULL;
|
||||||
@@ -110,7 +111,10 @@ static void A_Lua(mobj_t *actor)
|
|||||||
LUA_PushUserdata(gL, actor, META_MOBJ);
|
LUA_PushUserdata(gL, actor, META_MOBJ);
|
||||||
lua_pushinteger(gL, var1);
|
lua_pushinteger(gL, var1);
|
||||||
lua_pushinteger(gL, var2);
|
lua_pushinteger(gL, var2);
|
||||||
|
|
||||||
|
lua_timer_t *timer = LUA_BeginFunctionTimer(gL, -4, "A_Lua");
|
||||||
LUA_Call(gL, 3, 0, 1);
|
LUA_Call(gL, 3, 0, 1);
|
||||||
|
LUA_EndFunctionTimer(timer);
|
||||||
|
|
||||||
lua_pop(gL, 1); // pop error handler
|
lua_pop(gL, 1); // pop error handler
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,264 @@
|
|||||||
|
// DR. ROBOTNIK'S RING RACERS
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2025 by James Robert Roman
|
||||||
|
// Copyright (C) 2025 by Kart Krew
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "screen.h"
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "blua/lua.h"
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "v_video.h"
|
||||||
|
|
||||||
|
#include "command.h"
|
||||||
|
#include "doomtype.h"
|
||||||
|
#include "i_system.h"
|
||||||
|
#include "lua_profile.h"
|
||||||
|
#include "m_perfstats.h"
|
||||||
|
|
||||||
|
extern "C" consvar_t cv_lua_profile;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
precise_t g_time_reference;
|
||||||
|
int g_tics_counted;
|
||||||
|
|
||||||
|
double g_running_tic_time;
|
||||||
|
double g_avg_tic_time;
|
||||||
|
|
||||||
|
bool g_invalid;
|
||||||
|
|
||||||
|
}; // namespace
|
||||||
|
|
||||||
|
struct lua_timer_t
|
||||||
|
{
|
||||||
|
struct Stat
|
||||||
|
{
|
||||||
|
double calls = 0;
|
||||||
|
double time = 0.0;
|
||||||
|
};
|
||||||
|
|
||||||
|
Stat running, avg;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
std::unordered_map<std::string, lua_timer_t> g_tic_timers;
|
||||||
|
|
||||||
|
}; // namespace
|
||||||
|
|
||||||
|
lua_timer_t* LUA_BeginFunctionTimer(lua_State* L, int fn_idx, const char* name)
|
||||||
|
{
|
||||||
|
lua_Debug ar;
|
||||||
|
|
||||||
|
lua_pushvalue(L, fn_idx);
|
||||||
|
lua_getinfo(L, ">S", &ar);
|
||||||
|
|
||||||
|
auto label = [&]
|
||||||
|
{
|
||||||
|
using sv = std::string_view;
|
||||||
|
sv view{ar.source};
|
||||||
|
|
||||||
|
switch (view.front())
|
||||||
|
{
|
||||||
|
case '@': // file
|
||||||
|
if (std::size_t p = view.rfind('/'); p != sv::npos) // lump or base
|
||||||
|
{
|
||||||
|
return view.substr(p + 1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '=': // ??
|
||||||
|
view.remove_prefix(1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return view;
|
||||||
|
};
|
||||||
|
|
||||||
|
// i sure hope this std::string mess is fine...
|
||||||
|
auto [it, ins] = g_tic_timers.try_emplace(std::string(va("%s:%d (%s)", std::string(label()).c_str(), ar.linedefined, name)));
|
||||||
|
auto& [key, timer] = *it;
|
||||||
|
|
||||||
|
g_time_reference = I_GetPreciseTime();
|
||||||
|
|
||||||
|
return &timer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LUA_EndFunctionTimer(lua_timer_t* timer)
|
||||||
|
{
|
||||||
|
precise_t t = I_GetPreciseTime() - g_time_reference;
|
||||||
|
double precision = I_GetPrecisePrecision();
|
||||||
|
|
||||||
|
timer->running.time += t / precision;
|
||||||
|
timer->running.calls += 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LUA_ResetTicTimers(void)
|
||||||
|
{
|
||||||
|
if (cv_lua_profile.value <= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_tics_counted < cv_lua_profile.value)
|
||||||
|
{
|
||||||
|
g_tics_counted++;
|
||||||
|
|
||||||
|
double precision = I_GetPrecisePrecision();
|
||||||
|
g_running_tic_time += ps_prevtictime.value.p / precision;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double counted = g_tics_counted;
|
||||||
|
|
||||||
|
for (auto& [key, timer] : g_tic_timers)
|
||||||
|
{
|
||||||
|
timer.avg = {timer.running.calls / counted, timer.running.time / counted};
|
||||||
|
timer.running = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
g_avg_tic_time = g_running_tic_time / counted;
|
||||||
|
g_running_tic_time = 0.0;
|
||||||
|
|
||||||
|
g_tics_counted = 1;
|
||||||
|
|
||||||
|
g_invalid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LUA_RenderTimers(void)
|
||||||
|
{
|
||||||
|
constexpr int kRowHeight = 4;
|
||||||
|
float row_y = kRowHeight;
|
||||||
|
|
||||||
|
// pretty much what the whole srb2::Draw does lol
|
||||||
|
auto draw_row = [](float x, float y, INT32 flags, const char *str)
|
||||||
|
{
|
||||||
|
V_DrawSmallStringAtFixed(
|
||||||
|
FloatToFixed(x),
|
||||||
|
FloatToFixed(y),
|
||||||
|
V_MONOSPACE|V_ALLOWLOWERCASE|flags,
|
||||||
|
str
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
draw_row(0.f, 0.f, 0, va("-- AVERAGES PER TIC (over %d tics) --", cv_lua_profile.value));
|
||||||
|
|
||||||
|
if (g_invalid)
|
||||||
|
{
|
||||||
|
draw_row(0.f, row_y, V_GRAYMAP, " <Data pending>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<decltype(g_tic_timers)::iterator> view;
|
||||||
|
view.reserve(g_tic_timers.size());
|
||||||
|
|
||||||
|
auto color_flag = [](double t)
|
||||||
|
{
|
||||||
|
if (t < 10.0)
|
||||||
|
{
|
||||||
|
return V_GRAYMAP;
|
||||||
|
}
|
||||||
|
else if (t >= 100.0)
|
||||||
|
{
|
||||||
|
return V_YELLOWMAP;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
{
|
||||||
|
double cum = 0.0;
|
||||||
|
|
||||||
|
for (auto it = g_tic_timers.begin(); it != g_tic_timers.end(); ++it)
|
||||||
|
{
|
||||||
|
auto& [key, timer] = *it;
|
||||||
|
|
||||||
|
cum += timer.avg.time;
|
||||||
|
|
||||||
|
if (timer.avg.time > 0.0)
|
||||||
|
{
|
||||||
|
view.push_back(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const INT32 tally_flags = color_flag(cum * 1'000'000.0);
|
||||||
|
|
||||||
|
draw_row(0.f, row_y, tally_flags, va("%8.2f us - TOTAL", cum * 1'000'000.0));
|
||||||
|
draw_row(0.f, row_y + kRowHeight, tally_flags, va("%8.2f ms", cum * 1000.0));
|
||||||
|
|
||||||
|
// dont need to show this if we didnt capture over time
|
||||||
|
// this would just show nan or inf anyways
|
||||||
|
if (std::fpclassify(g_avg_tic_time) != FP_ZERO)
|
||||||
|
{
|
||||||
|
draw_row(0.f, row_y + kRowHeight * 2, tally_flags, va(
|
||||||
|
"%8.2f%% overhead (%.2f / %.2f) <-- not counting rendering time",
|
||||||
|
(cum / g_avg_tic_time) * 100.0,
|
||||||
|
(cum * (double)TICRATE),
|
||||||
|
(g_avg_tic_time * (double)TICRATE)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
row_y += kRowHeight * 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::sort(
|
||||||
|
view.rbegin(),
|
||||||
|
view.rend(),
|
||||||
|
[](auto a, auto b)
|
||||||
|
{
|
||||||
|
auto& [k1, t1] = *a;
|
||||||
|
auto& [k2, t2] = *b;
|
||||||
|
return t1.avg.time < t2.avg.time;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
for (auto it : view)
|
||||||
|
{
|
||||||
|
auto& [key, timer] = *it;
|
||||||
|
|
||||||
|
double t = timer.avg.time * 1'000'000.0;
|
||||||
|
|
||||||
|
draw_row(0.f, row_y, color_flag(t), va(
|
||||||
|
"%8.2f us %8.2f calls - %s",
|
||||||
|
t,
|
||||||
|
timer.avg.calls,
|
||||||
|
key.c_str()
|
||||||
|
));
|
||||||
|
|
||||||
|
row_y += kRowHeight;
|
||||||
|
|
||||||
|
// FIXME this is all ugly and sucks
|
||||||
|
if (row_y >= BASEVIDHEIGHT)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void lua_profile_OnChange(void)
|
||||||
|
{
|
||||||
|
g_invalid = true;
|
||||||
|
|
||||||
|
if (cv_lua_profile.value == 0)
|
||||||
|
{
|
||||||
|
g_tic_timers = {};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
// DR. ROBOTNIK'S RING RACERS
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2025 by James Robert Roman
|
||||||
|
// Copyright (C) 2025 by Kart Krew
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef lua_profile_h
|
||||||
|
#define lua_profile_h
|
||||||
|
|
||||||
|
#include "blua/lua.h"
|
||||||
|
#include "doomtype.h"
|
||||||
|
//#include "typedef.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct lua_timer_t;
|
||||||
|
typedef struct lua_timer_t lua_timer_t;
|
||||||
|
|
||||||
|
void LUA_ResetTicTimers(void);
|
||||||
|
|
||||||
|
lua_timer_t *LUA_BeginFunctionTimer(lua_State *L, int fn_idx, const char *name);
|
||||||
|
void LUA_EndFunctionTimer(lua_timer_t *timer);
|
||||||
|
|
||||||
|
void LUA_RenderTimers(void);
|
||||||
|
|
||||||
|
void lua_profile_OnChange(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // extern "C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif/*lua_profile_h*/
|
||||||
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include "m_curl.h"
|
#include "m_curl.h"
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
#include "i_system.h" // I_OutputMsg
|
#include "doomdef.h" // I_OutputMsg
|
||||||
#include "m_argv.h" // M_CheckParm, M_GetNextParm
|
#include "m_argv.h" // M_CheckParm, M_GetNextParm
|
||||||
|
|
||||||
static boolean curl_args_init = false;
|
static boolean curl_args_init = false;
|
||||||
|
|||||||
+6
-2
@@ -5766,7 +5766,8 @@ static void M_DrawMusicTest(void)
|
|||||||
x = 24;
|
x = 24;
|
||||||
y = 64;
|
y = 64;
|
||||||
|
|
||||||
if (renderisnewtic) st_musictime++;
|
if (renderisnewtic)
|
||||||
|
st_musictime++;
|
||||||
|
|
||||||
while (t <= b)
|
while (t <= b)
|
||||||
{
|
{
|
||||||
@@ -5775,11 +5776,11 @@ static void M_DrawMusicTest(void)
|
|||||||
|
|
||||||
{
|
{
|
||||||
const musicdef_t *def = S_GetMusicCredit(t);
|
const musicdef_t *def = S_GetMusicCredit(t);
|
||||||
const size_t MAXLENGTH = 34;
|
|
||||||
const char *songname = def->title[0] ? def->title : def->source;
|
const char *songname = def->title[0] ? def->title : def->source;
|
||||||
|
|
||||||
size_t namelength = strlen(songname);
|
size_t namelength = strlen(songname);
|
||||||
|
|
||||||
|
#define MAXLENGTH 34
|
||||||
char buf[MAXLENGTH+1];
|
char buf[MAXLENGTH+1];
|
||||||
|
|
||||||
if (t == st_sel && namelength > MAXLENGTH)
|
if (t == st_sel && namelength > MAXLENGTH)
|
||||||
@@ -5788,11 +5789,14 @@ static void M_DrawMusicTest(void)
|
|||||||
strlcpy(buf, songname, MAXLENGTH);
|
strlcpy(buf, songname, MAXLENGTH);
|
||||||
|
|
||||||
V_DrawString(x, y, (t == st_sel ? V_YELLOWMAP : 0)|V_ALLOWLOWERCASE|V_MONOSPACE, buf);
|
V_DrawString(x, y, (t == st_sel ? V_YELLOWMAP : 0)|V_ALLOWLOWERCASE|V_MONOSPACE, buf);
|
||||||
|
|
||||||
if (curplaying == def)
|
if (curplaying == def)
|
||||||
{
|
{
|
||||||
V_DrawFill(20+280-9, y-4, 8, 16, 230);
|
V_DrawFill(20+280-9, y-4, 8, 16, 230);
|
||||||
}
|
}
|
||||||
|
#undef MAXLENGTH
|
||||||
}
|
}
|
||||||
|
|
||||||
t++;
|
t++;
|
||||||
y += 16;
|
y += 16;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1261,7 +1261,7 @@ void M_ScrollString(const char name[], size_t len, char result[], size_t maxlen,
|
|||||||
const size_t amount = len - maxlen + 1;
|
const size_t amount = len - maxlen + 1;
|
||||||
|
|
||||||
// Note: anything above 17 will cause zero division
|
// Note: anything above 17 will cause zero division
|
||||||
const size_t MAXSPEED = 6;
|
static const size_t MAXSPEED = 6;
|
||||||
const tic_t t = timer / (35/min(amount, MAXSPEED));
|
const tic_t t = timer / (35/min(amount, MAXSPEED));
|
||||||
|
|
||||||
const size_t state = (t / amount) % 4;
|
const size_t state = (t / amount) % 4;
|
||||||
@@ -1296,7 +1296,7 @@ void M_ScrollString(const char name[], size_t len, char result[], size_t maxlen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Technically not necessary, since it gets set again after function call, but just in case
|
// Technically not necessary, since it gets set again after function call, but just in case
|
||||||
result[maxlen] = 0;
|
result[maxlen-1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
void M_MinimapGenerate(void)
|
void M_MinimapGenerate(void)
|
||||||
|
|||||||
+42
-56
@@ -47,6 +47,7 @@ struct perfstatrow {
|
|||||||
static ps_metric_t ps_frametime = {0};
|
static ps_metric_t ps_frametime = {0};
|
||||||
|
|
||||||
ps_metric_t ps_tictime = {0};
|
ps_metric_t ps_tictime = {0};
|
||||||
|
ps_metric_t ps_prevtictime = {0};
|
||||||
|
|
||||||
ps_metric_t ps_playerthink_time = {0};
|
ps_metric_t ps_playerthink_time = {0};
|
||||||
ps_metric_t ps_thinkertime = {0};
|
ps_metric_t ps_thinkertime = {0};
|
||||||
@@ -168,14 +169,14 @@ perfstatrow_t gamelogic_rows[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
perfstatrow_t thinkercount_rows[] = {
|
perfstatrow_t thinkercount_rows[] = {
|
||||||
{"thnkers", "Thinkers: ", &ps_thinkercount, PS_LEVEL},
|
{"thnkers" , "Thinkers: ", &ps_thinkercount, PS_LEVEL},
|
||||||
{" mobjs ", " Mobjs: ", &ps_mobjcount, PS_LEVEL},
|
{" mobjs " , " Mobjs: ", &ps_mobjcount, PS_LEVEL},
|
||||||
{" regular", " Regular: ", &ps_regularcount, PS_LEVEL},
|
{" regular", " Regular: ", &ps_regularcount, PS_LEVEL},
|
||||||
{" scenery", " Scenery: ", &ps_scenerycount, PS_LEVEL},
|
{" scenery", " Scenery: ", &ps_scenerycount, PS_LEVEL},
|
||||||
{" nothink", " Nothink: ", &ps_nothinkcount, PS_HIDE_ZERO|PS_LEVEL},
|
{" nothink", " Nothink: ", &ps_nothinkcount, PS_HIDE_ZERO|PS_LEVEL},
|
||||||
{" precip ", " Precipitation: ", &ps_precipcount, PS_LEVEL},
|
{" precip " , " Precipitation: ", &ps_precipcount, PS_LEVEL},
|
||||||
{" other ", " Other: ", &ps_otherthcount, PS_LEVEL},
|
{" other " , " Other: ", &ps_otherthcount, PS_LEVEL},
|
||||||
{" remove ", " Pending removal:", &ps_removecount, PS_LEVEL},
|
{" remove " , " Pending removal:", &ps_removecount, PS_LEVEL},
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -605,7 +606,9 @@ static void PS_CountThinkers(void)
|
|||||||
else if (thinker->function == (actionf_p1)P_MobjThinker)
|
else if (thinker->function == (actionf_p1)P_MobjThinker)
|
||||||
{
|
{
|
||||||
mobj_t *mobj = (mobj_t*)thinker;
|
mobj_t *mobj = (mobj_t*)thinker;
|
||||||
|
|
||||||
ps_mobjcount.value.i++;
|
ps_mobjcount.value.i++;
|
||||||
|
|
||||||
if (mobj->flags & MF_NOTHINK)
|
if (mobj->flags & MF_NOTHINK)
|
||||||
ps_nothinkcount.value.i++;
|
ps_nothinkcount.value.i++;
|
||||||
else if (mobj->flags & MF_SCENERY)
|
else if (mobj->flags & MF_SCENERY)
|
||||||
@@ -624,49 +627,17 @@ static void PS_CountThinkers(void)
|
|||||||
|
|
||||||
ps_precipcount.value.i++;
|
ps_precipcount.value.i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*for (i = 0; i < NUM_THINKERLISTS; i++)
|
|
||||||
{
|
|
||||||
for (thinker = thlist[i].next; thinker != &thlist[i]; thinker = thinker->next)
|
|
||||||
{
|
|
||||||
ps_thinkercount.value.i++;
|
|
||||||
if (thinker->function == (actionf_p1)P_RemoveThinkerDelayed)
|
|
||||||
ps_removecount.value.i++;
|
|
||||||
else if (i == THINK_POLYOBJ)
|
|
||||||
ps_polythcount.value.i++;
|
|
||||||
else if (i == THINK_MAIN)
|
|
||||||
ps_mainthcount.value.i++;
|
|
||||||
else if (i == THINK_MOBJ)
|
|
||||||
{
|
|
||||||
if (thinker->function == (actionf_p1)P_MobjThinker)
|
|
||||||
{
|
|
||||||
mobj_t *mobj = (mobj_t*)thinker;
|
|
||||||
ps_mobjcount.value.i++;
|
|
||||||
if (mobj->flags & MF_NOTHINK)
|
|
||||||
ps_nothinkcount.value.i++;
|
|
||||||
else if (mobj->flags & MF_SCENERY)
|
|
||||||
ps_scenerycount.value.i++;
|
|
||||||
else
|
|
||||||
ps_regularcount.value.i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (i == THINK_DYNSLOPE)
|
|
||||||
ps_dynslopethcount.value.i++;
|
|
||||||
else if (i == THINK_PRECIP)
|
|
||||||
ps_precipcount.value.i++;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update all metrics that are calculated on every tick.
|
// Update all metrics that are calculated on every tick.
|
||||||
void PS_UpdateTickStats(void)
|
void PS_UpdateTickStats(void)
|
||||||
{
|
{
|
||||||
if (cv_perfstats.value == 1 && cv_ps_samplesize.value > 1)
|
if (cv_perfstats.value == PS_RENDER && cv_ps_samplesize.value > 1)
|
||||||
{
|
{
|
||||||
PS_UpdateRowHistories(gamelogicbrief_row, false);
|
PS_UpdateRowHistories(gamelogicbrief_row, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cv_perfstats.value == 2)
|
if (cv_perfstats.value == PS_LOGIC)
|
||||||
{
|
{
|
||||||
if (PS_IsLevelActive())
|
if (PS_IsLevelActive())
|
||||||
{
|
{
|
||||||
@@ -691,25 +662,25 @@ void PS_UpdateTickStats(void)
|
|||||||
|
|
||||||
if (cv_ps_samplesize.value > 1)
|
if (cv_ps_samplesize.value > 1)
|
||||||
{
|
{
|
||||||
if (cv_perfstats.value >= 3 && PS_IsLevelActive())
|
if (cv_perfstats.value >= PS_THINKFRAME && PS_IsLevelActive())
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch (cv_perfstats.value)
|
switch (cv_perfstats.value)
|
||||||
{
|
{
|
||||||
case 3:
|
case PS_THINKFRAME:
|
||||||
for (i = 0; i < thinkframe_hooks_length; i++)
|
for (i = 0; i < thinkframe_hooks_length; i++)
|
||||||
{
|
{
|
||||||
PS_UpdateMetricHistory(&thinkframe_hooks[i].time_taken, true, false);
|
PS_UpdateMetricHistory(&thinkframe_hooks[i].time_taken, true, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case PS_PRETHINKFRAME:
|
||||||
for (i = 0; i < prethinkframe_hooks_length; i++)
|
for (i = 0; i < prethinkframe_hooks_length; i++)
|
||||||
{
|
{
|
||||||
PS_UpdateMetricHistory(&prethinkframe_hooks[i].time_taken, true, false);
|
PS_UpdateMetricHistory(&prethinkframe_hooks[i].time_taken, true, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case PS_POSTTHINKFRAME:
|
||||||
for (i = 0; i < postthinkframe_hooks_length; i++)
|
for (i = 0; i < postthinkframe_hooks_length; i++)
|
||||||
{
|
{
|
||||||
PS_UpdateMetricHistory(&postthinkframe_hooks[i].time_taken, true, false);
|
PS_UpdateMetricHistory(&postthinkframe_hooks[i].time_taken, true, false);
|
||||||
@@ -719,6 +690,7 @@ void PS_UpdateTickStats(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cv_perfstats.value)
|
if (cv_perfstats.value)
|
||||||
{
|
{
|
||||||
ps_tick_index++;
|
ps_tick_index++;
|
||||||
@@ -749,7 +721,7 @@ static void PS_DrawDescriptorHeader(void)
|
|||||||
int samples_left = max(ps_frame_samples_left, ps_tick_samples_left);
|
int samples_left = max(ps_frame_samples_left, ps_tick_samples_left);
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if (cv_perfstats.value >= 3)
|
if (cv_perfstats.value >= PS_THINKFRAME)
|
||||||
{
|
{
|
||||||
x = 2;
|
x = 2;
|
||||||
y = 0;
|
y = 0;
|
||||||
@@ -865,20 +837,19 @@ static void draw_think_frame_stats(int hook_length, ps_hookinfo_t *hook)
|
|||||||
last_mod_name[0] = '\0';
|
last_mod_name[0] = '\0';
|
||||||
INT32 total = 0;
|
INT32 total = 0;
|
||||||
|
|
||||||
//Decide page length based and drawn text on choosen thinker type
|
// Decide page length based and drawn text on choosen thinker type
|
||||||
switch (cv_perfstats.value)
|
switch (cv_perfstats.value)
|
||||||
{
|
{
|
||||||
case 3:
|
case PS_THINKFRAME:
|
||||||
{
|
{
|
||||||
maxpage = thinkframe_hooks_length/PAGE_ENTRIES + 1;
|
maxpage = thinkframe_hooks_length/PAGE_ENTRIES + 1;
|
||||||
page = max(1, min(cv_ps_thinkframe_page.value, maxpage));
|
page = max(1, min(cv_ps_thinkframe_page.value, maxpage));
|
||||||
pagestart = min((page - 1)*PAGE_ENTRIES, thinkframe_hooks_length);
|
pagestart = min((page - 1)*PAGE_ENTRIES, thinkframe_hooks_length);
|
||||||
pageend = min(pagestart + PAGE_ENTRIES, thinkframe_hooks_length);
|
pageend = min(pagestart + PAGE_ENTRIES, thinkframe_hooks_length);
|
||||||
|
|
||||||
V_DrawSmallString(MAX_X-50, MAX_Y+2*HEIGHT, V_MONOSPACE | V_GREENMAP, "ThinkFrame");
|
V_DrawSmallString(MAX_X-50, MAX_Y+2*HEIGHT, V_MONOSPACE | V_GREENMAP, "ThinkFrame");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case PS_PRETHINKFRAME:
|
||||||
{
|
{
|
||||||
maxpage = prethinkframe_hooks_length/PAGE_ENTRIES + 1;
|
maxpage = prethinkframe_hooks_length/PAGE_ENTRIES + 1;
|
||||||
page = max(1, min(cv_ps_thinkframe_page.value, maxpage));
|
page = max(1, min(cv_ps_thinkframe_page.value, maxpage));
|
||||||
@@ -887,7 +858,7 @@ static void draw_think_frame_stats(int hook_length, ps_hookinfo_t *hook)
|
|||||||
V_DrawSmallString(MAX_X-60, MAX_Y+2*HEIGHT, V_MONOSPACE | V_GREENMAP, "PreThinkFrame");
|
V_DrawSmallString(MAX_X-60, MAX_Y+2*HEIGHT, V_MONOSPACE | V_GREENMAP, "PreThinkFrame");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case PS_POSTTHINKFRAME:
|
||||||
{
|
{
|
||||||
maxpage = postthinkframe_hooks_length/PAGE_ENTRIES + 1;
|
maxpage = postthinkframe_hooks_length/PAGE_ENTRIES + 1;
|
||||||
page = max(1, min(cv_ps_thinkframe_page.value, maxpage));
|
page = max(1, min(cv_ps_thinkframe_page.value, maxpage));
|
||||||
@@ -975,7 +946,22 @@ static void draw_think_frame_stats(int hook_length, ps_hookinfo_t *hook)
|
|||||||
|
|
||||||
void PS_ThinkFrame_Page_OnChange(void)
|
void PS_ThinkFrame_Page_OnChange(void)
|
||||||
{
|
{
|
||||||
int maxpage = thinkframe_hooks_length/PAGE_ENTRIES + 1;
|
int maxpage = 0;
|
||||||
|
|
||||||
|
switch (cv_perfstats.value)
|
||||||
|
{
|
||||||
|
case PS_THINKFRAME:
|
||||||
|
maxpage = thinkframe_hooks_length/PAGE_ENTRIES + 1;
|
||||||
|
break;
|
||||||
|
case PS_PRETHINKFRAME:
|
||||||
|
maxpage = prethinkframe_hooks_length/PAGE_ENTRIES + 1;
|
||||||
|
break;
|
||||||
|
case PS_POSTTHINKFRAME:
|
||||||
|
maxpage = postthinkframe_hooks_length/PAGE_ENTRIES + 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (cv_ps_thinkframe_page.value > maxpage)
|
if (cv_ps_thinkframe_page.value > maxpage)
|
||||||
CV_StealthSetValue(&cv_ps_thinkframe_page, maxpage);
|
CV_StealthSetValue(&cv_ps_thinkframe_page, maxpage);
|
||||||
@@ -1008,18 +994,18 @@ static void PS_DrawPostThinkFrameStats(void)
|
|||||||
|
|
||||||
void M_DrawPerfStats(void)
|
void M_DrawPerfStats(void)
|
||||||
{
|
{
|
||||||
if (cv_perfstats.value == 1) // rendering
|
if (cv_perfstats.value == PS_RENDER) // rendering
|
||||||
{
|
{
|
||||||
PS_UpdateFrameStats();
|
PS_UpdateFrameStats();
|
||||||
PS_DrawRenderStats();
|
PS_DrawRenderStats();
|
||||||
}
|
}
|
||||||
else if (cv_perfstats.value == 2) // logic
|
else if (cv_perfstats.value == PS_LOGIC) // logic
|
||||||
{
|
{
|
||||||
// PS_UpdateTickStats is called in TryRunTics, since otherwise it would miss
|
// PS_UpdateTickStats is called in TryRunTics, since otherwise it would miss
|
||||||
// tics when frame skips happen
|
// tics when frame skips happen
|
||||||
PS_DrawGameLogicStats();
|
PS_DrawGameLogicStats();
|
||||||
}
|
}
|
||||||
else if (cv_perfstats.value >= 3) // lua thinkframe
|
else if (cv_perfstats.value >= PS_THINKFRAME) // lua thinkframe
|
||||||
{
|
{
|
||||||
if (!PS_IsLevelActive())
|
if (!PS_IsLevelActive())
|
||||||
return;
|
return;
|
||||||
@@ -1036,13 +1022,13 @@ void M_DrawPerfStats(void)
|
|||||||
|
|
||||||
switch (cv_perfstats.value)
|
switch (cv_perfstats.value)
|
||||||
{
|
{
|
||||||
case 3:
|
case PS_THINKFRAME:
|
||||||
PS_DrawThinkFrameStats();
|
PS_DrawThinkFrameStats();
|
||||||
break;
|
break;
|
||||||
case 4:
|
case PS_PRETHINKFRAME:
|
||||||
PS_DrawPreThinkFrameStats();
|
PS_DrawPreThinkFrameStats();
|
||||||
break;
|
break;
|
||||||
case 5:
|
case PS_POSTTHINKFRAME:
|
||||||
PS_DrawPostThinkFrameStats();
|
PS_DrawPostThinkFrameStats();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -26,6 +26,16 @@ typedef struct
|
|||||||
void *history;
|
void *history;
|
||||||
} ps_metric_t;
|
} ps_metric_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
PS_OFF = 0,
|
||||||
|
PS_RENDER,
|
||||||
|
PS_LOGIC,
|
||||||
|
PS_THINKFRAME,
|
||||||
|
PS_PRETHINKFRAME,
|
||||||
|
PS_POSTTHINKFRAME
|
||||||
|
} ps_types_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
ps_metric_t time_taken;
|
ps_metric_t time_taken;
|
||||||
@@ -36,6 +46,7 @@ typedef struct
|
|||||||
#define PS_STOP_TIMING(metric) metric.value.p = I_GetPreciseTime() - metric.value.p
|
#define PS_STOP_TIMING(metric) metric.value.p = I_GetPreciseTime() - metric.value.p
|
||||||
|
|
||||||
extern ps_metric_t ps_tictime;
|
extern ps_metric_t ps_tictime;
|
||||||
|
extern ps_metric_t ps_prevtictime;
|
||||||
|
|
||||||
extern ps_metric_t ps_playerthink_time;
|
extern ps_metric_t ps_playerthink_time;
|
||||||
extern ps_metric_t ps_thinkertime;
|
extern ps_metric_t ps_thinkertime;
|
||||||
|
|||||||
+46
-35
@@ -2573,7 +2573,7 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||||||
P_SetPlayerMobjState(mo, S_KART_STND1);
|
P_SetPlayerMobjState(mo, S_KART_STND1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 // praying that removing this dupe wont cause any issues...
|
#if 1 // praying that removing this dupe wont cause any issues...
|
||||||
if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope))
|
if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope))
|
||||||
{
|
{
|
||||||
// Handle landing on slope during Z movement
|
// Handle landing on slope during Z movement
|
||||||
@@ -9150,15 +9150,17 @@ void P_MobjThinker(mobj_t *mobj)
|
|||||||
|
|
||||||
tmfloorthing = tmhitthing = NULL;
|
tmfloorthing = tmhitthing = NULL;
|
||||||
|
|
||||||
const sector_t *sec1 = mobj->subsector ? mobj->subsector->sector : NULL;
|
// do NOT trigger linedef executors for "local" mobjs
|
||||||
|
if (!mobj->islocal)
|
||||||
// 970 allows ANY mobj to trigger a linedef exec
|
|
||||||
if (!mobj->islocal && sec1 && GETSECSPECIAL(sec1->special, 2) == 8) // BEWARE: islocal does not exist in vanilla
|
|
||||||
{
|
{
|
||||||
sector_t *sec2;
|
// 970 allows ANY mobj to trigger a linedef exec
|
||||||
sec2 = P_ThingOnSpecial3DFloor(mobj);
|
if (mobj->subsector && GETSECSPECIAL(mobj->subsector->sector->special, 2) == 8)
|
||||||
if (sec2 && GETSECSPECIAL(sec2->special, 2) == 1)
|
{
|
||||||
P_LinedefExecute(sec2->tag, mobj, sec2);
|
sector_t *sec2;
|
||||||
|
sec2 = P_ThingOnSpecial3DFloor(mobj);
|
||||||
|
if (sec2 && GETSECSPECIAL(sec2->special, 2) == 1)
|
||||||
|
P_LinedefExecute(sec2->tag, mobj, sec2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mobj->scale != mobj->destscale)
|
if (mobj->scale != mobj->destscale)
|
||||||
@@ -9170,7 +9172,7 @@ void P_MobjThinker(mobj_t *mobj)
|
|||||||
mobj->frame = (mobj->frame & ~FF_TRANSMASK) | (((NUMTRANSMAPS-1) - mobj->fuse / 2) << FF_TRANSSHIFT);
|
mobj->frame = (mobj->frame & ~FF_TRANSMASK) | (((NUMTRANSMAPS-1) - mobj->fuse / 2) << FF_TRANSSHIFT);
|
||||||
|
|
||||||
// Special thinker for scenery objects
|
// Special thinker for scenery objects
|
||||||
if (mobj->flags & MF_SCENERY)
|
if (mobj->flags & MF_SCENERY && !mobj->player)
|
||||||
{
|
{
|
||||||
P_MobjSceneryThink(mobj);
|
P_MobjSceneryThink(mobj);
|
||||||
return;
|
return;
|
||||||
@@ -9262,7 +9264,8 @@ void P_MobjThinker(mobj_t *mobj)
|
|||||||
mobj->eflags &= ~MFE_JUSTHITFLOOR;
|
mobj->eflags &= ~MFE_JUSTHITFLOOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mobj->type == MT_FALLINGROCK
|
// Sliding physics for slidey mobjs!
|
||||||
|
if ( mobj->type == MT_FALLINGROCK
|
||||||
|| mobj->type == MT_LITTLETUMBLEWEED
|
|| mobj->type == MT_LITTLETUMBLEWEED
|
||||||
|| mobj->type == MT_BIGTUMBLEWEED
|
|| mobj->type == MT_BIGTUMBLEWEED
|
||||||
|| mobj->type == MT_FLINGRING
|
|| mobj->type == MT_FLINGRING
|
||||||
@@ -9307,21 +9310,24 @@ void P_MobjThinker(mobj_t *mobj)
|
|||||||
if (P_MobjWasRemoved(mobj))
|
if (P_MobjWasRemoved(mobj))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (P_WeaponOrPanel(mobj->type))
|
if ((mobj->health == 0) && // Fading tile
|
||||||
|
(mobj->type == MT_BOUNCEPICKUP
|
||||||
|
|| mobj->type == MT_RAILPICKUP
|
||||||
|
|| mobj->type == MT_AUTOPICKUP
|
||||||
|
|| mobj->type == MT_EXPLODEPICKUP
|
||||||
|
|| mobj->type == MT_SCATTERPICKUP
|
||||||
|
|| mobj->type == MT_GRENADEPICKUP))
|
||||||
{
|
{
|
||||||
if (mobj->health == 0) // Fading tile
|
INT32 value = mobj->info->damage/10;
|
||||||
{
|
value = mobj->fuse/value;
|
||||||
INT32 value = mobj->info->damage/10;
|
value = 10-value;
|
||||||
value = mobj->fuse/value;
|
value--;
|
||||||
value = 10-value;
|
|
||||||
value--;
|
|
||||||
|
|
||||||
if (value <= 0)
|
if (value <= 0)
|
||||||
value = 1;
|
value = 1;
|
||||||
|
|
||||||
mobj->frame &= ~FF_TRANSMASK;
|
mobj->frame &= ~FF_TRANSMASK;
|
||||||
mobj->frame |= value << FF_TRANSSHIFT;
|
mobj->frame |= value << FF_TRANSSHIFT;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9358,25 +9364,29 @@ void P_PushableThinker(mobj_t *mobj)
|
|||||||
|
|
||||||
I_Assert(!P_MobjWasRemoved(mobj));
|
I_Assert(!P_MobjWasRemoved(mobj));
|
||||||
|
|
||||||
if (P_MobjWasRemovedCompat(mobj))
|
// do NOT trigger linedef executors for "local" mobjs
|
||||||
return;
|
if (!mobj->islocal)
|
||||||
|
|
||||||
sec = mobj->subsector->sector;
|
|
||||||
|
|
||||||
if (mobj->z == sec->floorheight && GETSECSPECIAL(sec->special, 2) == 1)
|
|
||||||
P_LinedefExecute(sec->tag, mobj, sec);
|
|
||||||
{
|
{
|
||||||
sector_t *sec2;
|
sec = mobj->subsector->sector;
|
||||||
|
|
||||||
sec2 = P_ThingOnSpecial3DFloor(mobj);
|
if (mobj->z == sec->floorheight && GETSECSPECIAL(sec->special, 2) == 1)
|
||||||
if (sec2 && GETSECSPECIAL(sec2->special, 2) == 1)
|
P_LinedefExecute(sec->tag, mobj, sec);
|
||||||
P_LinedefExecute(sec2->tag, mobj, sec2);
|
{
|
||||||
|
sector_t *sec2;
|
||||||
|
|
||||||
|
sec2 = P_ThingOnSpecial3DFloor(mobj);
|
||||||
|
if (sec2 && GETSECSPECIAL(sec2->special, 2) == 1)
|
||||||
|
P_LinedefExecute(sec2->tag, mobj, sec2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// it has to be pushable RIGHT NOW for this part to happen
|
// it has to be pushable RIGHT NOW for this part to happen
|
||||||
if (mobj->flags & MF_PUSHABLE && !(mobj->momx || mobj->momy))
|
if (mobj->flags & MF_PUSHABLE && !(mobj->momx || mobj->momy))
|
||||||
P_TryMove(mobj, mobj->x, mobj->y, true);
|
P_TryMove(mobj, mobj->x, mobj->y, true);
|
||||||
|
|
||||||
|
if (P_MobjWasRemovedCompat(mobj))
|
||||||
|
return;
|
||||||
|
|
||||||
if (mobj->fuse == 1) // it would explode in the MobjThinker code
|
if (mobj->fuse == 1) // it would explode in the MobjThinker code
|
||||||
{
|
{
|
||||||
mobj_t *spawnmo;
|
mobj_t *spawnmo;
|
||||||
@@ -9402,7 +9412,8 @@ void P_PushableThinker(mobj_t *mobj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
spawnmo = P_SpawnMobj(x, y, z, mobj->type);
|
spawnmo = P_SpawnMobj(x, y, z, mobj->type);
|
||||||
if (spawnmo)
|
|
||||||
|
if (!P_MobjWasRemovedCompat(spawnmo))
|
||||||
{
|
{
|
||||||
spawnmo->spawnpoint = mobj->spawnpoint;
|
spawnmo->spawnpoint = mobj->spawnpoint;
|
||||||
P_UnsetThingPosition(spawnmo);
|
P_UnsetThingPosition(spawnmo);
|
||||||
|
|||||||
+79
-67
@@ -318,15 +318,15 @@ void P_AllocMapHeader(INT16 i)
|
|||||||
// Loads the vertexes for a level.
|
// Loads the vertexes for a level.
|
||||||
FUNCINLINE static ATTRINLINE void P_LoadVertices(UINT8 *data)
|
FUNCINLINE static ATTRINLINE void P_LoadVertices(UINT8 *data)
|
||||||
{
|
{
|
||||||
mapvertex_t *ml = (mapvertex_t *)data;
|
mapvertex_t *mv = (mapvertex_t *)data;
|
||||||
vertex_t *li = vertexes;
|
vertex_t *v = vertexes;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
// Copy and convert vertex coordinates, internal representation as fixed.
|
// Copy and convert vertex coordinates, internal representation as fixed.
|
||||||
for (i = 0; i < numvertexes; i++, li++, ml++)
|
for (i = 0; i < numvertexes; i++, v++, mv++)
|
||||||
{
|
{
|
||||||
li->x = SHORT(ml->x)<<FRACBITS;
|
v->x = SHORT(mv->x)<<FRACBITS;
|
||||||
li->y = SHORT(ml->y)<<FRACBITS;
|
v->y = SHORT(mv->y)<<FRACBITS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -479,65 +479,30 @@ static void P_SetupDirectionalLight(void)
|
|||||||
static void P_LoadSegs(UINT8 *data)
|
static void P_LoadSegs(UINT8 *data)
|
||||||
{
|
{
|
||||||
INT32 rawlinedef, rawside;
|
INT32 rawlinedef, rawside;
|
||||||
mapseg_t *ml = (mapseg_t*)data;
|
mapseg_t *ms = (mapseg_t*)data;
|
||||||
seg_t *li = segs;
|
seg_t *seg = segs;
|
||||||
line_t *ldef;
|
line_t *ldef;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
// Set map lighting settings.
|
// Set map lighting settings.
|
||||||
P_SetupDirectionalLight();
|
P_SetupDirectionalLight();
|
||||||
|
|
||||||
for (i = 0; i < numsegs; i++, li++, ml++)
|
for (i = 0; i < numsegs; i++, seg++, ms++)
|
||||||
{
|
{
|
||||||
INT16 v1, v2;
|
INT16 v1, v2;
|
||||||
|
|
||||||
v1 = SHORT(ml->v1);
|
v1 = SHORT(ms->v1);
|
||||||
v2 = SHORT(ml->v2);
|
v2 = SHORT(ms->v2);
|
||||||
|
|
||||||
// e6y
|
// e6y
|
||||||
// check and fix wrong references to non-existent vertexes
|
// moved down for additional checks to avoid overflow
|
||||||
// see e1m9 @ NIVELES.WAD
|
// if wrong vertexe's indexes are in SEGS lump
|
||||||
// http://www.doomworld.com/idgames/index.php?id=12647
|
// see below for more detailed information
|
||||||
if ((unsigned)v1 >= numvertexes || (unsigned)v2 >= numvertexes)
|
|
||||||
{
|
|
||||||
if ((unsigned)v1 >= numvertexes)
|
|
||||||
CorruptMapWarning(va("P_LoadSegs: seg %s references a non-existent vertex %d\n", sizeu1(i), v1));
|
|
||||||
if ((unsigned)v2 >= numvertexes)
|
|
||||||
CorruptMapWarning(va("P_LoadSegs: seg %s references a non-existent vertex %d\n", sizeu1(i), v2));
|
|
||||||
|
|
||||||
if (li->sidedef == &sides[li->linedef->sidenum[0]])
|
seg->angle = (SHORT(ms->angle)) << FRACBITS;
|
||||||
{
|
seg->offset = (SHORT(ms->offset)) << FRACBITS;
|
||||||
li->v1 = lines[ml->linedef].v1;
|
|
||||||
li->v2 = lines[ml->linedef].v2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
li->v1 = lines[ml->linedef].v2;
|
|
||||||
li->v2 = lines[ml->linedef].v1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
li->v1 = &vertexes[v1];
|
|
||||||
li->v2 = &vertexes[v2];
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HWRENDER
|
rawlinedef = SHORT(ms->linedef);
|
||||||
if (rendermode == render_opengl)
|
|
||||||
{
|
|
||||||
li->fv1.x = FixedToFloat(li->v1->x);
|
|
||||||
li->fv1.y = FixedToFloat(li->v1->y);
|
|
||||||
//li->fv1.z = FixedToFloat(li->v1->z); // z is unused in gl
|
|
||||||
|
|
||||||
li->fv2.x = FixedToFloat(li->v2->x);
|
|
||||||
li->fv2.y = FixedToFloat(li->v2->y);
|
|
||||||
//li->fv2.z = FixedToFloat(li->v2->z);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
li->length = P_SegLength(li);
|
|
||||||
li->angle = (SHORT(ml->angle))<<FRACBITS;
|
|
||||||
li->offset = (SHORT(ml->offset))<<FRACBITS;
|
|
||||||
rawlinedef = SHORT(ml->linedef);
|
|
||||||
|
|
||||||
//e6y: check for wrong indexes
|
//e6y: check for wrong indexes
|
||||||
if ((unsigned)rawlinedef >= numlines)
|
if ((unsigned)rawlinedef >= numlines)
|
||||||
@@ -546,8 +511,8 @@ static void P_LoadSegs(UINT8 *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ldef = &lines[rawlinedef];
|
ldef = &lines[rawlinedef];
|
||||||
li->linedef = ldef;
|
seg->linedef = ldef;
|
||||||
rawside = SHORT(ml->side);
|
rawside = SHORT(ms->side);
|
||||||
|
|
||||||
//e6y: fix wrong side index
|
//e6y: fix wrong side index
|
||||||
if (rawside != 0 && rawside != 1)
|
if (rawside != 0 && rawside != 1)
|
||||||
@@ -562,9 +527,9 @@ static void P_LoadSegs(UINT8 *data)
|
|||||||
I_Error("P_LoadSegs: linedef %d for seg %s references a non-existent sidedef %d", rawlinedef, sizeu1(i), ldef->sidenum[rawside]);
|
I_Error("P_LoadSegs: linedef %d for seg %s references a non-existent sidedef %d", rawlinedef, sizeu1(i), ldef->sidenum[rawside]);
|
||||||
}
|
}
|
||||||
|
|
||||||
li->side = rawside;
|
seg->side = rawside;
|
||||||
|
|
||||||
li->sidedef = &sides[ldef->sidenum[rawside]];
|
seg->sidedef = &sides[ldef->sidenum[rawside]];
|
||||||
|
|
||||||
/* cph 2006/09/30 - our frontsector can be the second side of the
|
/* cph 2006/09/30 - our frontsector can be the second side of the
|
||||||
* linedef, so must check for NO_INDEX in case we are incorrectly
|
* linedef, so must check for NO_INDEX in case we are incorrectly
|
||||||
@@ -572,11 +537,11 @@ static void P_LoadSegs(UINT8 *data)
|
|||||||
if (ldef->sidenum[rawside] == NO_INDEX)
|
if (ldef->sidenum[rawside] == NO_INDEX)
|
||||||
{
|
{
|
||||||
CorruptMapWarning(va("P_LoadSegs: front of seg %s has no sidedef\n", sizeu1(i)));
|
CorruptMapWarning(va("P_LoadSegs: front of seg %s has no sidedef\n", sizeu1(i)));
|
||||||
li->frontsector = NULL;
|
seg->frontsector = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
li->frontsector = sides[ldef->sidenum[rawside]].sector;
|
seg->frontsector = sides[ldef->sidenum[rawside]].sector;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ldef->flags & ML_TWOSIDED)
|
if (ldef->flags & ML_TWOSIDED)
|
||||||
@@ -584,15 +549,58 @@ static void P_LoadSegs(UINT8 *data)
|
|||||||
if (ldef->sidenum[rawside^1] == NO_INDEX)
|
if (ldef->sidenum[rawside^1] == NO_INDEX)
|
||||||
{
|
{
|
||||||
CorruptMapWarning(va("P_LoadSegs: back of seg %s has no sidedef while being marked as double sided\n", sizeu1(i)));
|
CorruptMapWarning(va("P_LoadSegs: back of seg %s has no sidedef while being marked as double sided\n", sizeu1(i)));
|
||||||
li->backsector = NULL;
|
seg->backsector = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
li->backsector = sides[ldef->sidenum[rawside^1]].sector;
|
seg->backsector = sides[ldef->sidenum[rawside^1]].sector;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
P_UpdateSegLightOffset(li);
|
// e6y
|
||||||
|
// check and fix wrong references to non-existent vertexes
|
||||||
|
// see e1m9 @ NIVELES.WAD
|
||||||
|
// http://www.doomworld.com/idgames/index.php?id=12647
|
||||||
|
if ((unsigned)v1 >= numvertexes || (unsigned)v2 >= numvertexes)
|
||||||
|
{
|
||||||
|
if ((unsigned)v1 >= numvertexes)
|
||||||
|
CorruptMapWarning(va("P_LoadSegs: seg %s references a non-existent vertex %d\n", sizeu1(i), v1));
|
||||||
|
if ((unsigned)v2 >= numvertexes)
|
||||||
|
CorruptMapWarning(va("P_LoadSegs: seg %s references a non-existent vertex %d\n", sizeu1(i), v2));
|
||||||
|
|
||||||
|
if (seg->sidedef == &sides[seg->linedef->sidenum[0]])
|
||||||
|
{
|
||||||
|
seg->v1 = lines[ms->linedef].v1;
|
||||||
|
seg->v2 = lines[ms->linedef].v2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
seg->v1 = lines[ms->linedef].v2;
|
||||||
|
seg->v2 = lines[ms->linedef].v1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
seg->v1 = &vertexes[v1];
|
||||||
|
seg->v2 = &vertexes[v2];
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HWRENDER
|
||||||
|
if (rendermode == render_opengl)
|
||||||
|
{
|
||||||
|
seg->fv1.x = FixedToFloat(seg->v1->x);
|
||||||
|
seg->fv1.y = FixedToFloat(seg->v1->y);
|
||||||
|
//seg->fv1.z = FixedToFloat(seg->v1->z); // z is unused in gl
|
||||||
|
|
||||||
|
seg->fv2.x = FixedToFloat(seg->v2->x);
|
||||||
|
seg->fv2.y = FixedToFloat(seg->v2->y);
|
||||||
|
//seg->fv2.z = FixedToFloat(seg->v2->z);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
seg->length = P_SegLength(seg);
|
||||||
|
|
||||||
|
P_UpdateSegLightOffset(seg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -610,10 +618,6 @@ FUNCINLINE static ATTRINLINE void P_LoadSubsectors(void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// P_LoadSectors
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// levelflats
|
// levelflats
|
||||||
//
|
//
|
||||||
@@ -665,13 +669,17 @@ static void P_CheckCyanFlat(levelflat_t *levelflat)
|
|||||||
const char *flatname = W_CheckNameForNum(levelflat->lumpnum);
|
const char *flatname = W_CheckNameForNum(levelflat->lumpnum);
|
||||||
|
|
||||||
// hack for gba rainbow roads cyan floors
|
// hack for gba rainbow roads cyan floors
|
||||||
if (UNLIKELY(memcmp(flatname, "GBA_RRF5", 8) == 0 && flatname[8] == 0))
|
if (UNLIKELY(flatname && memcmp(flatname, "GBA_RRF5", 8) == 0 && flatname[8] == 0))
|
||||||
{
|
{
|
||||||
levelflat->cyan = false;
|
levelflat->cyan = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const UINT8 *flat = R_GetFlat(levelflat->lumpnum);
|
const UINT8 *flat = R_GetFlat(levelflat->lumpnum);
|
||||||
|
|
||||||
|
if (!flat)
|
||||||
|
return;
|
||||||
|
|
||||||
const size_t size = W_LumpLength(levelflat->lumpnum);
|
const size_t size = W_LumpLength(levelflat->lumpnum);
|
||||||
|
|
||||||
for (size_t steppy = 0; steppy < size; steppy++)
|
for (size_t steppy = 0; steppy < size; steppy++)
|
||||||
@@ -791,6 +799,10 @@ INT32 P_CheckLevelFlat(const char *flatname)
|
|||||||
return (INT32)i;
|
return (INT32)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// P_LoadSectors
|
||||||
|
//
|
||||||
|
|
||||||
static const sector_t sector_default = {
|
static const sector_t sector_default = {
|
||||||
.nexttag = -1,
|
.nexttag = -1,
|
||||||
.firsttag = -1,
|
.firsttag = -1,
|
||||||
@@ -1894,7 +1906,7 @@ static void P_ReadBlockMapLump(INT16 *wadblockmaplump, size_t count)
|
|||||||
// because making both the WAD and PK3 loading code use
|
// because making both the WAD and PK3 loading code use
|
||||||
// the same functions is trickier than it looks for blockmap
|
// the same functions is trickier than it looks for blockmap
|
||||||
// -- Monster Iestyn 09/01/18
|
// -- Monster Iestyn 09/01/18
|
||||||
static boolean P_LoadRawBlockMap(UINT8 *data, size_t count)
|
static boolean P_LoadBlockMap(UINT8 *data, size_t count)
|
||||||
{
|
{
|
||||||
if (!count || count >= 0x20000)
|
if (!count || count >= 0x20000)
|
||||||
return false;
|
return false;
|
||||||
@@ -2120,7 +2132,7 @@ static void P_LoadMapLUT(const virtres_t* virt)
|
|||||||
rejectmatrix = NULL;
|
rejectmatrix = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(virtblockmap && P_LoadRawBlockMap(virtblockmap->data, virtblockmap->size)))
|
if (!(virtblockmap && P_LoadBlockMap(virtblockmap->data, virtblockmap->size)))
|
||||||
P_CreateBlockMap();
|
P_CreateBlockMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -38,6 +38,8 @@
|
|||||||
#include "i_video.h" // rendermode
|
#include "i_video.h" // rendermode
|
||||||
#include "m_perfstats.h"
|
#include "m_perfstats.h"
|
||||||
|
|
||||||
|
#include "lua_profile.h"
|
||||||
|
|
||||||
// Object place
|
// Object place
|
||||||
#include "m_cheat.h"
|
#include "m_cheat.h"
|
||||||
|
|
||||||
@@ -622,6 +624,8 @@ void P_Ticker(boolean run)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LUA_ResetTicTimers();
|
||||||
|
|
||||||
ps_lua_mobjhooks.value.i = 0;
|
ps_lua_mobjhooks.value.i = 0;
|
||||||
ps_checkposition_calls.value.i = 0;
|
ps_checkposition_calls.value.i = 0;
|
||||||
|
|
||||||
@@ -629,6 +633,7 @@ void P_Ticker(boolean run)
|
|||||||
LUA_HookPreThinkFrame();
|
LUA_HookPreThinkFrame();
|
||||||
PS_STOP_TIMING(ps_lua_prethinkframe_time);
|
PS_STOP_TIMING(ps_lua_prethinkframe_time);
|
||||||
|
|
||||||
|
// OK! Now that we got all of that sorted, players can think!
|
||||||
PS_START_TIMING(ps_playerthink_time);
|
PS_START_TIMING(ps_playerthink_time);
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
@@ -675,6 +680,7 @@ void P_Ticker(boolean run)
|
|||||||
PS_STOP_TIMING(ps_lua_thinkframe_time);
|
PS_STOP_TIMING(ps_lua_thinkframe_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run shield positioning
|
||||||
P_RunOverlays();
|
P_RunOverlays();
|
||||||
P_RunShadows();
|
P_RunShadows();
|
||||||
|
|
||||||
@@ -796,7 +802,7 @@ void P_Ticker(boolean run)
|
|||||||
if (!player->mo)
|
if (!player->mo)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
|
const boolean skybox = (skyboxmo[0] && cv_skybox.value); // True if there's a skybox object and skyboxes are on
|
||||||
|
|
||||||
if (skyVisiblePerPlayer[i] && skybox)
|
if (skyVisiblePerPlayer[i] && skybox)
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-8
@@ -340,18 +340,14 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const boolean doreset = mobj->resetinterp && (mobj->type != MT_GHOST) && (mobj->type != MT_PLAYERRETICULE) && (mobj->type != MT_SHADOW);
|
out->x = R_LerpFixed(mobj->old_x, mobj->x, frac);
|
||||||
|
out->y = R_LerpFixed(mobj->old_y, mobj->y, frac);
|
||||||
out->x = doreset ? mobj->x : R_LerpFixed(mobj->old_x, mobj->x, frac);
|
out->z = R_LerpFixed(mobj->old_z, mobj->z, frac);
|
||||||
out->y = doreset ? mobj->y : R_LerpFixed(mobj->old_y, mobj->y, frac);
|
|
||||||
out->z = doreset ? mobj->z : R_LerpFixed(mobj->old_z, mobj->z, frac);
|
|
||||||
|
|
||||||
out->scale = mobj->resetinterp ? mobj->scale : R_LerpFixed(mobj->old_scale, mobj->scale, frac);
|
|
||||||
out->spritexscale = mobj->resetinterp ? mobj->spritexscale : R_LerpFixed(mobj->old_spritexscale, mobj->spritexscale, frac);
|
out->spritexscale = mobj->resetinterp ? mobj->spritexscale : R_LerpFixed(mobj->old_spritexscale, mobj->spritexscale, frac);
|
||||||
out->spriteyscale = mobj->resetinterp ? mobj->spriteyscale : R_LerpFixed(mobj->old_spriteyscale, mobj->spriteyscale, frac);
|
out->spriteyscale = mobj->resetinterp ? mobj->spriteyscale : R_LerpFixed(mobj->old_spriteyscale, mobj->spriteyscale, frac);
|
||||||
out->spritexoffset = mobj->resetinterp ? mobj->spritexoffset : R_LerpFixed(mobj->old_spritexoffset, mobj->spritexoffset, frac);
|
out->spritexoffset = mobj->resetinterp ? mobj->spritexoffset : R_LerpFixed(mobj->old_spritexoffset, mobj->spritexoffset, frac);
|
||||||
out->spriteyoffset = mobj->resetinterp ? mobj->spriteyoffset : R_LerpFixed(mobj->old_spriteyoffset, mobj->spriteyoffset, frac);
|
out->spriteyoffset = mobj->resetinterp ? mobj->spriteyoffset : R_LerpFixed(mobj->old_spriteyoffset, mobj->spriteyoffset, frac);
|
||||||
|
out->scale = mobj->resetinterp ? mobj->scale : R_LerpFixed(mobj->old_scale, mobj->scale, frac);
|
||||||
//out->subsector = R_PointInSubsector(out->x, out->y); // this is unused
|
//out->subsector = R_PointInSubsector(out->x, out->y); // this is unused
|
||||||
|
|
||||||
if (mobj->player)
|
if (mobj->player)
|
||||||
|
|||||||
+1
-1
@@ -1882,7 +1882,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
|
|
||||||
// big room fix
|
// big room fix
|
||||||
if (longboi)
|
if (longboi)
|
||||||
rw_distance = (fixed_t)R_CalcSegDist(curline,viewx,viewy);
|
rw_distance = (fixed_t)R_CalcSegDist(curline, viewx, viewy);
|
||||||
|
|
||||||
ds_p->x1 = rw_x = start;
|
ds_p->x1 = rw_x = start;
|
||||||
ds_p->x2 = stop;
|
ds_p->x2 = stop;
|
||||||
|
|||||||
@@ -243,6 +243,10 @@ if(${SDL2_FOUND})
|
|||||||
target_link_options(SRB2SDL2 PRIVATE -fsanitize=undefined)
|
target_link_options(SRB2SDL2 PRIVATE -fsanitize=undefined)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT SRB2_CONFIG_MUMBLE)
|
||||||
|
target_compile_options(SRB2SDL2 PRIVATE -DNOMUMBLE)
|
||||||
|
endif()
|
||||||
|
|
||||||
## strip debug symbols into separate file when using gcc
|
## strip debug symbols into separate file when using gcc
|
||||||
# if(CMAKE_COMPILER_IS_GNUCC)
|
# if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
# if(${CMAKE_BUILD_TYPE} MATCHES Debug)
|
# if(${CMAKE_BUILD_TYPE} MATCHES Debug)
|
||||||
|
|||||||
@@ -1405,7 +1405,11 @@ void I_SleepDuration(precise_t duration)
|
|||||||
duration -= slack;
|
duration -= slack;
|
||||||
struct timespec ts = {
|
struct timespec ts = {
|
||||||
.tv_sec = static_cast<__time_t>(duration / precision),
|
.tv_sec = static_cast<__time_t>(duration / precision),
|
||||||
|
#ifdef __BIONIC__
|
||||||
|
.tv_nsec = static_cast<long>(duration * 1000000000 / precision % 1000000000),
|
||||||
|
#else
|
||||||
.tv_nsec = static_cast<__syscall_slong_t>(duration * 1000000000 / precision % 1000000000),
|
.tv_nsec = static_cast<__syscall_slong_t>(duration * 1000000000 / precision % 1000000000),
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
int status;
|
int status;
|
||||||
do status = clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts);
|
do status = clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts);
|
||||||
|
|||||||
+14
-7
@@ -581,13 +581,19 @@ const char *GetPalette(void)
|
|||||||
|
|
||||||
if (user && user[0])
|
if (user && user[0])
|
||||||
{
|
{
|
||||||
if (W_CheckNumForName(user) == LUMPERROR)
|
const lumpnum_t palnum = W_CheckNumForName(user);
|
||||||
|
|
||||||
|
if (palnum == LUMPERROR)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_WARNING, "cv_palette %s lump does not exist\n", user);
|
CONS_Alert(CONS_WARNING, "cv_palette %s lump does not exist\n", user);
|
||||||
}
|
}
|
||||||
|
else if (W_LumpLength(palnum) % (256 * 3) != 0) // not divisable by 768, so most def not a valid palette, idk if theres a better way to check this
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_WARNING, "cv_palette %s is not a valid palette lump\n", user);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return cv_palette.string;
|
return user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -609,15 +615,16 @@ void V_ReloadPalette(void)
|
|||||||
void V_SetPalette(INT32 palettenum)
|
void V_SetPalette(INT32 palettenum)
|
||||||
{
|
{
|
||||||
RGBA_t *pal = NULL;
|
RGBA_t *pal = NULL;
|
||||||
|
|
||||||
if (!pLocalPalette)
|
if (!pLocalPalette)
|
||||||
V_ReloadPalette();
|
V_ReloadPalette();
|
||||||
|
|
||||||
#ifdef HWRENDER
|
if (palettenum == 0)
|
||||||
if (rendermode == render_soft ||
|
|
||||||
(rendermode == render_opengl && HWR_ShouldUsePaletteRendering())) // opengl without paletterendering hates subpalettes
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (palettenum == 0)
|
#ifdef HWRENDER
|
||||||
|
if (rendermode == render_soft ||
|
||||||
|
(rendermode == render_opengl && HWR_ShouldUsePaletteRendering())) // opengl without paletterendering hates subpalettes
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
palettenum = cv_palettenum.value;
|
palettenum = cv_palettenum.value;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user