Skip to content

Commit

Permalink
Minor tidying up
Browse files Browse the repository at this point in the history
Minor changes to header include lines and some formatting clean up.
  • Loading branch information
Rexhunter99 committed Jan 28, 2022
1 parent 4622db2 commit 4bc1035
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 78 deletions.
3 changes: 2 additions & 1 deletion C3Dit.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v100</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
11 changes: 6 additions & 5 deletions Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//#include "Model.h"

#include <string>
using namespace std;


class Globals
Expand All @@ -22,10 +21,10 @@ class Globals
~Globals(){}

//Global Variables
string GameLocation;
string WorkingDirectory;
string EnvironmentMap;
string SpecularMap;
std::string GameLocation;
std::string WorkingDirectory;
std::string EnvironmentMap;
std::string SpecularMap;

int WinX, WinY, WinW, WinH;
bool Maximized;
Expand All @@ -39,6 +38,8 @@ class GlobalVariables
private:

GlobalVariables(){}
GlobalVariables(const GlobalVariables&) = delete;
GlobalVariables(GlobalVariables&&) = delete;

public:

Expand Down
9 changes: 4 additions & 5 deletions Ini.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

#include "header.h"
#include "Ini.h"
#include <stdio.h>
#include <cstdio>
#include <cstdlib>


//===========================================================//
Expand Down Expand Up @@ -142,12 +143,10 @@ INIFILE::~INIFILE()

fp = fopen( Name.c_str(), "w" );

