Skip to content

Commit

Permalink
Don't display the scoreboard during singleplayer intermission
Browse files Browse the repository at this point in the history
  • Loading branch information
camgunz committed Dec 17, 2016
1 parent e744494 commit 4b116af
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# To Do

Multiplayer scoreboard shows during singleplayer intermission
Fix netcode when more than 1 player

Next map doesn't load in singleplayer

Expand Down
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

BASE_DIR="$(pwd)"

CMD="${BASE_DIR}/cbuild/d2k -skill 5 -warp 1 -nomonsters -nomouse"
CMD="${BASE_DIR}/cbuild/d2k -iwad doom2.wad -playdemo DEMO3 -nomouse"
CMD="${BASE_DIR}/cbuild/d2k -iwad freedm.wad -skill 5 -warp 1 -nomonsters -nomouse -deathmatch -frags 50 -timer 10"
CMD="${BASE_DIR}/cbuild/d2k -iwad doom2.wad -file gothicdm.wad -playdemo DEMO1 -dumpdemo d2kdump.bin"
CMD="${BASE_DIR}/cbuild/d2k -iwad doom2.wad -file dwango5.wad -skill 5 -warp 1 -nomonsters -nomouse -deathmatch -frags 50 -timer 10"
CMD="${BASE_DIR}/cbuild/d2k -skill 5 -warp 1 -nomonsters -nomouse"

mkdir -p ~/.d2k/scripts
mkdir -p ~/.d2k/fonts
Expand Down
10 changes: 3 additions & 7 deletions scripts/local_hud_widgets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,9 @@ local scoreboard_widget = ContainerWidget.ContainerWidget({
})

function scoreboard_widget:is_active()
local active = ContainerWidget.ContainerWidget.is_active(self)

if not active then
active = d2k.Game.in_intermission()
end

return active
return ContainerWidget.ContainerWidget.is_active(self) or (
d2k.Game.is_multiplayer() and d2k.Game.in_intermission()
)
end

function scoreboard_widget:render()
Expand Down
14 changes: 13 additions & 1 deletion src/xg_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ static int XG_GameGetGameMode(lua_State *L) {
return 1;
}

static int XG_GameIsMultiplayer(lua_State *L) {
if (deathmatch || MULTINET) {
lua_pushboolean(L, true);
}
else {
lua_pushboolean(L, false);
}

return 1;
}

static int XG_GameGetFragLimit(lua_State *L) {
if (deathmatch) {
lua_pushinteger(L, levelFragLimitCount);
Expand Down Expand Up @@ -226,7 +237,7 @@ static int XG_GameInDemoScreen(lua_State *L) {
}

void XG_GameRegisterInterface(void) {
X_RegisterObjects("Game", 15,
X_RegisterObjects("Game", 16,
"tick", X_FUNCTION, XG_GameTick,
"render", X_FUNCTION, XG_GameRender,
"in_level", X_FUNCTION, XG_GameInLevel,
Expand All @@ -236,6 +247,7 @@ void XG_GameRegisterInterface(void) {
"handle_event", X_FUNCTION, XG_GameHandleEvent,
"get_gametic", X_FUNCTION, XG_GameGetGametic,
"get_game_mode", X_FUNCTION, XG_GameGetGameMode,
"is_multiplayer", X_FUNCTION, XG_GameIsMultiplayer,
"get_frag_limit", X_FUNCTION, XG_GameGetFragLimit,
"get_time_limit", X_FUNCTION, XG_GameGetTimeLimit,
"get_players", X_FUNCTION, XG_GameGetPlayers,
Expand Down

0 comments on commit 4b116af

Please sign in to comment.