[Change] Renaming a few stuff to comply with convention.

This commit is contained in:
Allanis 2018-01-14 14:11:21 +00:00
parent f533c94456
commit 887f330a36
11 changed files with 77 additions and 72 deletions

View File

@ -18,7 +18,7 @@ void Frame::RemoveChild(Frame* f) {
}
void Frame::Init(Frame* parent, const char* label, unsigned int flags) {
sBody = 0;
m_sBody = 0;
m_parent = parent;
m_flags = flags;
m_radius = 0;

View File

@ -42,7 +42,7 @@ public:
/* If parent is null then frame position is absolute. */
Frame* m_parent;
std::list<Frame*> m_children;
StarSystem::SBody* sBody; /* Points to SBodies in L3D::current_system. */
StarSystem::SBody* m_sBody; /* Points to SBodies in L3D::current_system. */
enum { TEMP_VIEWING=1 };

View File

@ -68,35 +68,35 @@ public:
enum MapView { MAP_NOMAP, MAP_SECTOR, MAP_SYSTEM };
static void SetCamType(enum CamType);
static void SetMapView(enum MapView);
static enum CamType GetCamType(void) { return cam_type; }
static enum MapView GetMapView(void) { return map_view; }
static enum CamType GetCamType(void) { return camType; }
static enum MapView GetMapView(void) { return mapView; }
static void SetView(View* v);
static View* GetView(void) { return current_view; }
static View* GetView(void) { return currentView; }
static StarSystem* GetSelectedSystem(void);
static systemloc_t playerLoc;
static Player* player;
static SectorView* sector_view;
static SystemInfoView* system_info_view;
static WorldView* world_view;
static SectorView* sectorView;
static SystemInfoView* systemInfoView;
static WorldView* worldView;
static ObjectViewerView* objectViewerView;
static SpaceStationView* spaceStationView;
static InfoView* infoView;
static ShipCpanel* cpan;
static GLUquadric* gluQuadric;
static StarSystem* current_system;
static StarSystem* currentSystem;
private:
static void InitOpenGL(void);
static void HandleEvents(void);
static View* current_view;
static SystemView* system_view;
static View* currentView;
static SystemView* systemView;
static double gameTime;
static StarSystem* selected_system;
static enum CamType cam_type;
static enum MapView map_view;
static StarSystem* selectedSystem;
static enum CamType camType;
static enum MapView mapView;
static float timeAccel;
static float frameTime;
static int scrWidth, scrHeight;

View File

@ -30,20 +30,20 @@ sigc::signal<void, int, int, int> L3D::onMouseButtonDown;
char L3D::keyState[SDLK_LAST];
char L3D::mouseButton[5];
int L3D::mouseMotion[2];
enum L3D::CamType L3D::cam_type;
enum L3D::MapView L3D::map_view;
enum L3D::CamType L3D::camType;
enum L3D::MapView L3D::mapView;
Player* L3D::player;
View* L3D::current_view;
WorldView* L3D::world_view;
View* L3D::currentView;
WorldView* L3D::worldView;
ObjectViewerView* L3D::objectViewerView;
SpaceStationView* L3D::spaceStationView;
InfoView* L3D::infoView;
SectorView* L3D::sector_view;
SystemView* L3D::system_view;
SystemInfoView* L3D::system_info_view;
SectorView* L3D::sectorView;
SystemView* L3D::systemView;
SystemInfoView* L3D::systemInfoView;
ShipCpanel* L3D::cpan;
StarSystem* L3D::selected_system;
StarSystem* L3D::current_system;
StarSystem* L3D::selectedSystem;
StarSystem* L3D::currentSystem;
MTRand L3D::rng;
double L3D::gameTime;
float L3D::frameTime;
@ -125,23 +125,23 @@ void L3D::Quit(void) {
}
void L3D::SetCamType(enum CamType c) {
cam_type = c;
map_view = MAP_NOMAP;
SetView(world_view);
camType = c;
mapView = MAP_NOMAP;
SetView(worldView);
}
void L3D::SetMapView(enum MapView v) {
map_view = v;
mapView = v;
if(v == MAP_SECTOR)
SetView(sector_view);
SetView(sectorView);
else
SetView(system_view);
SetView(systemView);
}
void L3D::SetView(View* v) {
if(current_view) current_view->HideAll();
current_view = v;
current_view->ShowAll();
if(currentView) currentView->HideAll();
currentView = v;
currentView->ShowAll();
}
void L3D::HandleEvents(void) {
@ -207,7 +207,7 @@ void L3D::MainLoop(void) {
Frame* stationFrame = new Frame(pframe, "Station frame..");
stationFrame->SetRadius(5000);
stationFrame->sBody = 0;
stationFrame->m_sBody = 0;
stationFrame->SetPosition(vector3d(0, 0, zpos));
stationFrame->SetAngVelocity(vector3d(0,0,0.5));
@ -235,15 +235,15 @@ void L3D::MainLoop(void) {
cpan = new ShipCpanel();
cpan->ShowAll();
sector_view = new SectorView();
system_view = new SystemView();
system_info_view = new SystemInfoView();
world_view = new WorldView();
sectorView = new SectorView();
systemView = new SystemView();
systemInfoView = new SystemInfoView();
worldView = new WorldView();
objectViewerView = new ObjectViewerView();
spaceStationView = new SpaceStationView();
infoView = new InfoView();
SetView(world_view);
SetView(worldView);
player->SetDockedWith(station);
Uint32 last_stats = SDL_GetTicks();
@ -256,7 +256,7 @@ void L3D::MainLoop(void) {
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
current_view->Draw3D();
currentView->Draw3D();
/*
* TODO: HandleEvents at the moment must be after view->Draw3D and before
* Gui::Draw so that labels drawn to screen can have mouse events correctly
@ -296,7 +296,7 @@ void L3D::MainLoop(void) {
Space::TimeStep(step);
gameTime += step;
}
current_view->Update();
currentView->Update();
if(SDL_GetTicks() - last_stats > 1000) {
snprintf(fps_readout, sizeof(fps_readout), "%d fps", frame_stat);
@ -308,29 +308,29 @@ void L3D::MainLoop(void) {
StarSystem* L3D::GetSelectedSystem(void) {
int sector_x, sector_y, system_idx;
L3D::sector_view->GetSelectedSystem(&sector_x, &sector_y, &system_idx);
L3D::sectorView->GetSelectedSystem(&sector_x, &sector_y, &system_idx);
if(system_idx == -1) {
selected_system = 0;
selectedSystem = 0;
return NULL;
}
if(selected_system) {
if(!selected_system->IsSystem(sector_x, sector_y, system_idx)) {
delete selected_system;
selected_system = 0;
if(selectedSystem) {
if(!selectedSystem->IsSystem(sector_x, sector_y, system_idx)) {
delete selectedSystem;
selectedSystem = 0;
}
}
if(!selected_system) {
selected_system = new StarSystem(sector_x, sector_y, system_idx);
if(!selectedSystem) {
selectedSystem = new StarSystem(sector_x, sector_y, system_idx);
}
return selected_system;
return selectedSystem;
}
void L3D::HyperspaceTo(StarSystem* dest) {
int sec_x, sec_y, sys_idx;
dest->GetPos(&sec_x, &sec_y, &sys_idx);
if(current_system) delete current_system;
current_system = new StarSystem(sec_x, sec_y, sys_idx);
if(currentSystem) delete currentSystem;
currentSystem = new StarSystem(sec_x, sec_y, sys_idx);
Space::Clear();
Space::BuildSystem();

View File

@ -179,7 +179,7 @@ void Player::DrawHUD(const Frame* cam_frame) {
&_pos.x, &_pos.y, &_pos.z)) {
b->SetProjectedPos(_pos);
b->SetOnscreen(true);
if(L3D::world_view->GetShowLabels()) Gui::Screen::RenderLabel(b->GetLabel(), _pos.x, _pos.y);
if(L3D::worldView->GetShowLabels()) Gui::Screen::RenderLabel(b->GetLabel(), _pos.x, _pos.y);
} else
b->SetOnscreen(false);
}

View File

@ -41,7 +41,7 @@ SectorView::~SectorView(void) {
}
void SectorView::OnClickSystemInfo(void) {
L3D::SetView(L3D::system_info_view);
L3D::SetView(L3D::systemInfoView);
}
bool SectorView::GetSelectedSystem(int* sector_x, int* sector_y, int* system_idx) {

View File

@ -195,12 +195,12 @@ void Ship::SetWheelState(bool down) {
void Ship::SetNavTarget(Body* const target) {
m_navTarget = target;
L3D::world_view->UpdateCommsOptions();
L3D::worldView->UpdateCommsOptions();
}
void Ship::SetCombatTarget(Body* const target) {
m_combatTarget = target;
L3D::world_view->UpdateCommsOptions();
L3D::worldView->UpdateCommsOptions();
}
bool Ship::IsFiringLasers(void) {

View File

@ -42,10 +42,10 @@ void Space::Clear(void) {
}
void Space::MoveOrbitingObjectFrames(Frame* f) {
if(f->sBody) {
if(f->m_sBody) {
/* Not too efficient. */
vector3d pos = f->sBody->orbit.CartesianPosAtTime(L3D::GetGameTime());
vector3d pos2 = f->sBody->orbit.CartesianPosAtTime(L3D::GetGameTime()+1.0);
vector3d pos = f->m_sBody->orbit.CartesianPosAtTime(L3D::GetGameTime());
vector3d pos2 = f->m_sBody->orbit.CartesianPosAtTime(L3D::GetGameTime()+1.0);
vector3d vel = pos2 - pos;
f->SetPosition(pos);
f->SetVelocity(vel);
@ -74,7 +74,7 @@ static Frame* MakeFrameFor(StarSystem::SBody* sbody, Body* b, Frame* f) {
case StarSystem::SUPERTYPE_GAS_GIANT:
case StarSystem::SUPERTYPE_ROCKY_PLANET:
orbFrame = new Frame(f, sbody->name.c_str());
orbFrame->sBody = sbody;
orbFrame->m_sBody = sbody;
orbFrame->SetRadius(10*sbody->GetRadius());
assert(sbody->GetRotationPeriod() != 0);
@ -87,7 +87,7 @@ static Frame* MakeFrameFor(StarSystem::SBody* sbody, Body* b, Frame* f) {
case StarSystem::SUPERTYPE_STAR:
default:
orbFrame = new Frame(f, sbody->name.c_str());
orbFrame->sBody = sbody;
orbFrame->m_sBody = sbody;
orbFrame->SetRadius(1.2*sbody->GetRadius());
b->SetFrame(orbFrame);
return orbFrame;
@ -121,7 +121,7 @@ just_make_child:
}
void Space::BuildSystem(void) {
GenBody(L3D::current_system->rootBody, rootFrame);
GenBody(L3D::currentSystem->rootBody, rootFrame);
MoveOrbitingObjectFrames(rootFrame);
}

View File

@ -33,7 +33,7 @@ SpaceStationView::SpaceStationView(void) : View() {
void SpaceStationView::OnClickRequestLaunch(void) {
L3D::player->SetDockedWith(0);
L3D::SetView(L3D::world_view);
L3D::SetView(L3D::worldView);
}
void SpaceStationView::Draw3D(void) {

View File

@ -78,7 +78,9 @@ public:
};
struct SBody {
class SBody {
public:
friend class StarSystem;
~SBody(void);
void EliminateBadChildren(void); /* :D */
void PickPlanetType(SBody*, fixed distToPrimary, MTRand& drand, bool genMoons);
@ -117,6 +119,9 @@ public:
BodySuperType supertype;
BodyType type;
private:
};
SBody* rootBody;

View File

@ -166,7 +166,7 @@ void SystemView::Draw3D(void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
int sector_x, sector_y, system_idx;
L3D::sector_view->GetSelectedSystem(&sector_x, &sector_y, &system_idx);
L3D::sectorView->GetSelectedSystem(&sector_x, &sector_y, &system_idx);
if(m_system) {
if(!m_system->IsSystem(sector_x, sector_y, system_idx)) {
delete m_system;