kill off // comments

This commit is contained in:
UnknownShadow200 2017-05-11 23:29:26 +10:00
parent 4bf6bbf054
commit 2a86fbb1c1
14 changed files with 38 additions and 37 deletions

View File

@ -6,7 +6,7 @@
void Block_Reset(Game* game) { void Block_Reset(Game* game) {
Block_Init(); Block_Init();
/* TODO: Make this part of TerrainAtlas2D maybe? */ /* TODO: Make this part of TerrainAtlas2D maybe? */
//Block_RecalculateSpriteBB(game->TerrainAtlas.AtlasBitmap); /* Block_RecalculateSpriteBB(game->TerrainAtlas.AtlasBitmap); */
} }
void Block_Init() { void Block_Init() {
@ -105,7 +105,7 @@ void Block_ResetProps(BlockID block) {
} }
Int32 Block_FindID(String* name) { 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; if (String_CaselessEquals(&Block_Name[i], name)) return i;
} }
return -1; return -1;
@ -140,7 +140,6 @@ String Block_DefaultName(BlockID block) {
} }
static void Block_SplitUppercase(String* buffer, String* blockNames, Int32 start, Int32 end) { static void Block_SplitUppercase(String* buffer, String* blockNames, Int32 start, Int32 end) {
Int32 index = 0;
for (Int32 i = start; i < end; i++) { for (Int32 i = start; i < end; i++) {
UInt8 c = String_CharAt(blockNames, i); UInt8 c = String_CharAt(blockNames, i);
bool upper = Char_IsUpper(c) && i > start; bool upper = Char_IsUpper(c) && i > start;
@ -244,7 +243,7 @@ UInt8 Block_CalcLightOffset(BlockID block) {
} }
void Block_RecalculateSpriteBB(Bitmap* bmp) { 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; if (Block_Draw[i] != DrawType_Sprite) continue;
Block_RecalculateBB((BlockID)i, bmp); Block_RecalculateBB((BlockID)i, bmp);
} }
@ -320,11 +319,11 @@ Real32 Block_GetSpriteBB_RightX(Int32 size, Int32 tileX, Int32 tileY, Bitmap* bm
void Block_UpdateCullingAll() { void Block_UpdateCullingAll() {
for (Int32 block = 0; block < Block_Count; block++) for (Int32 block = BlockID_Air; block < Block_Count; block++)
Block_CanStretch[block] = 0x3F; Block_CanStretch[block] = 0x3F;
for (Int32 block = 1; block < Block_Count; block++) { for (Int32 block = BlockID_Air; block < Block_Count; block++) {
for (Int32 neighbour = 1; neighbour < Block_Count; neighbour++) { for (Int32 neighbour = BlockID_Air; neighbour < Block_Count; neighbour++) {
Block_CalcCulling((BlockID)block, (BlockID)neighbour); Block_CalcCulling((BlockID)block, (BlockID)neighbour);
} }
} }
@ -333,7 +332,7 @@ void Block_UpdateCullingAll() {
void Block_UpdateCulling(BlockID block) { void Block_UpdateCulling(BlockID block) {
Block_CanStretch[block] = 0x3F; 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(block, (BlockID)other);
Block_CalcCulling((BlockID)other, block); Block_CalcCulling((BlockID)other, block);
} }

View File

@ -210,6 +210,7 @@
<ClCompile Include="EventHandler.c" /> <ClCompile Include="EventHandler.c" />
<ClCompile Include="ExtMath.c" /> <ClCompile Include="ExtMath.c" />
<ClCompile Include="FastColour.c" /> <ClCompile Include="FastColour.c" />
<ClCompile Include="Funcs.c" />
<ClCompile Include="GraphicsCommon.c" /> <ClCompile Include="GraphicsCommon.c" />
<ClCompile Include="Matrix.c" /> <ClCompile Include="Matrix.c" />
<ClCompile Include="Noise.c" /> <ClCompile Include="Noise.c" />

View File

@ -93,9 +93,6 @@
<ClInclude Include="Compiler.h"> <ClInclude Include="Compiler.h">
<Filter>Header Files\Defines</Filter> <Filter>Header Files\Defines</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Funcs.h">
<Filter>Header Files\Defines</Filter>
</ClInclude>
<ClInclude Include="Platform.h"> <ClInclude Include="Platform.h">
<Filter>Header Files\Platform</Filter> <Filter>Header Files\Platform</Filter>
</ClInclude> </ClInclude>
@ -171,6 +168,9 @@
<ClInclude Include="WorldEvents.h"> <ClInclude Include="WorldEvents.h">
<Filter>Header Files\Events</Filter> <Filter>Header Files\Events</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Funcs.h">
<Filter>Header Files\Utils</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="NotchyGenerator.c"> <ClCompile Include="NotchyGenerator.c">
@ -239,5 +239,8 @@
<ClCompile Include="VertexStructs.c"> <ClCompile Include="VertexStructs.c">
<Filter>Source Files\Math</Filter> <Filter>Source Files\Math</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Funcs.c">
<Filter>Source Files\Utils</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -6,12 +6,12 @@
*/ */
// The following ifdef block is the standard way of creating macros which make exporting /* 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 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 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 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 CLIENT_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported. defined with this macro as being exported.*/
#ifdef CLIENT_EXPORTS #ifdef CLIENT_EXPORTS
#define CLIENT_FUNC __declspec(dllexport) #define CLIENT_FUNC __declspec(dllexport)

View File

@ -1,10 +1,8 @@
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
#include "GraphicsAPI.h" #include "GraphicsAPI.h"
#include "D3D9Api.h" #include "D3D9Api.h"
#include "ErrorHandler.h" #include "ErrorHandler.h"
#include "GraphicsEnums.h" #include "GraphicsEnums.h"
#define USE_DX true
#ifdef USE_DX #ifdef USE_DX
IDirect3D9* d3d; IDirect3D9* d3d;
@ -23,7 +21,7 @@ ErrorHandler_CheckOrFail(hresult, name)
void Gfx_Init(Game* game) { void Gfx_Init(Game* game) {
// TODO: EVERYTHING ELSE /* TODO: EVERYTHING ELSE */
viewStack.Type = D3DTS_VIEW; viewStack.Type = D3DTS_VIEW;
projStack.Type = D3DTS_PROJECTION; projStack.Type = D3DTS_PROJECTION;
texStack.Type = D3DTS_TEXTURE0; texStack.Type = D3DTS_TEXTURE0;
@ -45,7 +43,7 @@ void Gfx_SetFog(bool enabled) {
D3D9_SetRenderState((UInt32)enabled, D3DRS_FOGENABLE, "D3D9_SetFog"); D3D9_SetRenderState((UInt32)enabled, D3DRS_FOGENABLE, "D3D9_SetFog");
} }
UInt32 d3d9_fogCol = 0xFF000000; // black UInt32 d3d9_fogCol = 0xFF000000; /* black */
void Gfx_SetFogColour(FastColour col) { void Gfx_SetFogColour(FastColour col) {
if (col.Packed == d3d9_fogCol) return; if (col.Packed == d3d9_fogCol) return;
@ -179,7 +177,7 @@ void Gfx_SetMatrixMode(Int32 matrixType) {
void Gfx_LoadMatrix(Matrix* matrix) { void Gfx_LoadMatrix(Matrix* matrix) {
if (curStack == &texStack) { 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); IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2);
} }

View File

@ -30,6 +30,6 @@ bool FastColour_Equals(FastColour a, FastColour b);
/* Multiplies the RGB components by t, where t is in [0, 1] */ /* Multiplies the RGB components by t, where t is in [0, 1] */
FastColour FastColour_Scale(FastColour value, Real32 t); 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) #define FastColour_White FastColour_Create3(255, 255, 255)
#endif #endif

View File

@ -37,7 +37,7 @@ Int32 Gfx_ContextLostCount;
Event_Void Gfx_ContextRecreated[EventHandler_Size]; Event_Void Gfx_ContextRecreated[EventHandler_Size];
Int32 Gfx_ContextRecreatedCount; Int32 Gfx_ContextRecreatedCount;
// TODO: IMPLEMENT THIS /* TODO: IMPLEMENT THIS */
/* /// <summary> Delegate that is invoked when the current context is lost, /* /// <summary> Delegate that is invoked when the current context is lost,
/// and is repeatedly invoked until the context can be retrieved. </summary> /// and is repeatedly invoked until the context can be retrieved. </summary>
public Action<ScheduledTask> LostContextFunction;*/ public Action<ScheduledTask> LostContextFunction;*/

View File

@ -77,8 +77,8 @@ void GfxCommon_Draw2DTexture(Texture* tex, FastColour col) {
void GfxCommon_Make2DQuad(Texture* tex, FastColour col, VertexP3fT2fC4b** vertices) { 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; Real32 x1 = tex->X, y1 = tex->Y, x2 = tex->X + tex->Width, y2 = tex->Y + tex->Height;
#if USE_DX #if USE_DX
// NOTE: see "https://msdn.microsoft.com/en-us/library/windows/desktop/bb219690(v=vs.85).aspx", /* 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. // 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; x1 -= 0.5f; x2 -= 0.5f;
y1 -= 0.5f; y2 -= 0.5f; y1 -= 0.5f; y2 -= 0.5f;
#endif #endif
@ -103,7 +103,7 @@ void GfxCommon_Mode2D(Real32 width, Real32 height, bool setFog) {
void GfxCommon_Mode3D(bool setFog) { void GfxCommon_Mode3D(bool setFog) {
Gfx_SetMatrixMode(MatrixType_Projection); 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_SetMatrixMode(MatrixType_Modelview);
Gfx_PopMatrix(); Gfx_PopMatrix();

View File

@ -5,7 +5,7 @@
Copyright 2017 ClassicalSharp | Licensed under BSD-3 Copyright 2017 ClassicalSharp | Licensed under BSD-3
*/ */
// forward declaration /* forward declaration */
typedef struct Vector3_ Vector3; typedef struct Vector3_ Vector3;
typedef struct Vector4 { Real32 X, Y, Z, W; } Vector4; typedef struct Vector4 { Real32 X, Y, Z, W; } Vector4;

View File

@ -1,7 +1,4 @@
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
#include "Random.h" #include "Random.h"
// Based on https://docs.oracle.com/javase/7/docs/api/java/util/Random.html
#define value (0x5DEECE66DLL) #define value (0x5DEECE66DLL)
#define mask ((1LL << 48) - 1) #define mask ((1LL << 48) - 1)

View File

@ -42,4 +42,7 @@ typedef UInt8 EntityID;
#define USE16_BIT FALSE #define USE16_BIT FALSE
#define STRING_SIZE 64 #define STRING_SIZE 64
// TODO: put this in project defines, not here
#define USE_DX true
#endif #endif

View File

@ -15,7 +15,7 @@ typedef struct VertexP3fC4b {
void VertexP3C4b_Set(VertexP3fC4b* target, Real32 x, Real32 y, Real32 z, FastColour col); 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 #define VertexP3fC4b_Size 16
@ -29,6 +29,6 @@ typedef struct VertexP3fT2fC4b {
void VertexP3fT2fC4b_Set(VertexP3fT2fC4b* target, Real32 x, Real32 y, Real32 z, void VertexP3fT2fC4b_Set(VertexP3fT2fC4b* target, Real32 x, Real32 y, Real32 z,
Real32 u, Real32 v, FastColour col); Real32 u, Real32 v, FastColour col);
// 3 * 4 + 2 * 4 + 4 * 1 /* 3 * 4 + 2 * 4 + 4 * 1 */
#define VertexP3fT2fC4b_Size 24; #define VertexP3fT2fC4b_Size 24;
#endif #endif

View File

@ -21,7 +21,7 @@ void Platform_MemFree(void* mem) {
void Platform_MemSet(void* dst, UInt8 value, UInt32 numBytes) { void Platform_MemSet(void* dst, UInt8 value, UInt32 numBytes) {
UInt8* dstByte = (UInt8*)dst; UInt8* dstByte = (UInt8*)dst;
// TODO: massively slow /* TODO: massively slow */
for (UInt32 i = 0; i < numBytes; i++) { for (UInt32 i = 0; i < numBytes; i++) {
*dstByte++ = value; *dstByte++ = value;
} }
@ -30,7 +30,7 @@ void Platform_MemSet(void* dst, UInt8 value, UInt32 numBytes) {
void Platform_MemCpy(void* dst, void* src, UInt32 numBytes) { void Platform_MemCpy(void* dst, void* src, UInt32 numBytes) {
UInt8* dstByte = (UInt8*)dst; UInt8* dstByte = (UInt8*)dst;
UInt8* srcByte = (UInt8*)src; UInt8* srcByte = (UInt8*)src;
// TODO: massively slow /* TODO: massively slow */
for (UInt32 i = 0; i < numBytes; i++) { for (UInt32 i = 0; i < numBytes; i++) {
*dstByte++ = *srcByte++; *dstByte++ = *srcByte++;
} }
@ -38,7 +38,7 @@ void Platform_MemCpy(void* dst, void* src, UInt32 numBytes) {
void Platform_Log(String message) { void Platform_Log(String message) {
// TODO: log to console /* TODO: log to console */
} }

View File

@ -38,7 +38,7 @@ UInt8 World_Uuid[16];
/* Current terrain.png or texture pack url of this map. */ /* Current terrain.png or texture pack url of this map. */
String World_TextureUrl; String World_TextureUrl;
// TODO: how to initalise this string /* TODO: how to initalise this string */
/* Resets all of the properties to their defaults. */ /* Resets all of the properties to their defaults. */