From 2a86fbb1c1fd258e7300b434821f2c3a96e16943 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 11 May 2017 23:29:26 +1000 Subject: [PATCH] kill off // comments --- src/Client/Block.c | 15 +++++++-------- src/Client/Client.vcxproj | 1 + src/Client/Client.vcxproj.filters | 9 ++++++--- src/Client/Compiler.h | 12 ++++++------ src/Client/D3D9Api.c | 8 +++----- src/Client/FastColour.h | 2 +- src/Client/GraphicsAPI.h | 2 +- src/Client/GraphicsCommon.c | 6 +++--- src/Client/Matrix.h | 2 +- src/Client/Random.c | 3 --- src/Client/Typedefs.h | 3 +++ src/Client/VertexStructs.h | 4 ++-- src/Client/WinPlatform.c | 6 +++--- src/Client/World.h | 2 +- 14 files changed, 38 insertions(+), 37 deletions(-) diff --git a/src/Client/Block.c b/src/Client/Block.c index 80f9d4fac..c9ef42d91 100644 --- a/src/Client/Block.c +++ b/src/Client/Block.c @@ -6,7 +6,7 @@ void Block_Reset(Game* game) { Block_Init(); /* TODO: Make this part of TerrainAtlas2D maybe? */ - //Block_RecalculateSpriteBB(game->TerrainAtlas.AtlasBitmap); + /* Block_RecalculateSpriteBB(game->TerrainAtlas.AtlasBitmap); */ } void Block_Init() { @@ -105,7 +105,7 @@ void Block_ResetProps(BlockID block) { } Int32 Block_FindID(String* name) { - for (Int32 i = 0; i < Block_Count; i++) { + for (Int32 i = BlockID_Air; i < Block_Count; i++) { if (String_CaselessEquals(&Block_Name[i], name)) return i; } return -1; @@ -140,7 +140,6 @@ String Block_DefaultName(BlockID block) { } static void Block_SplitUppercase(String* buffer, String* blockNames, Int32 start, Int32 end) { - Int32 index = 0; for (Int32 i = start; i < end; i++) { UInt8 c = String_CharAt(blockNames, i); bool upper = Char_IsUpper(c) && i > start; @@ -244,7 +243,7 @@ UInt8 Block_CalcLightOffset(BlockID block) { } void Block_RecalculateSpriteBB(Bitmap* bmp) { - for (Int32 i = 0; i < Block_Count; i++) { + for (Int32 i = BlockID_Air; i < Block_Count; i++) { if (Block_Draw[i] != DrawType_Sprite) continue; Block_RecalculateBB((BlockID)i, bmp); } @@ -320,11 +319,11 @@ Real32 Block_GetSpriteBB_RightX(Int32 size, Int32 tileX, Int32 tileY, Bitmap* bm void Block_UpdateCullingAll() { - for (Int32 block = 0; block < Block_Count; block++) + for (Int32 block = BlockID_Air; block < Block_Count; block++) Block_CanStretch[block] = 0x3F; - for (Int32 block = 1; block < Block_Count; block++) { - for (Int32 neighbour = 1; neighbour < Block_Count; neighbour++) { + for (Int32 block = BlockID_Air; block < Block_Count; block++) { + for (Int32 neighbour = BlockID_Air; neighbour < Block_Count; neighbour++) { Block_CalcCulling((BlockID)block, (BlockID)neighbour); } } @@ -333,7 +332,7 @@ void Block_UpdateCullingAll() { void Block_UpdateCulling(BlockID block) { Block_CanStretch[block] = 0x3F; - for (Int32 other = 1; other < Block_Count; other++) { + for (Int32 other = BlockID_Air; other < Block_Count; other++) { Block_CalcCulling(block, (BlockID)other); Block_CalcCulling((BlockID)other, block); } diff --git a/src/Client/Client.vcxproj b/src/Client/Client.vcxproj index 5120958d0..c3d9b36db 100644 --- a/src/Client/Client.vcxproj +++ b/src/Client/Client.vcxproj @@ -210,6 +210,7 @@ + diff --git a/src/Client/Client.vcxproj.filters b/src/Client/Client.vcxproj.filters index a35ddeebc..b9d77f10d 100644 --- a/src/Client/Client.vcxproj.filters +++ b/src/Client/Client.vcxproj.filters @@ -93,9 +93,6 @@ Header Files\Defines - - Header Files\Defines - Header Files\Platform @@ -171,6 +168,9 @@ Header Files\Events + + Header Files\Utils + @@ -239,5 +239,8 @@ Source Files\Math + + Source Files\Utils + \ No newline at end of file diff --git a/src/Client/Compiler.h b/src/Client/Compiler.h index fa5de8a8c..8441c5e70 100644 --- a/src/Client/Compiler.h +++ b/src/Client/Compiler.h @@ -6,12 +6,12 @@ */ -// The following ifdef block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the CLIENT_EXPORTS -// symbol defined on the command line. This symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// CLIENT_API functions as being imported from a DLL, whereas this DLL sees symbols -// defined with this macro as being exported. +/* The following ifdef block is the standard way of creating macros which make exporting + from a DLL simpler. All files within this DLL are compiled with the CLIENT_EXPORTS + symbol defined on the command line. This symbol should not be defined on any project + that uses this DLL. This way any other project whose source files include this file see + CLIENT_API functions as being imported from a DLL, whereas this DLL sees symbols + defined with this macro as being exported.*/ #ifdef CLIENT_EXPORTS #define CLIENT_FUNC __declspec(dllexport) diff --git a/src/Client/D3D9Api.c b/src/Client/D3D9Api.c index 32c976e78..c9f43353b 100644 --- a/src/Client/D3D9Api.c +++ b/src/Client/D3D9Api.c @@ -1,10 +1,8 @@ -// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3 #include "GraphicsAPI.h" #include "D3D9Api.h" #include "ErrorHandler.h" #include "GraphicsEnums.h" -#define USE_DX true #ifdef USE_DX IDirect3D9* d3d; @@ -23,7 +21,7 @@ ErrorHandler_CheckOrFail(hresult, name) void Gfx_Init(Game* game) { - // TODO: EVERYTHING ELSE + /* TODO: EVERYTHING ELSE */ viewStack.Type = D3DTS_VIEW; projStack.Type = D3DTS_PROJECTION; texStack.Type = D3DTS_TEXTURE0; @@ -45,7 +43,7 @@ void Gfx_SetFog(bool enabled) { D3D9_SetRenderState((UInt32)enabled, D3DRS_FOGENABLE, "D3D9_SetFog"); } -UInt32 d3d9_fogCol = 0xFF000000; // black +UInt32 d3d9_fogCol = 0xFF000000; /* black */ void Gfx_SetFogColour(FastColour col) { if (col.Packed == d3d9_fogCol) return; @@ -179,7 +177,7 @@ void Gfx_SetMatrixMode(Int32 matrixType) { void Gfx_LoadMatrix(Matrix* matrix) { if (curStack == &texStack) { - matrix->Row2.X = matrix->Row3.X; // NOTE: this hack fixes the texture movements. + matrix->Row2.X = matrix->Row3.X; /* NOTE: this hack fixes the texture movements. */ IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2); } diff --git a/src/Client/FastColour.h b/src/Client/FastColour.h index 77093be3f..370aa0952 100644 --- a/src/Client/FastColour.h +++ b/src/Client/FastColour.h @@ -30,6 +30,6 @@ bool FastColour_Equals(FastColour a, FastColour b); /* Multiplies the RGB components by t, where t is in [0, 1] */ FastColour FastColour_Scale(FastColour value, Real32 t); -// TODO: actual constant values? may need to rethink FastColour +/* TODO: actual constant values? may need to rethink FastColour */ #define FastColour_White FastColour_Create3(255, 255, 255) #endif \ No newline at end of file diff --git a/src/Client/GraphicsAPI.h b/src/Client/GraphicsAPI.h index a84c1e334..59df69385 100644 --- a/src/Client/GraphicsAPI.h +++ b/src/Client/GraphicsAPI.h @@ -37,7 +37,7 @@ Int32 Gfx_ContextLostCount; Event_Void Gfx_ContextRecreated[EventHandler_Size]; Int32 Gfx_ContextRecreatedCount; -// TODO: IMPLEMENT THIS +/* TODO: IMPLEMENT THIS */ /* /// Delegate that is invoked when the current context is lost, /// and is repeatedly invoked until the context can be retrieved. public Action LostContextFunction;*/ diff --git a/src/Client/GraphicsCommon.c b/src/Client/GraphicsCommon.c index cfd637012..299b244b2 100644 --- a/src/Client/GraphicsCommon.c +++ b/src/Client/GraphicsCommon.c @@ -77,8 +77,8 @@ void GfxCommon_Draw2DTexture(Texture* tex, FastColour col) { void GfxCommon_Make2DQuad(Texture* tex, FastColour col, VertexP3fT2fC4b** vertices) { Real32 x1 = tex->X, y1 = tex->Y, x2 = tex->X + tex->Width, y2 = tex->Y + tex->Height; #if USE_DX - // NOTE: see "https://msdn.microsoft.com/en-us/library/windows/desktop/bb219690(v=vs.85).aspx", - // i.e. the msdn article called "Directly Mapping Texels to Pixels (Direct3D 9)" for why we have to do this. + /* NOTE: see "https://msdn.microsoft.com/en-us/library/windows/desktop/bb219690(v=vs.85).aspx", + // i.e. the msdn article called "Directly Mapping Texels to Pixels (Direct3D 9)" for why we have to do this. */ x1 -= 0.5f; x2 -= 0.5f; y1 -= 0.5f; y2 -= 0.5f; #endif @@ -103,7 +103,7 @@ void GfxCommon_Mode2D(Real32 width, Real32 height, bool setFog) { void GfxCommon_Mode3D(bool setFog) { Gfx_SetMatrixMode(MatrixType_Projection); - Gfx_PopMatrix(); // Get rid of orthographic 2D matrix. + Gfx_PopMatrix(); /* Get rid of orthographic 2D matrix. */ Gfx_SetMatrixMode(MatrixType_Modelview); Gfx_PopMatrix(); diff --git a/src/Client/Matrix.h b/src/Client/Matrix.h index 4894d4cda..01f3d92f4 100644 --- a/src/Client/Matrix.h +++ b/src/Client/Matrix.h @@ -5,7 +5,7 @@ Copyright 2017 ClassicalSharp | Licensed under BSD-3 */ -// forward declaration +/* forward declaration */ typedef struct Vector3_ Vector3; typedef struct Vector4 { Real32 X, Y, Z, W; } Vector4; diff --git a/src/Client/Random.c b/src/Client/Random.c index 846b971a8..783ab4c28 100644 --- a/src/Client/Random.c +++ b/src/Client/Random.c @@ -1,7 +1,4 @@ -// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3 #include "Random.h" - -// Based on https://docs.oracle.com/javase/7/docs/api/java/util/Random.html #define value (0x5DEECE66DLL) #define mask ((1LL << 48) - 1) diff --git a/src/Client/Typedefs.h b/src/Client/Typedefs.h index 6a53ad460..1406ae9c0 100644 --- a/src/Client/Typedefs.h +++ b/src/Client/Typedefs.h @@ -42,4 +42,7 @@ typedef UInt8 EntityID; #define USE16_BIT FALSE #define STRING_SIZE 64 + +// TODO: put this in project defines, not here +#define USE_DX true #endif \ No newline at end of file diff --git a/src/Client/VertexStructs.h b/src/Client/VertexStructs.h index b0ac53116..7d52a0279 100644 --- a/src/Client/VertexStructs.h +++ b/src/Client/VertexStructs.h @@ -15,7 +15,7 @@ typedef struct VertexP3fC4b { void VertexP3C4b_Set(VertexP3fC4b* target, Real32 x, Real32 y, Real32 z, FastColour col); -// 3 * 4 + 4 * 1 +/* 3 * 4 + 4 * 1 */ #define VertexP3fC4b_Size 16 @@ -29,6 +29,6 @@ typedef struct VertexP3fT2fC4b { void VertexP3fT2fC4b_Set(VertexP3fT2fC4b* target, Real32 x, Real32 y, Real32 z, Real32 u, Real32 v, FastColour col); -// 3 * 4 + 2 * 4 + 4 * 1 +/* 3 * 4 + 2 * 4 + 4 * 1 */ #define VertexP3fT2fC4b_Size 24; #endif \ No newline at end of file diff --git a/src/Client/WinPlatform.c b/src/Client/WinPlatform.c index f8d83041a..9161aec6a 100644 --- a/src/Client/WinPlatform.c +++ b/src/Client/WinPlatform.c @@ -21,7 +21,7 @@ void Platform_MemFree(void* mem) { void Platform_MemSet(void* dst, UInt8 value, UInt32 numBytes) { UInt8* dstByte = (UInt8*)dst; - // TODO: massively slow + /* TODO: massively slow */ for (UInt32 i = 0; i < numBytes; i++) { *dstByte++ = value; } @@ -30,7 +30,7 @@ void Platform_MemSet(void* dst, UInt8 value, UInt32 numBytes) { void Platform_MemCpy(void* dst, void* src, UInt32 numBytes) { UInt8* dstByte = (UInt8*)dst; UInt8* srcByte = (UInt8*)src; - // TODO: massively slow + /* TODO: massively slow */ for (UInt32 i = 0; i < numBytes; i++) { *dstByte++ = *srcByte++; } @@ -38,7 +38,7 @@ void Platform_MemCpy(void* dst, void* src, UInt32 numBytes) { void Platform_Log(String message) { - // TODO: log to console + /* TODO: log to console */ } diff --git a/src/Client/World.h b/src/Client/World.h index d482b4798..1f8872a59 100644 --- a/src/Client/World.h +++ b/src/Client/World.h @@ -38,7 +38,7 @@ UInt8 World_Uuid[16]; /* Current terrain.png or texture pack url of this map. */ String World_TextureUrl; -// TODO: how to initalise this string +/* TODO: how to initalise this string */ /* Resets all of the properties to their defaults. */