resonance 1.0.1
Loading...
Searching...
No Matches
apptunnel.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4#include <vector>
5
6#include "app/msgsink.h"
8#include "game/trackdata.h"
9
11class AxeButtonMsg;
12class CatchMsg;
13class ClearGemMsg;
14class ClearGemsMsg;
15class CripplePacket;
17class DurGemMsg;
18class DurGemTrails;
19class FreestyleFXMsg;
20class GemMsg;
21class HxStr;
22class JuiceAmountMsg;
23class Message;
25class NowBarMsg;
26class PhraseMuffedMsg;
27class PitchMsg;
28class PlayMap;
30class Player;
33class Renderer;
35class SeekerMsg;
37class SusGemMsg;
38class TnlArms;
39class TnlArrow;
40class TnlBoundary;
41class TnlBumpFX;
42class TnlCameraRig;
43class TnlCrippleFX;
44class TnlFireFX;
45class TnlGemManager;
46class TnlLattice;
47class TnlMultFX;
48class TnlNowRing;
49class TnlPanel;
50class TnlPanelFX;
51class TnlPlayer;
52class TnlSnake;
53class TnlTrigger;
54class ToggleGhostMsg;
55class TrackSelectMsg;
56class WinMsg;
57struct Color;
58struct Vector3;
59namespace Rnd {
60class Cam;
61class Drawable;
62class Light;
63class Mat;
64class ParticleSys;
65class View;
66struct Particle;
67} // namespace Rnd
68
88class AppTunnel : public MsgSink {
89public:
104 AppTunnel(Renderer *pRenderer);
105
114 virtual ~AppTunnel();
115
126 virtual void DispatchPriv(Message *pMsg);
127
141 void SetFrame(float flFrame);
142
154 void OnLeaderChanged(Player *pOldLeader, Player *pNewLeader);
155
175 int nTrack, int nBar, int nRefreshing, Player *pPlayer, int nPowerup, int nEnabled);
176
188 void PrepareLocalView(int nView, float flFrame);
189
201 void PlaceStringFlare(const Vector3 &pos);
202
216 int IsTrackBarLocked(int nTrack, int nBar);
217
230 void ShowTrackGhost(int nTrack, Rnd::Drawable *pGhost);
231
241 void HideTrackGhost(int nTrack);
242
251 Rnd::Mat *GetGhostMat(int nTrack);
252
264 void StartGemFlash(const Vector3 &pos);
265
278 int StartPanelFX(int nRing, int nSlice, int nForward);
279
280private:
281 // The length of mTrackModes, and the track count the constructor stores.
282 static constexpr int kTrackCount = 8;
283
284 // Gem flash record, the element of mGemFlashes. The name is inferred.
285 class GemFlash {
286 public:
295 ~GemFlash();
296
306 int Start(const Vector3 &pos);
307
316 void Update();
317
318 Rnd::ParticleSys *mSystem; // "gem_flash.ps", shared by every record.
319 Rnd::Particle *mParticle; // The flash, or null while the record is free.
320 };
321
330 void StartFireFX(float flPathStart,
331 int nIndex,
332 int nSlot,
333 const Color &color,
334 const Color &altColor,
335 float flPathEnd);
336
345 int StartCrippleFX(const std::vector<TnlPlayer *> &targets, float flFrame);
346
355 int StartBumpFX(int nStep, const HxStr &colorName, int nForward, float flPathOffset);
356
365 int StartSnake(float flFrame, int nRing, const Color &color, float flPhase, float flAmplitude);
366
375 void AddPendingTrigger(TnlTrigger *pTrigger, float flFrame);
376
386 void PlaceStringFlareOnRing(int nRing, float flBlend);
387
396 void AddPanel(TnlPanel *pPanel, float flStartFrame);
397
405 void OnGem(GemMsg *pMsg);
406
413 void OnCatch(CatchMsg *pMsg);
414
421 void OnPhraseMuffed(PhraseMuffedMsg *pMsg);
422
429 void OnPitch(PitchMsg *pMsg);
430
437 void OnSeeker(SeekerMsg *pMsg);
438
445 void OnShowEraseEffect(ShowEraseEffectMsg *pMsg);
446
453 void OnSectionCaptured(SectionCapturedMsg *pMsg);
454
461 void OnCripple(CripplePacket *pPacket);
462
469 void OnFreestyleFX(FreestyleFXMsg *pMsg);
470
478 void OnDeployedPowerup(DeployedPowerupMsg *pMsg);
479
488 void OnNowBar(NowBarMsg *pMsg);
489
498 void OnClearGem(ClearGemMsg *pMsg);
499
508 void OnClearGems(ClearGemsMsg *pMsg);
509
518 void OnSusGem(SusGemMsg *pMsg);
519
528 void OnDurGem(DurGemMsg *pMsg);
529
537 void OnTrackSelect(TrackSelectMsg *pMsg);
538
548 void OnAdvanceSectionToggle(AdvanceSectionToggleMsg *pMsg);
549
557 void OnPlaybackToggle(PlaybackToggleMsg *pMsg);
558
566 void OnWin(WinMsg *pMsg);
567
575 void OnMultiplierState(MultiplierStateMsg *pMsg);
576
584 void OnPowerupFailed(PowerupFailedMsg *pMsg);
585
594 void OnAxeButton(AxeButtonMsg *pMsg);
595
604 void OnPlayersTrackNeutralized(PlayersTrackNeutralizedMsg *pMsg);
605
614 void OnToggleGhost(ToggleGhostMsg *pMsg);
615
624 void OnJuiceAmount(JuiceAmountMsg *pMsg);
625
626 // Find the TnlPlayer of a game player, or null. The search is inlined wherever a handler
627 // needs it, and the image has no out-of-line copy.
628 TnlPlayer *FindTnlPlayer(Player *pPlayer);
629
639 void UpdateGhostFades();
640
641 Renderer *mRenderer; // +0x04
642 // Globals::GetGameMode() at construction.
643 int mGameMode; // +0x08
644 // Globals::GetPlayMode() at construction.
645 int mPlayMode; // +0x0c
646 TnlBoundary *mBoundary;
647 TnlNowRing *mNowRing;
648 TnlArms *mArms;
649 TnlMultFX *mMultFX;
650 TnlLattice *mLattice;
651 // Two "fire%d", two "firefs%d", and four "firemult%d" fires, in that order.
652 std::vector<TnlFireFX *> mFireFX;
653 std::vector<TnlCrippleFX *> mCrippleFX;
654 std::vector<TnlPanelFX *> mPanelFX;
655 std::vector<TnlBumpFX *> mBumpFX;
656 std::vector<TnlSnake *> mSnakes;
657 std::vector<TnlPendingTrigger> mPendingTriggers;
658 std::vector<GemFlash *> mGemFlashes;
659 std::vector<TnlArrow *> mArrows;
660 TnlGemManager *mGemManager;
661 DurGemTrails *mGemTrails;
662
663public:
664 // Public because the seeker script command reads the first player with no accessor in the
665 // image.
666 std::vector<TnlPlayer *> mPlayers;
667
668private:
669 Rnd::ParticleSys *mStringFlare; // "string flare.ps".
670 Rnd::View *mStringView; // "tnl strings".
671 Rnd::Mat *mStringGemMat; // "string gem mat".
672 Rnd::Mat *mVoxStringMat; // "voxstring.mat".
673 // Panels SetFrame() advances, each deleted once TnlPanel::Update() reports it finished.
674 std::list<TnlPanel *> mPanels;
675 // Per-track rate the ghost material's alpha moves at, 0.15 while the ghost shows.
676 std::vector<float> mGhostFadeRates;
677 // One "saved tnl cam%d" per local player, a copy of "tnl cam%d" at construction.
678 std::vector<Rnd::Cam *> mSavedCams;
679 TnlCameraRig *mCameraRig;
680 int mJukebox; // +0xc8 Set in a jam in jukebox mode. The camera intro is then skipped.
681 // Set in kPlayModeGame. New panels and far gems then appear ahead of their bar rather than
682 // at once.
683 int mStaggerPanels;
684 // Globals::GetTempo() divided by 480000, written by the constructor and never read.
685 float mInitialTempoRate;
686 // One "gem_ghost%d.mat" per track.
687 std::vector<Rnd::Mat *> mGhostMats;
688 // Per track, the "gem_scratch" effect kind for a scratch track, else the kind of the track's
689 // instrument.
690 std::vector<char> mTrackEffectKinds;
691 // The powerup gem kinds, indexed by powerup: "gem_neut", "gem_crip", "gem_free", "gem_auto",
692 // "gem_bump", and "gem_mult" at 12.
693 std::vector<char> mPowerupGemKinds;
694 // The "gem_hex_b", "gem_hex_g", "gem_hex_r", "gem_hex_y", and "gem_hex_p" kinds.
695 std::vector<char> mHexGemKinds;
696 // One "gem_ghost%d" kind per track, hidden at construction.
697 std::vector<char> mGhostGemKinds;
698 char mMissGemKind; // "gem_miss".
699 char mCrateGemKind; // "gem_crate".
700
701public:
702 // Non-zero draws every hex gem as "gem_crate". The hx.crates script command at 0x00449dc0
703 // toggles it. Public because that command writes it with no accessor in the image.
705
706private:
707 // The mode of each track, from LevelData::TrackAt().
708 TrackMode mTrackModes[kTrackCount];
709 PlayMap *mPlayMap;
710 int mTrackCount; // kTrackCount at construction.
711 int mNextStepBar; // The bar at which SetFrame() advances to the next step.
712 float mTempoRate; // Globals::GetTempo() divided by 480000.
713 int mUnusedWord; // +0x148 Zeroed by the constructor and never read.
714 unsigned char mReserved14c[0x14]; // +0x14c
715 Rnd::Light *mLatLight; // "lat light1".
716 unsigned char mReserved164[0x0c]; // +0x164
717};
718
727extern AppTunnel *g_pAppTunnel;
AppTunnel * g_pAppTunnel
The tunnel that exists, or null.
Event the game passes between a MsgSource and a MsgSink.
Definition advancesectiontogglemsg.h:22
Game-side driver of the tunnel the in-game renderer draws.
Definition apptunnel.h:88
int mShowCrates
Definition apptunnel.h:704
int StartPanelFX(int nRing, int nSlice, int nForward)
Start the first idle panel effect on one cell.
virtual void DispatchPriv(Message *pMsg)
Act on one message the renderer sends on.
AppTunnel(Renderer *pRenderer)
Build the tunnel for the game about to start.
void PlaceStringFlare(const Vector3 &pos)
Move the first unplaced particle of "string flare.ps" to a point.
void OnBarChanged(int nTrack, int nBar, int nRefreshing, Player *pPlayer, int nPowerup, int nEnabled)
Update the tunnel section of one bar whose state a BarStatusMsg changed.
virtual ~AppTunnel()
Release every tunnel object and give each main camera back its saved state.
void ShowTrackGhost(int nTrack, Rnd::Drawable *pGhost)
Show the ghost gems of one track in a drawable.
void PrepareLocalView(int nView, float flFrame)
Turn the now ring for one local view before the renderer draws it.
void HideTrackGhost(int nTrack)
Make the ghost material of one track opaque again and fade the ghost out at -0.15.
std::vector< TnlPlayer * > mPlayers
Definition apptunnel.h:666
Rnd::Mat * GetGhostMat(int nTrack)
Report the "gem_ghost<n>.mat" material of one track.
void SetFrame(float flFrame)
Advance the tunnel to one song position.
void OnLeaderChanged(Player *pOldLeader, Player *pNewLeader)
Move the leader marker from one player's activator to another's.
void StartGemFlash(const Vector3 &pos)
Start one flash of "gem_flash.ps" at a point.
int IsTrackBarLocked(int nTrack, int nBar)
Report whether the player may not act on one bar of a track.
Event the game passes between a MsgSource and a MsgSink.
Definition axebuttonmsg.h:24
Event the game passes between a MsgSource and a MsgSink.
Definition catchmsg.h:24
Event the game passes between a MsgSource and a MsgSink.
Definition cleargemmsg.h:20
Event the game passes between a MsgSource and a MsgSink.
Definition cleargemsmsg.h:19
Network packet the game sends between game systems.
Definition cripplepacket.h:28
Event the game passes between a MsgSource and a MsgSink.
Definition deployedpowerupmsg.h:25
Event the game passes between a MsgSource and a MsgSink.
Definition durgemmsg.h:20
Ribbons that trace durable gems along the tunnel lanes.
Definition durgemtrails.h:31
Event the game passes between a MsgSource and a MsgSink.
Definition freestylefxmsg.h:19
Event the game passes between a MsgSource and a MsgSink.
Definition gemmsg.h:29
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Event the game passes between a MsgSource and a MsgSink.
Definition juiceamountmsg.h:20
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:41
Receiver of engine messages.
Definition msgsink.h:37
Event the game passes between a MsgSource and a MsgSink.
Definition multiplierstatemsg.h:23
Event the game passes between a MsgSource and a MsgSink.
Definition nowbarmsg.h:24
Event the game passes between a MsgSource and a MsgSink.
Definition phrasemuffedmsg.h:31
Event the game passes between a MsgSource and a MsgSink.
Definition pitchmsg.h:24
Traversal order over one playable sequence.
Definition playmap.h:47
Event the game passes between a MsgSource and a MsgSink.
Definition playbacktogglemsg.h:20
One participant in a session, local or remote.
Definition player.h:39
Event the game passes between a MsgSource and a MsgSink.
Definition playerstrackneutralizedmsg.h:25
Event the game passes between a MsgSource and a MsgSink.
Definition powerupfailedmsg.h:22
In-game renderer that drives the tunnel, the overlay, and the arena for one game.
Definition renderer.h:56
Camera.
Definition cam.h:53
Mix-in for an object that draws itself and then a list of other drawables.
Definition drawable.h:32
Light in a scene.
Definition light.h:41
Surface description a Rnd::Mesh draws with.
Definition mat.h:36
Emitter that spawns, integrates, and draws a population of particles.
Definition particlesys.h:60
Root of a loadable scene.
Definition view.h:47
Event the game passes between a MsgSource and a MsgSink.
Definition sectioncapturedmsg.h:24
Event the game passes between a MsgSource and a MsgSink.
Definition seekermsg.h:25
Event the game passes between a MsgSource and a MsgSink.
Definition showeraseeffectmsg.h:26
Event the game passes between a MsgSource and a MsgSink.
Definition susgemmsg.h:23
Burst of three particle arms shown for a limited time after a trigger frame.
Definition tnlarms.h:27
Arrow mesh that appears in the local view of up to four players for a limited time.
Definition tnlarrow.h:20
Marker that stands in the tunnel at the next step boundary and labels it.
Definition tnlboundary.h:22
Burst of generated instances that sweeps along a short stretch of the tunnel.
Definition tnlbumpfx.h:25
Main tunnel cameras and the blend between the intro pose and the playing pose.
Definition tnlcamerarig.h:29
Crippler effect that flies along a path and hits a set of players.
Definition tnlcripplefx.h:22
Coloured particle fire that travels down the tunnel path from one lane.
Definition tnlfirefx.h:27
Keeper of every gem on the tunnel, which it draws within a per-frame cost budget.
Definition tnlgemmanager.h:27
Material animation that plays out the tunnel lattice once it is triggered.
Definition tnllattice.h:19
Particle burst that plays along "multfx.path" for one run.
Definition tnlmultfx.h:19
Ring of "now" meshes around the tunnel, with a gap under each player.
Definition tnlnowring.h:24
Flash that lifts one tunnel panel out of the wall and fades it away.
Definition tnlpanelfx.h:25
One tunnel section whose material and colour follow the lane owner, with a timed show or erase.
Definition tnlpanel.h:30
Everything AppTunnel drives in the tunnel for one player.
Definition tnlplayer.h:31
Glowing ribbon with a head mesh that snakes along one lane of the tunnel.
Definition tnlsnake.h:26
An action AppTunnel schedules for a later frame.
Definition tnltrigger.h:14
Event the game passes between a MsgSource and a MsgSink.
Definition toggleghostmsg.h:20
Event the game passes between a MsgSource and a MsgSink.
Definition trackselectmsg.h:24
Event the game passes between a MsgSource and a MsgSink.
Definition winmsg.h:30
The rendering engine.
Definition animhelper.h:3
Linear colour with four float components.
Definition color.h:10
One live particle of a Rnd::ParticleSys.
Definition particle.h:33
Three-component vector, padded to a PlayStation 2 quadword.
Definition vector3.h:12
TrackMode
The play modes of a track, as TrackData::Print() writes them.
Definition trackdata.h:22