#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; } }