for ( int s=0; s<Groups.size(); ++s )
{
for (auto s = 0u; s<Groups.size(); ++s ) {
fprintf( fp, "[%s]\n", Groups[s].mName.c_str() );

for ( int k=0; k<Groups[s].mKeys.size(); ++k )
{
for (auto k=0u; k<Groups[s].mKeys.size(); ++k ) {
fprintf( fp, "%s=%s\n", Groups[s].mKeys[k].mName.c_str(), Groups[s].mKeys[k].mValue.c_str() );
}

Expand Down
10 changes: 5 additions & 5 deletions header.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

#include <windows.h>
#include <commctrl.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glext.h>
#include <math.h>
#include <stdio.h>
#include <gl/GL.h>
#include <gl/GLU.h>
#include <gl/GLEXT.h>
#include <cmath>
#include <cstdio>

#include "version.h"
#include "Ini.h"
Expand Down
77 changes: 15 additions & 62 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#include <vector>
#include <string>

using namespace std;


string statMessages[] = {
"Holding the right mouse button lets you orbit the object!",
Expand All @@ -40,7 +38,6 @@ void LoadCARData(char*);
void LoadC2OData(char*);
void Load3DFData(char*);
void LoadOBJData(char*);
void SaveEZJSOBJData(char *);


BOOL CALLBACK AniDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
Expand Down Expand Up @@ -498,21 +495,19 @@ int WINAPI WinMain(HINSTANCE hInstance,

g_TVItems.clear();

{
gIniFile->SetValueString( "General", "gamedir", GlobalData->GameLocation );
gIniFile->SetValueString( "General", "envmap", GlobalData->EnvironmentMap );
gIniFile->SetValueString( "General", "specular", GlobalData->SpecularMap );
gIniFile->SetValueInt( "General", "software", false );

gIniFile->SetValueInt( "Window", "left", WinX );
gIniFile->SetValueInt( "Window", "top", WinY );
gIniFile->SetValueInt( "Window", "width", WinW );
gIniFile->SetValueInt( "Window", "height", WinH );

gIniFile->SetValueInt( "OpenGL", "color", GlobalData->BufferColorBits );
gIniFile->SetValueInt( "OpenGL", "depth", GlobalData->BufferDepthBits );
gIniFile->SetValueInt( "OpenGL", "mipmaps", GlobalData->UseMipMaps );
}
gIniFile->SetValueString( "General", "gamedir", GlobalData->GameLocation );
gIniFile->SetValueString( "General", "envmap", GlobalData->EnvironmentMap );
gIniFile->SetValueString( "General", "specular", GlobalData->SpecularMap );
gIniFile->SetValueInt( "General", "software", false );

gIniFile->SetValueInt( "Window", "left", WinX );
gIniFile->SetValueInt( "Window", "top", WinY );
gIniFile->SetValueInt( "Window", "width", WinW );
gIniFile->SetValueInt( "Window", "height", WinH );

gIniFile->SetValueInt( "OpenGL", "color", GlobalData->BufferColorBits );
gIniFile->SetValueInt( "OpenGL", "depth", GlobalData->BufferDepthBits );
gIniFile->SetValueInt( "OpenGL", "mipmaps", GlobalData->UseMipMaps );

delete gIniFile;

Expand Down Expand Up @@ -622,6 +617,7 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

if (ParItem == rootNodes[TV_ANIMATIONS]) // Animations
{
// TODO:
CUR_ANIM = ((UINT)nmtv->itemNew.lParam - (UINT)&g_Animations[0]) / sizeof(TVtl);
CUR_FRAME = 0;
SendMessage(g_AniTrack, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(0, ( g_Animations[CUR_ANIM].FrameCount-1 ) ) );
Expand Down Expand Up @@ -1752,6 +1748,7 @@ void LoadCARData(char* fname)
hResMenu = GetSubMenu(hMenu, 0);
EnableMenuItem(hResMenu, IDF_SAVEAS, MF_BYCOMMAND | (TRUE ? MF_ENABLED : MF_GRAYED));*/

RedrawWindow(g_FileView, nullptr, nullptr, RDW_UPDATENOW);
UpdateWindow(g_FileView);
UpdateWindow(g_hMain);
}
Expand Down Expand Up @@ -2002,7 +1999,6 @@ void loadCAR()
char sstr[64];
sprintf(sstr,"Triangles: %u",(UINT)Model.num_tris);
SendMessage(gHStatus, SB_SETTEXT, 0, (LPARAM)sstr);
MessageBox(g_hMain,sstr,"triangles",MB_OK);
return;
}

Expand Down Expand Up @@ -2148,45 +2144,6 @@ void SaveOBJData(char *fname)
return;
}

void SaveEZJSOBJData(char *fname)
{
// -- Saves the mesh as an EpicZenVideo-JS primitive script
FILE *fp = fopen(fname,"w");

fprintf(fp, "function Create_%s_Primitive()\n{\n", Model.name);

fprintf(fp, "\tmesh = new EZprimitive( EZPT_TRIANGLES );\n", Model.name);

for (int t=0; t<Model.num_tris; t++)
{
fprintf(fp, "\tmesh.AddVertex( %f, %f, %f, [1.0, 1.0, 1.0, 1.0], null, [ %f, %f ] );\n",
g_Verticies[ g_Triangles[t].v1 ].mX,
g_Verticies[ g_Triangles[t].v1 ].mY,
g_Verticies[ g_Triangles[t].v1 ].mZ,
g_Triangles[t].tx1 / 255.0f,
g_Triangles[t].ty1 / 255.0f);
fprintf(fp, "\tmesh.AddVertex( %f, %f, %f, [1.0, 1.0, 1.0, 1.0], null, [ %f, %f ] );\n",
g_Verticies[ g_Triangles[t].v2 ].mX,
g_Verticies[ g_Triangles[t].v2 ].mY,
g_Verticies[ g_Triangles[t].v2 ].mZ,
g_Triangles[t].tx2 / 255.0f,
g_Triangles[t].ty2 / 255.0f);
fprintf(fp, "\tmesh.AddVertex( %f, %f, %f, [1.0, 1.0, 1.0, 1.0], null, [ %f, %f ] );\n",
g_Verticies[ g_Triangles[t].v3 ].mX,
g_Verticies[ g_Triangles[t].v3 ].mY,
g_Verticies[ g_Triangles[t].v3 ].mZ,
g_Triangles[t].tx3 / 255.0f,
g_Triangles[t].ty3 / 255.0f);
}

fprintf( fp, "\tmesh.End();\n" );
fprintf( fp, "}\n" );

fclose(fp);

return;
}

void LoadOBJData(char *fname)
{
// -- Supports Triangulated (preferred) or quadulated geometry
Expand Down Expand Up @@ -2625,10 +2582,6 @@ void SaveProject()
{
SaveOBJData(fileName);
}
if ( strstr(_strlwr(fileName),".js") )
{
SaveEZJSOBJData(fileName);
}
}


Expand Down

0 comments on commit 4bc1035

Please sign in to comment.