Initial import of Red Planet v4.10 Win32 source
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>
This commit is contained in:
@@ -0,0 +1,185 @@
|
||||
#include "munga.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "apptask.h"
|
||||
#include "renderer.h"
|
||||
#include "audrend.h"
|
||||
#include "app.h"
|
||||
#include "nttmgr.h"
|
||||
#include "gaugrend.h"
|
||||
|
||||
#if defined(TRACE_COMPLETE_CYCLES)
|
||||
BitTrace Complete_Cycles("Complete Cycles");
|
||||
#endif
|
||||
|
||||
#if defined(TRACE_DEATH_ROW)
|
||||
BitTrace Death_Row("Death Row");
|
||||
#endif
|
||||
|
||||
//#############################################################################
|
||||
//########################### ApplicationTask ###########################
|
||||
//#############################################################################
|
||||
|
||||
ApplicationTask::ApplicationTask(ClassID class_ID):
|
||||
Component(class_ID)
|
||||
{
|
||||
}
|
||||
|
||||
ApplicationTask::~ApplicationTask()
|
||||
{
|
||||
}
|
||||
|
||||
//#############################################################################
|
||||
//########################### BackgroundTasks ###########################
|
||||
//#############################################################################
|
||||
|
||||
BackgroundTasks::BackgroundTasks():
|
||||
taskSocket(NULL)
|
||||
{
|
||||
taskIterator = new SChainIteratorOf<ApplicationTask*>(&taskSocket);
|
||||
Register_Object(taskIterator);
|
||||
}
|
||||
|
||||
BackgroundTasks::~BackgroundTasks()
|
||||
{
|
||||
Check(taskIterator);
|
||||
taskIterator->DeletePlugs();
|
||||
Unregister_Object(taskIterator);
|
||||
delete taskIterator;
|
||||
}
|
||||
|
||||
Logical
|
||||
BackgroundTasks::TestInstance() const
|
||||
{
|
||||
Component::TestInstance();
|
||||
Check(&taskSocket);
|
||||
Check(taskIterator);
|
||||
return True;
|
||||
}
|
||||
|
||||
void
|
||||
BackgroundTasks::AddTask(ApplicationTask *task)
|
||||
{
|
||||
Check(this);
|
||||
Check(task);
|
||||
taskSocket.Add(task);
|
||||
}
|
||||
|
||||
void
|
||||
BackgroundTasks::Execute()
|
||||
{
|
||||
Check(this);
|
||||
|
||||
Check(taskIterator);
|
||||
if (taskIterator->GetCurrent() == NULL)
|
||||
{
|
||||
taskIterator->First();
|
||||
}
|
||||
|
||||
ApplicationTask *task = taskIterator->GetCurrent();
|
||||
Check(task);
|
||||
|
||||
task->Execute();
|
||||
taskIterator->Next();
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NetworkManagerTask ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
void
|
||||
NetworkManagerTask::Execute()
|
||||
{
|
||||
Check(this);
|
||||
Check(application);
|
||||
Check(application->GetNetworkManager());
|
||||
|
||||
Time start = Now();
|
||||
|
||||
application->GetNetworkManager()->ExecuteBackground();
|
||||
|
||||
Time end = Now();
|
||||
|
||||
if (end.ticks - start.ticks > 10)
|
||||
{
|
||||
end = start;
|
||||
}
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~ RoutePacketTask ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
void
|
||||
RoutePacketTask::Execute()
|
||||
{
|
||||
Check(this);
|
||||
|
||||
Check(application);
|
||||
Check(application->GetNetworkManager());
|
||||
application->GetNetworkManager()->RoutePacket();
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ProcessEventTask ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
void
|
||||
ProcessEventTask::Execute()
|
||||
{
|
||||
Check(this);
|
||||
Check(application);
|
||||
application->ProcessOneEvent();
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~ AudioRendererTask ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
void
|
||||
AudioRendererTask::Execute()
|
||||
{
|
||||
Check(this);
|
||||
Check(application);
|
||||
if (application->GetAudioRenderer() != NULL)
|
||||
{
|
||||
Check(application->GetAudioRenderer());
|
||||
application->GetAudioRenderer()->ExecuteBackground();
|
||||
}
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GaugeRendererTask ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
void
|
||||
GaugeRendererTask::Execute()
|
||||
{
|
||||
Check(this);
|
||||
Check(application);
|
||||
if (application->GetGaugeRenderer() != NULL)
|
||||
{
|
||||
Check(application->GetGaugeRenderer());
|
||||
application->GetGaugeRenderer()->ExecuteBackground();
|
||||
}
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~ CompleteCyclesTask ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
void
|
||||
CompleteCyclesTask::Execute()
|
||||
{
|
||||
SET_COMPLETE_CYCLES();
|
||||
|
||||
Check(this);
|
||||
Check(application);
|
||||
Check(application->GetRendererManager());
|
||||
// application->GetRendererManager()->CompleteCycles();
|
||||
|
||||
CLEAR_COMPLETE_CYCLES();
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ FryDeathRowTask ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
void
|
||||
FryDeathRowTask::Execute()
|
||||
{
|
||||
SET_DEATH_ROW();
|
||||
|
||||
Check(this);
|
||||
Check(application);
|
||||
Check(application->GetEntityManager());
|
||||
application->GetEntityManager()->FryDeathRow();
|
||||
|
||||
CLEAR_DEATH_ROW();
|
||||
}
|
||||
Reference in New Issue
Block a user