Archival snapshot of the Virtual World Entertainment Tesla cockpit software, 1994-1996: MUNGA engine and L4 pod layer source (Borland C++ 5.0), BT/RP game code, and game content (models, audio, maps, gauges, Division renderer data). Includes third-party libraries: Division dVS/DPL graphics, HMI SOS audio, WATTCP networking. Files are preserved byte-for-byte (.gitattributes disables all line-ending conversion). README.md documents the layout, target hardware, and toolchain. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
121 lines
3.3 KiB
C++
121 lines
3.3 KiB
C++
//===========================================================================//
|
|
// File: reticle.cc //
|
|
// Project: MUNGA Brick: Model Manager //
|
|
// Contents: Reticle specification //
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ---------------------------------------------------------- //
|
|
// 04/21/95 GAC Initial coding. //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#include <munga.hpp>
|
|
#pragma hdrstop
|
|
|
|
#if !defined(RETICLE_HPP)
|
|
# include <reticle.hpp>
|
|
#endif
|
|
|
|
//##########################################################################
|
|
//########################### 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;
|
|
}
|
|
}
|