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>
105 lines
2.1 KiB
C++
105 lines
2.1 KiB
C++
#include "munga.h"
|
|
#pragma hdrstop
|
|
|
|
#include "reticle.h"
|
|
|
|
//##########################################################################
|
|
//########################### Class Reticle #########################
|
|
//##########################################################################
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
Reticle::Reticle()
|
|
{
|
|
//
|
|
// NOTE...most of these things should be initialization parameters to the constructor
|
|
//
|
|
reticleState = ReticleOn;
|
|
reticlePosition.x = 0.0f;
|
|
reticlePosition.y = 0.0f;
|
|
pickPointingOn = False;
|
|
rayIntersection.x = 0.0f;
|
|
rayIntersection.y = 0.0f;
|
|
rayIntersection.z = 0.0f;
|
|
targetEntity = 0;
|
|
targetDamageZone = -1;
|
|
reticleElementMask = AllEnabledGroup; // all reticle elements are on
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
Logical
|
|
Reticle::TestInstance() const
|
|
{
|
|
return True;
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
ResourceDescription::ResourceID
|
|
Reticle::CreateModelResource(
|
|
ResourceFile *resource_file,
|
|
const char* model_name,
|
|
NotationFile *model_file,
|
|
const ResourceDirectories *,
|
|
ModelResource *model
|
|
)
|
|
{
|
|
Check(resource_file);
|
|
Check_Pointer(model_name);
|
|
Check(model_file);
|
|
|
|
ModelResource *local_model = model;
|
|
if (!local_model)
|
|
{
|
|
local_model = new ModelResource;
|
|
Register_Pointer(local_model);
|
|
}
|
|
|
|
if(
|
|
!model_file->GetEntry(
|
|
"gamedata",
|
|
"ReticleX",
|
|
&local_model->reticlePosition.x
|
|
)
|
|
)
|
|
{
|
|
local_model->reticlePosition.x = 0.0f;
|
|
}
|
|
if(
|
|
!model_file->GetEntry(
|
|
"gamedata",
|
|
"ReticleY",
|
|
&local_model->reticlePosition.y
|
|
)
|
|
)
|
|
{
|
|
local_model->reticlePosition.y = 0.0f;
|
|
}
|
|
//
|
|
//---------------------------
|
|
// Write out the new resource
|
|
//---------------------------
|
|
//
|
|
if(!model)
|
|
{
|
|
ResourceDescription *new_res =
|
|
resource_file->AddResource(
|
|
model_name,
|
|
ResourceDescription::GameModelResourceType,
|
|
1,
|
|
ResourceDescription::Preload,
|
|
local_model,
|
|
sizeof(local_model)
|
|
);
|
|
Unregister_Pointer(local_model);
|
|
delete local_model;
|
|
Check(new_res);
|
|
return new_res->resourceID;
|
|
}
|
|
else
|
|
{
|
|
return 0;
|
|
}
|
|
}
|