Update some headers to 2022 and improve their comments

This commit is contained in:
UnknownShadow200 2022-06-14 21:13:23 +10:00
parent 2ee4a911d0
commit ec2d69a6d9
27 changed files with 111 additions and 79 deletions

View File

@ -1,7 +1,8 @@
#ifndef CC_ANIMATIONS_H #ifndef CC_ANIMATIONS_H
#define CC_ANIMATIONS_H #define CC_ANIMATIONS_H
/* Contains everything relating to texture animations (including default water/lava ones) /*
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Contains everything relating to texture animations (including default water/lava ones)
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
struct IGameComponent; struct IGameComponent;

View File

@ -1,12 +1,13 @@
#ifndef CC_BUILDER_H #ifndef CC_BUILDER_H
#define CC_BUILDER_H #define CC_BUILDER_H
#include "Core.h" #include "Core.h"
/* Converts a 16x16x16 chunk into a mesh of vertices. /*
Converts a 16x16x16 chunk into a mesh of vertices
NormalMeshBuilder: NormalMeshBuilder:
Implements a simple chunk mesh builder, where each block face is a single colour. Implements a simple chunk mesh builder, where each block face is a single colour
(whatever lighting engine returns as light colour for given block face at given coordinates) (whatever lighting engine returns as light colour for given block face at given coordinates)
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
struct ChunkInfo; struct ChunkInfo;
struct IGameComponent; struct IGameComponent;

View File

@ -1,9 +1,9 @@
#ifndef CC_CAMERA_H #ifndef CC_CAMERA_H
#define CC_CAMERA_H #define CC_CAMERA_H
#include "Vectors.h" #include "Vectors.h"
/*
/* Represents a camera, may be first or third person. Represents a camera, may be first or third person
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
struct RayTracer; struct RayTracer;
struct Camera; struct Camera;

View File

@ -1,7 +1,8 @@
#ifndef CC_CONSTANTS_H #ifndef CC_CONSTANTS_H
#define CC_CONSTANTS_H #define CC_CONSTANTS_H
/* Defines useful constants. /*
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Defines useful constants
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
#define GAME_MAX_CMDARGS 5 #define GAME_MAX_CMDARGS 5

View File

@ -1,7 +1,8 @@
#ifndef CC_CORE_H #ifndef CC_CORE_H
#define CC_CORE_H #define CC_CORE_H
/* Core fixed-size integer types, automatic platform detection, and common small structs. /*
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Core fixed-size integer types, automatic platform detection, and common small structs
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
#if _MSC_VER #if _MSC_VER

View File

@ -2,8 +2,9 @@
#define CC_DRAWER_H #define CC_DRAWER_H
#include "PackedCol.h" #include "PackedCol.h"
#include "Vectors.h" #include "Vectors.h"
/* Draws the vertices for a cuboid region. /*
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Draws the vertices for a cuboid region
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
struct VertexTextured; struct VertexTextured;

View File

@ -1,8 +1,9 @@
#ifndef CC_ENVRENDERER_H #ifndef CC_ENVRENDERER_H
#define CC_ENVRENDERER_H #define CC_ENVRENDERER_H
#include "Core.h" #include "Core.h"
/* Renders environment of the map. (clouds, sky, fog, map sides/edges, skybox, rain/snow) /*
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Renders environment of the map (clouds, sky, fog, map sides/edges, skybox, rain/snow)
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
struct IGameComponent; struct IGameComponent;
extern struct IGameComponent EnvRenderer_Component; extern struct IGameComponent EnvRenderer_Component;

View File

@ -1,7 +1,8 @@
#ifndef CC_ERRORS_H #ifndef CC_ERRORS_H
#define CC_ERRORS_H #define CC_ERRORS_H
/* Contains list of internal ClassiCube errors. /*
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Provides a list list of internal ClassiCube errors
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
/* NOTE: When adding errors, remember to keep Logger.c up to date! */ /* NOTE: When adding errors, remember to keep Logger.c up to date! */

View File

