mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Move podium code to its own file
This commit is contained in:
parent
a1976aa43d
commit
35d0cb8eaa
12 changed files with 221 additions and 79 deletions
|
|
@ -134,6 +134,7 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
|
|||
k_profiles.c
|
||||
k_specialstage.c
|
||||
k_roulette.c
|
||||
k_podium.c
|
||||
)
|
||||
|
||||
if(SRB2_CONFIG_ENABLE_WEBM_MOVIES)
|
||||
|
|
|
|||
|
|
@ -3139,68 +3139,3 @@ void F_TextPromptTicker(void)
|
|||
animtimer--;
|
||||
}
|
||||
}
|
||||
|
||||
boolean F_StartCeremony(void)
|
||||
{
|
||||
INT32 podiumMapNum = nummapheaders;
|
||||
INT32 i;
|
||||
|
||||
if (grandprixinfo.gp == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (podiummap
|
||||
&& ((podiumMapNum = G_MapNumber(podiummap)) < nummapheaders)
|
||||
&& mapheaderinfo[podiumMapNum]
|
||||
&& mapheaderinfo[podiumMapNum]->lumpnum != LUMPERROR)
|
||||
{
|
||||
P_SetTarget(&titlemapcam.mobj, NULL);
|
||||
|
||||
gamemap = podiumMapNum+1;
|
||||
|
||||
maptol = mapheaderinfo[gamemap-1]->typeoflevel;
|
||||
globalweather = mapheaderinfo[gamemap-1]->weather;
|
||||
|
||||
// Make sure all of the GAME OVER'd players can spawn
|
||||
// and be present for the podium
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && !players[i].spectator && !players[i].bot)
|
||||
{
|
||||
players[i].lives = max(1, players[i].lives);
|
||||
}
|
||||
}
|
||||
|
||||
G_DoLoadLevelEx(false, GS_CEREMONY);
|
||||
|
||||
r_splitscreen = 0; // Only one screen for the ceremony
|
||||
R_ExecuteSetViewSize();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void F_CeremonyTicker(boolean run)
|
||||
{
|
||||
(void)run;
|
||||
|
||||
// don't trigger if doing anything besides idling
|
||||
if (gameaction != ga_nothing || gamestate != GS_CEREMONY)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
P_TickAltView(&titlemapcam);
|
||||
|
||||
if (titlemapcam.mobj != NULL)
|
||||
{
|
||||
camera[0].x = titlemapcam.mobj->x;
|
||||
camera[0].y = titlemapcam.mobj->y;
|
||||
camera[0].z = titlemapcam.mobj->z;
|
||||
camera[0].angle = titlemapcam.mobj->angle;
|
||||
camera[0].aiming = titlemapcam.mobj->pitch;
|
||||
camera[0].subsector = titlemapcam.mobj->subsector;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,9 +79,6 @@ void F_StartTitleScreen(void);
|
|||
void F_StartEnding(void);
|
||||
void F_StartCredits(void);
|
||||
|
||||
boolean F_StartCeremony(void);
|
||||
void F_CeremonyTicker(boolean run);
|
||||
|
||||
extern INT32 finalecount;
|
||||
extern INT32 titlescrollxspeed;
|
||||
extern INT32 titlescrollyspeed;
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@
|
|||
#include "k_bot.h"
|
||||
#include "doomstat.h"
|
||||
#include "k_director.h"
|
||||
#include "k_podium.h"
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
#include "discord.h"
|
||||
|
|
@ -2255,7 +2256,7 @@ void G_Ticker(boolean run)
|
|||
|
||||
case GS_CEREMONY:
|
||||
P_Ticker(run);
|
||||
F_CeremonyTicker(run);
|
||||
K_CeremonyTicker(run);
|
||||
break;
|
||||
|
||||
case GS_WAITINGPLAYERS:
|
||||
|
|
@ -4296,7 +4297,7 @@ void G_EndGame(void)
|
|||
{
|
||||
if (nextmap == NEXTMAP_CEREMONY) // end game with ceremony
|
||||
{
|
||||
if (F_StartCeremony() == true)
|
||||
if (K_StartCeremony() == true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -5082,7 +5083,7 @@ void G_InitNew(UINT8 pencoremode, INT32 map, boolean resetplayer, boolean skippr
|
|||
{
|
||||
// Didn't want to do this, but it needs to be here
|
||||
// for it to work on startup.
|
||||
if (F_StartCeremony() == true)
|
||||
if (K_StartCeremony() == true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "r_things.h" // numskins
|
||||
#include "k_race.h" // finishBeamLine
|
||||
#include "m_perfstats.h"
|
||||
|
||||
#include "k_podium.h"
|
||||
|
||||
/*--------------------------------------------------
|
||||
boolean K_AddBot(UINT8 skin, UINT8 difficulty, UINT8 *p)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "g_game.h" // Sink snipe print
|
||||
#include "k_objects.h"
|
||||
#include "k_roulette.h"
|
||||
#include "k_podium.h"
|
||||
|
||||
angle_t K_GetCollideAngle(mobj_t *t1, mobj_t *t2)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#include "k_boss.h"
|
||||
#include "k_specialstage.h"
|
||||
#include "k_roulette.h"
|
||||
#include "k_podium.h"
|
||||
|
||||
// SOME IMPORTANT VARIABLES DEFINED IN DOOMDEF.H:
|
||||
// gamespeed is cc (0 for easy, 1 for normal, 2 for hard)
|
||||
|
|
@ -51,11 +52,6 @@
|
|||
// comeback is Battle Mode's karma comeback, also bool
|
||||
// mapreset is set when enough players fill an empty server
|
||||
|
||||
boolean K_PodiumSequence(void)
|
||||
{
|
||||
return (gamestate == GS_CEREMONY);
|
||||
}
|
||||
|
||||
boolean K_IsDuelItem(mobjtype_t type)
|
||||
{
|
||||
switch (type)
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ Make sure this matches the actual number of states
|
|||
#define STUMBLE_STEEP_VAL ANG60
|
||||
#define STUMBLE_STEEP_VAL_AIR (ANG30 + ANG10)
|
||||
|
||||
boolean K_PodiumSequence(void);
|
||||
|
||||
player_t *K_GetItemBoxPlayer(mobj_t *mobj);
|
||||
angle_t K_ReflectAngle(angle_t angle, angle_t against, fixed_t maxspeed, fixed_t yourspeed);
|
||||
|
||||
|
|
|
|||
132
src/k_podium.c
Normal file
132
src/k_podium.c
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
// DR. ROBOTNIK'S RING RACERS
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) by Sally "TehRealSalt" Cochenour
|
||||
// Copyright (C) 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file k_podium.c
|
||||
/// \brief Grand Prix podium cutscene
|
||||
|
||||
#include "k_podium.h"
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "d_main.h"
|
||||
#include "d_netcmd.h"
|
||||
#include "f_finale.h"
|
||||
#include "g_game.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "r_local.h"
|
||||
#include "s_sound.h"
|
||||
#include "i_time.h"
|
||||
#include "i_video.h"
|
||||
#include "v_video.h"
|
||||
#include "w_wad.h"
|
||||
#include "z_zone.h"
|
||||
#include "i_system.h"
|
||||
#include "i_threads.h"
|
||||
#include "dehacked.h"
|
||||
#include "g_input.h"
|
||||
#include "console.h"
|
||||
#include "m_random.h"
|
||||
#include "m_misc.h" // moviemode functionality
|
||||
#include "y_inter.h"
|
||||
#include "m_cond.h"
|
||||
#include "p_local.h"
|
||||
#include "p_setup.h"
|
||||
#include "st_stuff.h" // hud hiding
|
||||
#include "fastcmp.h"
|
||||
|
||||
#include "lua_hud.h"
|
||||
#include "lua_hook.h"
|
||||
|
||||
#include "k_menu.h"
|
||||
#include "k_grandprix.h"
|
||||
|
||||
/*--------------------------------------------------
|
||||
boolean K_PodiumSequence(void)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
boolean K_PodiumSequence(void)
|
||||
{
|
||||
return (gamestate == GS_CEREMONY);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
boolean K_StartCeremony(void)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
boolean K_StartCeremony(void)
|
||||
{
|
||||
INT32 podiumMapNum = nummapheaders;
|
||||
INT32 i;
|
||||
|
||||
if (grandprixinfo.gp == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (podiummap
|
||||
&& ((podiumMapNum = G_MapNumber(podiummap)) < nummapheaders)
|
||||
&& mapheaderinfo[podiumMapNum]
|
||||
&& mapheaderinfo[podiumMapNum]->lumpnum != LUMPERROR)
|
||||
{
|
||||
P_SetTarget(&titlemapcam.mobj, NULL);
|
||||
|
||||
gamemap = podiumMapNum+1;
|
||||
|
||||
maptol = mapheaderinfo[gamemap-1]->typeoflevel;
|
||||
globalweather = mapheaderinfo[gamemap-1]->weather;
|
||||
|
||||
// Make sure all of the GAME OVER'd players can spawn
|
||||
// and be present for the podium
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && !players[i].spectator && !players[i].bot)
|
||||
{
|
||||
players[i].lives = max(1, players[i].lives);
|
||||
}
|
||||
}
|
||||
|
||||
G_DoLoadLevelEx(false, GS_CEREMONY);
|
||||
|
||||
r_splitscreen = 0; // Only one screen for the ceremony
|
||||
R_ExecuteSetViewSize();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_CeremonyTicker(boolean run)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
void K_CeremonyTicker(boolean run)
|
||||
{
|
||||
(void)run;
|
||||
|
||||
// don't trigger if doing anything besides idling
|
||||
if (gameaction != ga_nothing || gamestate != GS_CEREMONY)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
P_TickAltView(&titlemapcam);
|
||||
|
||||
if (titlemapcam.mobj != NULL)
|
||||
{
|
||||
camera[0].x = titlemapcam.mobj->x;
|
||||
camera[0].y = titlemapcam.mobj->y;
|
||||
camera[0].z = titlemapcam.mobj->z;
|
||||
camera[0].angle = titlemapcam.mobj->angle;
|
||||
camera[0].aiming = titlemapcam.mobj->pitch;
|
||||
camera[0].subsector = titlemapcam.mobj->subsector;
|
||||
}
|
||||
}
|
||||
79
src/k_podium.h
Normal file
79
src/k_podium.h
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
// DR. ROBOTNIK'S RING RACERS
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) by Sally "TehRealSalt" Cochenour
|
||||
// Copyright (C) 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file k_podium.h
|
||||
/// \brief Grand Prix podium cutscene
|
||||
|
||||
#ifndef __K_PODIUM__
|
||||
#define __K_PODIUM__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "d_event.h"
|
||||
#include "p_mobj.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*--------------------------------------------------
|
||||
boolean K_PodiumSequence(void);
|
||||
|
||||
Returns whenver or not we are in the podium
|
||||
cutscene mode.
|
||||
|
||||
Input Arguments:-
|
||||
N/A
|
||||
|
||||
Return:-
|
||||
true if we're in GS_CEREMONY, otherwise false.
|
||||
--------------------------------------------------*/
|
||||
|
||||
boolean K_PodiumSequence(void);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
boolean K_StartCeremony(void);
|
||||
|
||||
Loads the podium map and changes the gamestate
|
||||
to the podium cutscene mode.
|
||||
|
||||
Input Arguments:-
|
||||
N/A
|
||||
|
||||
Return:-
|
||||
true if successful, otherwise false. Can fail
|
||||
if there is no podium map defined.
|
||||
--------------------------------------------------*/
|
||||
|
||||
boolean K_StartCeremony(void);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_CeremonyTicker(boolean run);
|
||||
|
||||
Ticker function to be ran during the podium
|
||||
cutscene mode gamestate. Handles updating
|
||||
the camera.
|
||||
|
||||
Input Arguments:-
|
||||
run - Set to true when we're running a
|
||||
new game frame.
|
||||
|
||||
Return:-
|
||||
N/A
|
||||
--------------------------------------------------*/
|
||||
|
||||
void K_CeremonyTicker(boolean run);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // __K_PODIUM__
|
||||
|
|
@ -48,6 +48,7 @@
|
|||
#include "k_grandprix.h"
|
||||
#include "k_director.h"
|
||||
#include "m_easing.h"
|
||||
#include "k_podium.h"
|
||||
|
||||
static CV_PossibleValue_t CV_BobSpeed[] = {{0, "MIN"}, {4*FRACUNIT, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_movebob = CVAR_INIT ("movebob", "1.0", CV_FLOAT|CV_SAVE, CV_BobSpeed, NULL);
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@
|
|||
#include "k_specialstage.h"
|
||||
#include "acs/interface.h"
|
||||
#include "doomstat.h" // MAXMUSNAMES
|
||||
#include "k_podium.h"
|
||||
|
||||
// Replay names have time
|
||||
#if !defined (UNDER_CE)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue