Imports the current Win32 source for the pod-racing game 'Red Planet', built on the MUNGA engine and its L4 (Win32/DirectX) platform layer: - MUNGA / MUNGA_L4: cross-platform engine core and Win32 backend - RP / RP_L4: Red Planet game logic and Win32 application - DivLoader, Setup1: asset loader and installer project - lib, MUNGA_L4/openal, MUNGA_L4/sos: third-party audio dependencies Removed stale Subversion metadata and added .gitignore/.gitattributes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
173 lines
4.0 KiB
C++
173 lines
4.0 KiB
C++
#pragma once
|
|
|
|
#include "gaugrend.h"
|
|
#include "style.h"
|
|
#include "graph2d.h"
|
|
#include "mode.h"
|
|
#include "slot.h"
|
|
#include "chain.h"
|
|
|
|
class LampManager;
|
|
class GraphicLamp;
|
|
typedef int LampID;
|
|
typedef int LampState;
|
|
|
|
//#########################################################################
|
|
//################################# Lamp ##################################
|
|
//#########################################################################
|
|
class Lamp : public Node
|
|
{
|
|
friend class LampManager;
|
|
//----------------------------------------------------------------------
|
|
// Public methods
|
|
//----------------------------------------------------------------------
|
|
public:
|
|
enum
|
|
{
|
|
LampStateUndefined = -1,
|
|
LampStateOff = 0,
|
|
LampStateOn,
|
|
NextLampState
|
|
};
|
|
|
|
virtual ~Lamp();
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
virtual void
|
|
SetState(LampState new_state);
|
|
|
|
void
|
|
SetAlertState(Logical alert_on = True);
|
|
|
|
LampState
|
|
GetState()
|
|
{
|
|
Check(this);
|
|
return previousState;
|
|
}
|
|
|
|
protected:
|
|
//----------------------------------------------------------------------
|
|
// Protected methods
|
|
//----------------------------------------------------------------------
|
|
Lamp(
|
|
LampID lamp_id,
|
|
ModeMask mode_mask,
|
|
LampManager *lamp_manager
|
|
);
|
|
|
|
virtual void
|
|
Update(Logical force_notify_of_state_change = False);
|
|
|
|
virtual void
|
|
NotifyOfStateChange();
|
|
//
|
|
//----------------------------------------------------------------------
|
|
// Protected data
|
|
//----------------------------------------------------------------------
|
|
//
|
|
LampID
|
|
lampID;
|
|
ModeMask
|
|
modeMask;
|
|
LampState
|
|
previousState;
|
|
LampManager
|
|
*manager;
|
|
int
|
|
alertActive;
|
|
};
|
|
|
|
//#########################################################################
|
|
//############################## GraphicLamp ##############################
|
|
//#########################################################################
|
|
class GraphicLamp :
|
|
public Lamp
|
|
{
|
|
//----------------------------------------------------------------------
|
|
// Public methods
|
|
//----------------------------------------------------------------------
|
|
public:
|
|
~GraphicLamp();
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
//----------------------------------------------------------------------
|
|
// Protected methods
|
|
//----------------------------------------------------------------------
|
|
protected:
|
|
GraphicLamp(
|
|
LampID lamp_id,
|
|
ModeMask mode_mask,
|
|
LampManager *lamp_manager,
|
|
GaugeRenderer *renderer,
|
|
int graphics_port_number
|
|
);
|
|
//----------------------------------------------------------------------
|
|
// Public data
|
|
//----------------------------------------------------------------------
|
|
GaugeRenderer
|
|
*renderer;
|
|
GraphicsView
|
|
localView;
|
|
};
|
|
|
|
#include "gaugrend.h" // LampManager is a part of GaugeRenderer...
|
|
|
|
//############################## LampManager ##############################
|
|
// The Lamp Manager belongs to the Gauge Renderer: it is responsible for
|
|
// handling specialized 'lamp' objects similar to (but not identical to)
|
|
// gauge objects.
|
|
//#########################################################################
|
|
class LampManager SIGNATURED
|
|
{
|
|
friend class Lamp;
|
|
//----------------------------------------------------------------------
|
|
// Public methods
|
|
//----------------------------------------------------------------------
|
|
public:
|
|
virtual ~LampManager();
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
virtual void
|
|
Update(ModeMask current_mode_mask);
|
|
Lamp *
|
|
FindLamp(LampID lamp_id, ModeMask mode_mask);
|
|
void
|
|
RemoveAllLamps();
|
|
ModeMask
|
|
GetPreviousModeMask()
|
|
{
|
|
Check(this);
|
|
Check_Fpu();
|
|
return previousModeMask;
|
|
}
|
|
//----------------------------------------------------------------------
|
|
// Protected methods
|
|
//----------------------------------------------------------------------
|
|
protected:
|
|
LampManager();
|
|
|
|
void
|
|
ActivateLamps(ModeMask bits_became_active);
|
|
void
|
|
DeactivateLamps(ModeMask bits_became_inactive);
|
|
void
|
|
AddLamp(Lamp *new_lamp);
|
|
void
|
|
RemoveLamp(LampID lamp_id, ModeMask mode_mask);
|
|
|
|
ModeMask
|
|
previousModeMask;
|
|
|
|
ChainOf<Lamp*>
|
|
lampList,
|
|
activeLampList,
|
|
inactiveLampList;
|
|
};
|