@ -1,9 +1,10 @@
#ifndef CC_FUNCS_H #ifndef CC_FUNCS_H
#define CC_FUNCS_H #define CC_FUNCS_H
#include "Core.h" #include "Core.h"
/* Simple function implementations /*
Simple function implementations
NOTE: doing min(x++, y) etc will increment x twice! NOTE: doing min(x++, y) etc will increment x twice!
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
#define min(x, y) ((x) < (y) ? (x) : (y)) #define min(x, y) ((x) < (y) ? (x) : (y))

View File

@ -1,8 +1,9 @@
#ifndef CC_HELDBLOCKRENDERER_H #ifndef CC_HELDBLOCKRENDERER_H
#define CC_HELDBLOCKRENDERER_H #define CC_HELDBLOCKRENDERER_H
#include "Core.h" #include "Core.h"
/* Implements rendering of held block/arm at bottom right of game. /*
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Renders the held block/arm at bottom right of game
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
struct IGameComponent; struct IGameComponent;
extern struct IGameComponent HeldBlockRenderer_Component; extern struct IGameComponent HeldBlockRenderer_Component;

View File

@ -2,9 +2,10 @@
#define CC_HTTP_H #define CC_HTTP_H
#include "Constants.h" #include "Constants.h"
#include "Core.h" #include "Core.h"
/* Aysnchronously performs http GET, HEAD, and POST requests. /*
Typically this is used to download skins, texture packs, etc. Aysnchronously performs http GET, HEAD, and POST requests
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Typically this is used to download skins, texture packs, etc
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
struct IGameComponent; struct IGameComponent;
struct ScheduledTask; struct ScheduledTask;

View File

@ -1,9 +1,9 @@
#ifndef CC_INPUT_H #ifndef CC_INPUT_H
#define CC_INPUT_H #define CC_INPUT_H
#include "Core.h" #include "Core.h"
/* Manages keyboard, mouse, and touch state. /*
Raises events when keys are pressed etc, and implements base handlers for them. Manages input state, raising input related events, and base input handling
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
struct IGameComponent; struct IGameComponent;
struct StringsBuffer; struct StringsBuffer;

View File

@ -360,12 +360,12 @@ static void ClassicLighting_LightHint(int startX, int startZ) {
} }
} }
static void ClassicLighting_OnReset(void) { static void ClassicLighting_FreeState(void) {
Mem_Free(classic_heightmap); Mem_Free(classic_heightmap);
classic_heightmap = NULL; classic_heightmap = NULL;
} }
static void ClassicLighting_OnNewMapLoaded(void) { static void ClassicLighting_AllocState(void) {
classic_heightmap = (cc_int16*)Mem_TryAlloc(World.Width * World.Length, 2); classic_heightmap = (cc_int16*)Mem_TryAlloc(World.Width * World.Length, 2);
if (classic_heightmap) { if (classic_heightmap) {
ClassicLighting_Refresh(); ClassicLighting_Refresh();
@ -388,8 +388,8 @@ static void ClassicLighting_SetActive(void) {
Lighting.Color_XSide_Fast = ClassicLighting_Color_XSide_Fast; Lighting.Color_XSide_Fast = ClassicLighting_Color_XSide_Fast;
Lighting.Color_ZSide_Fast = ClassicLighting_Color_ZSide_Fast; Lighting.Color_ZSide_Fast = ClassicLighting_Color_ZSide_Fast;
Lighting.HandleReset = ClassicLighting_OnReset; Lighting.FreeState = ClassicLighting_FreeState;
Lighting.HandleNewMapLoaded = ClassicLighting_OnNewMapLoaded; Lighting.AllocState = ClassicLighting_AllocState;
Lighting.LightHint = ClassicLighting_LightHint; Lighting.LightHint = ClassicLighting_LightHint;
} }
@ -399,8 +399,8 @@ static void ClassicLighting_SetActive(void) {
*#########################################################################################################################*/ *#########################################################################################################################*/
static void OnInit(void) { ClassicLighting_SetActive(); } static void OnInit(void) { ClassicLighting_SetActive(); }
static void OnReset(void) { Lighting.HandleReset(); } static void OnReset(void) { Lighting.FreeState(); }
static void OnNewMapLoaded(void) { Lighting.HandleNewMapLoaded(); } static void OnNewMapLoaded(void) { Lighting.AllocState(); }
struct IGameComponent Lighting_Component = { struct IGameComponent Lighting_Component = {
OnInit, /* Init */ OnInit, /* Init */

View File

@ -1,16 +1,22 @@
#ifndef CC_WORLDLIGHTING_H #ifndef CC_WORLDLIGHTING_H
#define CC_WORLDLIGHTING_H #define CC_WORLDLIGHTING_H
#include "PackedCol.h" #include "PackedCol.h"
/* Manages lighting of blocks in the world /*
ClassicLighting: Uses a simple heightmap, where each block is either in sun or shadow. Abstracts lighting of blocks in the world
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Built-in lighting engines:
- ClassicLighting: Uses a simple heightmap, where each block is either in sun or shadow
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
struct IGameComponent; struct IGameComponent;
extern struct IGameComponent Lighting_Component; extern struct IGameComponent Lighting_Component;
CC_VAR extern struct _Lighting { CC_VAR extern struct _Lighting {
void (*HandleReset)(void); /* Releases/Frees the per-level lighting state */
void (*HandleNewMapLoaded)(void); void (*FreeState)(void);
/* Allocates the per-level lighting state */
/* (called after map has been fully loaded) */
void (*AllocState)(void);
/* Equivalent to (but far more optimised form of) /* Equivalent to (but far more optimised form of)
* for x = startX; x < startX + 18; x++ * for x = startX; x < startX + 18; x++
* for z = startZ; z < startZ + 18; z++ * for z = startZ; z < startZ + 18; z++
@ -20,6 +26,8 @@ CC_VAR extern struct _Lighting {
/* Called when a block is changed to update internal lighting state. */ /* Called when a block is changed to update internal lighting state. */
/* NOTE: Implementations ***MUST*** mark all chunks affected by this lighting change as needing to be refreshed. */ /* NOTE: Implementations ***MUST*** mark all chunks affected by this lighting change as needing to be refreshed. */
void (*OnBlockChanged)(int x, int y, int z, BlockID oldBlock, BlockID newBlock); void (*OnBlockChanged)(int x, int y, int z, BlockID oldBlock, BlockID newBlock);
/* Invalidates/Resets lighting state for all of the blocks in the world */
/* (e.g. because a block changed whether it is full bright or not) */
void (*Refresh)(void); void (*Refresh)(void);
/* Returns whether the block at the given coordinates is fully in sunlight. */ /* Returns whether the block at the given coordinates is fully in sunlight. */

View File

@ -1,8 +1,9 @@
#ifndef CC_LOGGER_H #ifndef CC_LOGGER_H
#define CC_LOGGER_H #define CC_LOGGER_H
#include "Core.h" #include "Core.h"
/* Support methods for logging errors. /*
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Logs warnings/errors and also abstracts platform specific logging for fatal errors
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
typedef cc_bool (*Logger_DescribeError)(cc_result res, cc_string* dst); typedef cc_bool (*Logger_DescribeError)(cc_result res, cc_string* dst);

View File

@ -1,8 +1,9 @@
#ifndef CC_OPTIONS_H #ifndef CC_OPTIONS_H
#define CC_OPTIONS_H #define CC_OPTIONS_H
#include "Core.h" #include "Core.h"
/* Manages loading and saving options. /*
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Manages loading and saving options
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
#define OPT_MUSIC_VOLUME "musicvolume" #define OPT_MUSIC_VOLUME "musicvolume"

View File

@ -2,8 +2,9 @@
#define CC_PARTICLE_H #define CC_PARTICLE_H
#include "Vectors.h" #include "Vectors.h"
#include "PackedCol.h" #include "PackedCol.h"
/* Represents particle effects, and manages rendering and spawning particles. /*
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Represents particle effects, and manages rendering and spawning particles
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
struct IGameComponent; struct IGameComponent;

View File

@ -1,11 +1,12 @@
#ifndef CC_PHYSICS_H #ifndef CC_PHYSICS_H
#define CC_PHYSICS_H #define CC_PHYSICS_H
#include "Vectors.h" #include "Vectors.h"
/* Contains: /*
Provides various physics related structs and methods such as:
- An axis aligned bounding box, and various methods related to them. - An axis aligned bounding box, and various methods related to them.
- Various methods for intersecting geometry. - Various methods for intersecting geometry.
- Calculates all possible blocks that a moving entity can intersect with. - Calculates all possible blocks that a moving entity can intersect with
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
struct Entity; struct Entity;

View File

@ -1,8 +1,10 @@
#ifndef CC_PICKING_H #ifndef CC_PICKING_H
#define CC_PICKING_H #define CC_PICKING_H
#include "Vectors.h" #include "Vectors.h"
/* Data for picking/selecting block by the user, and clipping the camera. /*
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Provides ray tracer functionality for calculating picking/selecting intersection
e.g. calculating block selected in the world by the user, clipping the camera
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
/* Implements a voxel ray tracer /* Implements a voxel ray tracer

View File

@ -1,8 +1,9 @@
#ifndef CC_PLATFORM_H #ifndef CC_PLATFORM_H
#define CC_PLATFORM_H #define CC_PLATFORM_H
#include "Core.h" #include "Core.h"
/* Abstracts platform specific memory management, I/O, etc. /*
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Abstracts platform specific memory management, I/O, etc
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
struct DateTime; struct DateTime;

View File

@ -1,8 +1,9 @@
#ifndef CC_PROTOCOL_H #ifndef CC_PROTOCOL_H
#define CC_PROTOCOL_H #define CC_PROTOCOL_H
#include "Vectors.h" #include "Vectors.h"
/* Implements network protocols for original classic, CPE, and WoM textures. /*
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Implements network protocols for original classic, CPE, and WoM textures
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
struct RayTracer; struct RayTracer;

View File

@ -1,8 +1,9 @@
#ifndef CC_SERVERCONNECTION_H #ifndef CC_SERVERCONNECTION_H
#define CC_SERVERCONNECTION_H #define CC_SERVERCONNECTION_H
#include "Vectors.h" #include "Vectors.h"
/* Represents a connection to either a multiplayer or an internal singleplayer server. /*
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Represents a connection to either a multiplayer or an internal singleplayer server
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
struct IGameComponent; struct IGameComponent;

View File

@ -1,11 +1,12 @@
#ifndef CC_STRING_H #ifndef CC_STRING_H
#define CC_STRING_H #define CC_STRING_H
#include "Core.h" #include "Core.h"
/* Implements operations for a string. /*
Also implements conversions betweens strings and numbers. Provides various string related operations
Also implements converting code page 437 indices to/from unicode. Also provides conversions betweens strings and numbers
Also implements wrapping a single line of text into multiple lines. Also provides converting code page 437 indices to/from unicode
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Also provides wrapping a single line of text into multiple lines
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
#define STRING_INT_CHARS 24 #define STRING_INT_CHARS 24

View File

@ -1,11 +1,12 @@
#ifndef CC_TEXPACKS_H #ifndef CC_TEXPACKS_H
#define CC_TEXPACKS_H #define CC_TEXPACKS_H
#include "Bitmap.h" #include "Bitmap.h"
/* Contains everything relating to texture packs. /*
Contains everything relating to texture packs
- Extracting the textures from a .zip archive - Extracting the textures from a .zip archive
- Caching terrain atlases and texture packs to avoid redundant downloads - Caching terrain atlases and texture packs to avoid redundant downloads
- Terrain atlas (including breaking it down into multiple 1D atlases) - Terrain atlas (including breaking it down into multiple 1D atlases)
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
struct Stream; struct Stream;

View File

@ -1,8 +1,9 @@
#ifndef CC_UTILS_H #ifndef CC_UTILS_H
#define CC_UTILS_H #define CC_UTILS_H
#include "Core.h" #include "Core.h"
/* Implements various utility functions. /*
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Provides various utility functions
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
struct Bitmap; struct Bitmap;

View File

@ -2,9 +2,10 @@
#define CC_VECTORS_H #define CC_VECTORS_H
#include "Core.h" #include "Core.h"
#include "Constants.h" #include "Constants.h"
/* Represents 2 and 3 component vectors, and 4 x 4 matrix. /*
Represents 2 and 3 component vectors, and 4 x 4 matrix
Frustum culling sourced from http://www.crownandcutlass.com/features/technicaldetails/frustum.html Frustum culling sourced from http://www.crownandcutlass.com/features/technicaldetails/frustum.html
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
/* 2 component vector (2D vector) */ /* 2 component vector (2D vector) */

View File

@ -1,8 +1,9 @@
#ifndef CC_WINDOW_H #ifndef CC_WINDOW_H
#define CC_WINDOW_H #define CC_WINDOW_H
#include "Core.h" #include "Core.h"
/* Abstracts creating and managing the native window. /*
Copyright 2014-2021 ClassiCube | Licensed under BSD-3 | Based on OpenTK code Abstracts interaction with a windowing system (creating window, moving cursor, etc)
Copyright 2014-2022 ClassiCube | Licensed under BSD-3
*/ */
/* /*