mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 17:12:25 -05:00
Simplify writing plugins in C++ slightly
This commit is contained in:
parent
e373481944
commit
1c3d8fb72e
72 changed files with 290 additions and 31 deletions
|
@ -64,15 +64,6 @@ All plugins require this boilerplate, so feel free to copy and paste it.
|
||||||
---
|
---
|
||||||
|
|
||||||
### Writing plugins in C++
|
### Writing plugins in C++
|
||||||
When including headers from ClassiCube, they **must** be surrounded with `extern "C"`, i.e.
|
|
||||||
```C
|
|
||||||
extern "C" {
|
|
||||||
#include "src/Chat.h"
|
|
||||||
#include "src/Game.h"
|
|
||||||
#include "src/String.h"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
Otherwise you will get obscure `Undefined reference` errors when compiling.
|
|
||||||
|
|
||||||
Exported plugin functions **must** be surrounded with `extern "C"`, i.e.
|
Exported plugin functions **must** be surrounded with `extern "C"`, i.e.
|
||||||
```C
|
```C
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
#ifndef CC_ANIMATIONS_H
|
#ifndef CC_ANIMATIONS_H
|
||||||
#define CC_ANIMATIONS_H
|
#define CC_ANIMATIONS_H
|
||||||
|
#include "Core.h"
|
||||||
/*
|
/*
|
||||||
Contains everything relating to texture animations (including default water/lava ones)
|
Contains everything relating to texture animations (including default water/lava ones)
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
struct IGameComponent;
|
struct IGameComponent;
|
||||||
extern struct IGameComponent Animations_Component;
|
extern struct IGameComponent Animations_Component;
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -93,7 +93,7 @@ static cc_result Sound_ReadWaveData(struct Stream* stream, struct Sound* snd) {
|
||||||
size -= WAV_FMT_SIZE;
|
size -= WAV_FMT_SIZE;
|
||||||
} else if (fourCC == WAV_FourCC('d','a','t','a')) {
|
} else if (fourCC == WAV_FourCC('d','a','t','a')) {
|
||||||
if ((res = Audio_AllocChunks(size, &snd->chunk, 1))) return res;
|
if ((res = Audio_AllocChunks(size, &snd->chunk, 1))) return res;
|
||||||
res = Stream_Read(stream, snd->chunk.data, size);
|
res = Stream_Read(stream, (cc_uint8*)snd->chunk.data, size);
|
||||||
|
|
||||||
#ifdef CC_BUILD_BIGENDIAN
|
#ifdef CC_BUILD_BIGENDIAN
|
||||||
Utils_SwapEndian16((cc_int16*)snd->chunk.data, size / 2);
|
Utils_SwapEndian16((cc_int16*)snd->chunk.data, size / 2);
|
||||||
|
@ -336,7 +336,7 @@ static cc_result Music_Buffer(struct AudioChunk* chunk, int maxSamples, struct V
|
||||||
int samples = 0;
|
int samples = 0;
|
||||||
cc_int16* cur;
|
cc_int16* cur;
|
||||||
cc_result res = 0, res2;
|
cc_result res = 0, res2;
|
||||||
cc_int16* data = chunk->data;
|
cc_int16* data = (cc_int16*)chunk->data;
|
||||||
|
|
||||||
while (samples < maxSamples) {
|
while (samples < maxSamples) {
|
||||||
if ((res = Vorbis_DecodeFrame(ctx))) break;
|
if ((res = Vorbis_DecodeFrame(ctx))) break;
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
/* Manages playing sound and music.
|
/* Manages playing sound and music.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
struct IGameComponent;
|
struct IGameComponent;
|
||||||
extern struct IGameComponent Audio_Component;
|
extern struct IGameComponent Audio_Component;
|
||||||
struct AudioContext;
|
struct AudioContext;
|
||||||
|
@ -87,4 +89,6 @@ void Audio_Warn(cc_result res, const char* action);
|
||||||
|
|
||||||
cc_result AudioPool_Play(struct AudioData* data);
|
cc_result AudioPool_Play(struct AudioData* data);
|
||||||
void AudioPool_Close(void);
|
void AudioPool_Close(void);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
/* Renders 3 lines showing direction of each axis.
|
/* Renders 3 lines showing direction of each axis.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
struct IGameComponent;
|
struct IGameComponent;
|
||||||
extern struct IGameComponent AxisLinesRenderer_Component;
|
extern struct IGameComponent AxisLinesRenderer_Component;
|
||||||
|
@ -11,4 +12,6 @@ extern struct IGameComponent AxisLinesRenderer_Component;
|
||||||
extern cc_bool AxisLinesRenderer_Enabled;
|
extern cc_bool AxisLinesRenderer_Enabled;
|
||||||
|
|
||||||
void AxisLinesRenderer_Render(void);
|
void AxisLinesRenderer_Render(void);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -408,7 +408,7 @@ cc_result Png_Decode(struct Bitmap* bmp, struct Stream* stream) {
|
||||||
scanlineSize = ((samplesPerPixel[colorspace] * bitsPerSample * bmp->width) + 7) >> 3;
|
scanlineSize = ((samplesPerPixel[colorspace] * bitsPerSample * bmp->width) + 7) >> 3;
|
||||||
scanlineBytes = scanlineSize + 1; /* Add 1 byte for filter byte of each scanline */
|
scanlineBytes = scanlineSize + 1; /* Add 1 byte for filter byte of each scanline */
|
||||||
|
|
||||||
data = Mem_TryAlloc(bmp->height, max(scanlineBytes, bmp->width * 4));
|
data = (cc_uint8*)Mem_TryAlloc(bmp->height, max(scanlineBytes, bmp->width * 4));
|
||||||
bmp->scan0 = (BitmapCol*)data;
|
bmp->scan0 = (BitmapCol*)data;
|
||||||
if (!bmp->scan0) return ERR_OUT_OF_MEMORY;
|
if (!bmp->scan0) return ERR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
@ -729,7 +729,7 @@ cc_result Png_Encode(struct Bitmap* bmp, struct Stream* stream,
|
||||||
Png_RowGetter getRow, cc_bool alpha, void* ctx) {
|
Png_RowGetter getRow, cc_bool alpha, void* ctx) {
|
||||||
cc_result res;
|
cc_result res;
|
||||||
/* Add 1 for scanline filter type byter */
|
/* Add 1 for scanline filter type byter */
|
||||||
cc_uint8* buffer = Mem_TryAlloc(3, bmp->width * 4 + 1);
|
cc_uint8* buffer = (cc_uint8*)Mem_TryAlloc(3, bmp->width * 4 + 1);
|
||||||
if (!buffer) return ERR_NOT_SUPPORTED;
|
if (!buffer) return ERR_NOT_SUPPORTED;
|
||||||
|
|
||||||
res = Png_EncodeCore(bmp, stream, buffer, getRow, alpha, ctx);
|
res = Png_EncodeCore(bmp, stream, buffer, getRow, alpha, ctx);
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
/* Represents a 2D array of pixels.
|
/* Represents a 2D array of pixels.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
struct Stream;
|
struct Stream;
|
||||||
|
|
||||||
#if defined CC_BUILD_WEB || defined CC_BUILD_ANDROID || defined CC_BUILD_PSP || defined CC_BUILD_PSVITA || defined CC_BUILD_PS2
|
#if defined CC_BUILD_WEB || defined CC_BUILD_ANDROID || defined CC_BUILD_PSP || defined CC_BUILD_PSVITA || defined CC_BUILD_PS2
|
||||||
|
@ -140,4 +142,6 @@ CC_API cc_result Png_Decode(struct Bitmap* bmp, struct Stream* stream);
|
||||||
/* if alpha is non-zero, RGBA channels are saved, otherwise only RGB channels are. */
|
/* if alpha is non-zero, RGBA channels are saved, otherwise only RGB channels are. */
|
||||||
cc_result Png_Encode(struct Bitmap* bmp, struct Stream* stream,
|
cc_result Png_Encode(struct Bitmap* bmp, struct Stream* stream,
|
||||||
Png_RowGetter getRow, cc_bool alpha, void* ctx);
|
Png_RowGetter getRow, cc_bool alpha, void* ctx);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
Also performs automatic rotation of directional blocks.
|
Also performs automatic rotation of directional blocks.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
struct IGameComponent;
|
struct IGameComponent;
|
||||||
extern struct IGameComponent Blocks_Component;
|
extern struct IGameComponent Blocks_Component;
|
||||||
|
|
||||||
|
@ -151,4 +153,6 @@ extern cc_bool AutoRotate_Enabled;
|
||||||
BlockID AutoRotate_RotateBlock(BlockID block);
|
BlockID AutoRotate_RotateBlock(BlockID block);
|
||||||
/* Returns non 0 if both blocks belong to the same autorotate group */
|
/* Returns non 0 if both blocks belong to the same autorotate group */
|
||||||
cc_bool AutoRotate_BlocksShareGroup(BlockID block, BlockID blockOther);
|
cc_bool AutoRotate_BlocksShareGroup(BlockID block, BlockID blockOther);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
/* List of all core/standard block IDs
|
/* List of all core/standard block IDs
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
enum BLOCKID {
|
enum BLOCKID {
|
||||||
/* Classic blocks */
|
/* Classic blocks */
|
||||||
|
@ -88,4 +89,6 @@ enum BLOCKID {
|
||||||
#endif
|
#endif
|
||||||
BLOCK_COUNT = (BLOCK_MAX_DEFINED + 1)
|
BLOCK_COUNT = (BLOCK_MAX_DEFINED + 1)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_BLOCKPHYSICS_H
|
#ifndef CC_BLOCKPHYSICS_H
|
||||||
#define CC_BLOCKPHYSICS_H
|
#define CC_BLOCKPHYSICS_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Implements simple block physics.
|
/* Implements simple block physics.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -26,4 +28,6 @@ void Physics_OnBlockChanged(int x, int y, int z, BlockID old, BlockID now);
|
||||||
void Physics_Init(void);
|
void Physics_Init(void);
|
||||||
void Physics_Free(void);
|
void Physics_Free(void);
|
||||||
void Physics_Tick(void);
|
void Physics_Tick(void);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_BUILDER_H
|
#ifndef CC_BUILDER_H
|
||||||
#define CC_BUILDER_H
|
#define CC_BUILDER_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Converts a 16x16x16 chunk into a mesh of vertices
|
Converts a 16x16x16 chunk into a mesh of vertices
|
||||||
NormalMeshBuilder:
|
NormalMeshBuilder:
|
||||||
|
@ -21,4 +23,6 @@ extern cc_bool Builder_SmoothLighting;
|
||||||
void Builder_MakeChunk(struct ChunkInfo* info);
|
void Builder_MakeChunk(struct ChunkInfo* info);
|
||||||
|
|
||||||
void Builder_ApplyActive(void);
|
void Builder_ApplyActive(void);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_CAMERA_H
|
#ifndef CC_CAMERA_H
|
||||||
#define CC_CAMERA_H
|
#define CC_CAMERA_H
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Represents a camera, may be first or third person
|
Represents a camera, may be first or third person
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -82,4 +84,6 @@ void Camera_CheckFocus(void);
|
||||||
void Camera_UpdateProjection(void);
|
void Camera_UpdateProjection(void);
|
||||||
void Camera_SetFov(int fov);
|
void Camera_SetFov(int fov);
|
||||||
void Camera_KeyLookUpdate(float delta);
|
void Camera_KeyLookUpdate(float delta);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_CHAT_H
|
#ifndef CC_CHAT_H
|
||||||
#define CC_CHAT_H
|
#define CC_CHAT_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Manages sending, adding, logging and handling chat.
|
/* Manages sending, adding, logging and handling chat.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -71,4 +73,6 @@ CC_API void Chat_Add1(const char* format, const void* a1);
|
||||||
CC_API void Chat_Add2(const char* format, const void* a1, const void* a2);
|
CC_API void Chat_Add2(const char* format, const void* a1, const void* a2);
|
||||||
CC_API void Chat_Add3(const char* format, const void* a1, const void* a2, const void* a3);
|
CC_API void Chat_Add3(const char* format, const void* a1, const void* a2, const void* a3);
|
||||||
CC_API void Chat_Add4(const char* format, const void* a1, const void* a2, const void* a3, const void* a4);
|
CC_API void Chat_Add4(const char* format, const void* a1, const void* a2, const void* a3, const void* a4);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_COMMANDS_H
|
#ifndef CC_COMMANDS_H
|
||||||
#define CC_COMMANDS_H
|
#define CC_COMMANDS_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Executes actions in response to certain chat input
|
/* Executes actions in response to certain chat input
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -28,4 +30,6 @@ struct ChatCommand {
|
||||||
/* Registers a client-side command, allowing it to be used with /client [cmd name] */
|
/* Registers a client-side command, allowing it to be used with /client [cmd name] */
|
||||||
CC_API void Commands_Register( struct ChatCommand* cmd);
|
CC_API void Commands_Register( struct ChatCommand* cmd);
|
||||||
typedef void (*FP_Commands_Register)(struct ChatCommand* cmd);
|
typedef void (*FP_Commands_Register)(struct ChatCommand* cmd);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -511,5 +511,14 @@ struct Texture {
|
||||||
short x, y; cc_uint16 width, height;
|
short x, y; cc_uint16 width, height;
|
||||||
TextureRec uv;
|
TextureRec uv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define CC_BEGIN_HEADER extern "C" {
|
||||||
|
#define CC_END_HEADER }
|
||||||
|
#else
|
||||||
|
#define CC_BEGIN_HEADER
|
||||||
|
#define CC_END_HEADER
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_DEFLATE_H
|
#ifndef CC_DEFLATE_H
|
||||||
#define CC_DEFLATE_H
|
#define CC_DEFLATE_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Decodes data compressed using DEFLATE in a streaming manner.
|
/* Decodes data compressed using DEFLATE in a streaming manner.
|
||||||
Partially based off information from
|
Partially based off information from
|
||||||
https://handmade.network/forums/wip/t/2363-implementing_a_basic_png_reader_the_handmade_way
|
https://handmade.network/forums/wip/t/2363-implementing_a_basic_png_reader_the_handmade_way
|
||||||
|
@ -135,4 +137,6 @@ typedef cc_bool (*Zip_SelectEntry)(const cc_string* path);
|
||||||
|
|
||||||
cc_result Zip_Extract(struct Stream* source, Zip_SelectEntry selector, Zip_ProcessEntry processor,
|
cc_result Zip_Extract(struct Stream* source, Zip_SelectEntry selector, Zip_ProcessEntry processor,
|
||||||
struct ZipEntry* entries, int maxEntries);
|
struct ZipEntry* entries, int maxEntries);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define CC_DRAWER_H
|
#define CC_DRAWER_H
|
||||||
#include "PackedCol.h"
|
#include "PackedCol.h"
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Draws the vertices for a cuboid region
|
Draws the vertices for a cuboid region
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -35,4 +37,6 @@ CC_API void Drawer_ZMax(int count, PackedCol col, TextureLoc texLoc, struct Vert
|
||||||
CC_API void Drawer_YMin(int count, PackedCol col, TextureLoc texLoc, struct VertexTextured** vertices);
|
CC_API void Drawer_YMin(int count, PackedCol col, TextureLoc texLoc, struct VertexTextured** vertices);
|
||||||
/* Draws maximum Y face of the cuboid. (i.e. at Y2) */
|
/* Draws maximum Y face of the cuboid. (i.e. at Y2) */
|
||||||
CC_API void Drawer_YMax(int count, PackedCol col, TextureLoc texLoc, struct VertexTextured** vertices);
|
CC_API void Drawer_YMax(int count, PackedCol col, TextureLoc texLoc, struct VertexTextured** vertices);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define CC_DRAWER2D_H
|
#define CC_DRAWER2D_H
|
||||||
#include "Bitmap.h"
|
#include "Bitmap.h"
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Performs a variety of drawing operations on bitmaps, and converts bitmaps into textures.
|
/* Performs a variety of drawing operations on bitmaps, and converts bitmaps into textures.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -126,4 +128,6 @@ cc_bool Font_SetBitmapAtlas(struct Bitmap* bmp);
|
||||||
void Font_SetPadding(struct FontDesc* desc, int amount);
|
void Font_SetPadding(struct FontDesc* desc, int amount);
|
||||||
/* Initialises the given font for drawing bitmapped text using default.png */
|
/* Initialises the given font for drawing bitmapped text using default.png */
|
||||||
void Font_MakeBitmapped(struct FontDesc* desc, int size, int flags);
|
void Font_MakeBitmapped(struct FontDesc* desc, int size, int flags);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
#include "PackedCol.h"
|
#include "PackedCol.h"
|
||||||
#include "String.h"
|
#include "String.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Represents an in-game entity.
|
/* Represents an in-game entity.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -256,4 +258,6 @@ cc_bool LocalPlayer_CheckCanZoom(struct LocalPlayer* p);
|
||||||
/* Moves local player back to spawn point. */
|
/* Moves local player back to spawn point. */
|
||||||
void LocalPlayers_MoveToSpawn(struct LocationUpdate* update);
|
void LocalPlayers_MoveToSpawn(struct LocationUpdate* update);
|
||||||
void LocalPlayer_CalcDefaultSpawn(struct LocalPlayer* p, struct LocationUpdate* update);
|
void LocalPlayer_CalcDefaultSpawn(struct LocalPlayer* p, struct LocationUpdate* update);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define CC_ENTITY_COMPONENTS_H
|
#define CC_ENTITY_COMPONENTS_H
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Various components for entities.
|
/* Various components for entities.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -133,4 +135,6 @@ void PhysicsComp_DoEntityPush(struct Entity* entity);
|
||||||
|
|
||||||
/* Entity component that plays block step sounds */
|
/* Entity component that plays block step sounds */
|
||||||
void SoundComp_Tick(struct LocalPlayer* p, cc_bool wasOnGround);
|
void SoundComp_Tick(struct LocalPlayer* p, cc_bool wasOnGround);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_ENTITYRENDERERS_H
|
#ifndef CC_ENTITYRENDERERS_H
|
||||||
#define CC_ENTITYRENDERERS_H
|
#define CC_ENTITYRENDERERS_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Renders supporting objects for entities (shadows and names)
|
/* Renders supporting objects for entities (shadows and names)
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -18,4 +20,5 @@ void EntityNames_Render(void);
|
||||||
/* Renders hovered entity name tags (these appears through blocks) */
|
/* Renders hovered entity name tags (these appears through blocks) */
|
||||||
void EntityNames_RenderHovered(void);
|
void EntityNames_RenderHovered(void);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_ENVRENDERER_H
|
#ifndef CC_ENVRENDERER_H
|
||||||
#define CC_ENVRENDERER_H
|
#define CC_ENVRENDERER_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Renders environment of the map (clouds, sky, fog, map sides/edges, skybox, rain/snow)
|
Renders environment of the map (clouds, sky, fog, map sides/edges, skybox, rain/snow)
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -44,4 +46,6 @@ void EnvRenderer_SetMode(int flags);
|
||||||
/* Calculates mode flags for the given mode. */
|
/* Calculates mode flags for the given mode. */
|
||||||
/* mode can be: normal, normalfast, legacy, legacyfast */
|
/* mode can be: normal, normalfast, legacy, legacyfast */
|
||||||
CC_NOINLINE int EnvRenderer_CalcFlags(const cc_string* mode);
|
CC_NOINLINE int EnvRenderer_CalcFlags(const cc_string* mode);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_EVENT_H
|
#ifndef CC_EVENT_H
|
||||||
#define CC_EVENT_H
|
#define CC_EVENT_H
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Helper methods for using events, and contains all events.
|
/* Helper methods for using events, and contains all events.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -223,4 +225,6 @@ CC_VAR extern struct _NetEventsList {
|
||||||
struct Event_Void Disconnected; /* Connection to the server was lost */
|
struct Event_Void Disconnected; /* Connection to the server was lost */
|
||||||
struct Event_PluginMessage PluginMessageReceived; /* Received a PluginMessage packet from the server */
|
struct Event_PluginMessage PluginMessageReceived; /* Received a PluginMessage packet from the server */
|
||||||
} NetEvents;
|
} NetEvents;
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_MATH_H
|
#ifndef CC_MATH_H
|
||||||
#define CC_MATH_H
|
#define CC_MATH_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Simple math functions and constants. Also implements a RNG algorithm, based on
|
/* Simple math functions and constants. Also implements a RNG algorithm, based on
|
||||||
Java's implementation from https://docs.oracle.com/javase/7/docs/api/java/util/Random.html
|
Java's implementation from https://docs.oracle.com/javase/7/docs/api/java/util/Random.html
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -75,4 +77,6 @@ CC_API float Random_Float(RNGState* rnd);
|
||||||
static CC_INLINE int Random_Range(RNGState* rnd, int min, int max) {
|
static CC_INLINE int Random_Range(RNGState* rnd, int min, int max) {
|
||||||
return min + Random_Next(rnd, max - min);
|
return min + Random_Next(rnd, max - min);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_MAPFORMATS_H
|
#ifndef CC_MAPFORMATS_H
|
||||||
#define CC_MAPFORMATS_H
|
#define CC_MAPFORMATS_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Imports/exports a world and associated metadata from/to a particular map file format.
|
/* Imports/exports a world and associated metadata from/to a particular map file format.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -36,4 +38,6 @@ cc_result Schematic_Save(struct Stream* stream);
|
||||||
/* Exports a world to a .dat Classic map file */
|
/* Exports a world to a .dat Classic map file */
|
||||||
/* Used by MineCraft Classic */
|
/* Used by MineCraft Classic */
|
||||||
cc_result Dat_Save(struct Stream* stream);
|
cc_result Dat_Save(struct Stream* stream);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_FUNCS_H
|
#ifndef CC_FUNCS_H
|
||||||
#define CC_FUNCS_H
|
#define CC_FUNCS_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
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!
|
||||||
|
@ -49,4 +51,6 @@ while (cur) {\
|
||||||
tail = cur;\
|
tail = cur;\
|
||||||
cur = cur->next;\
|
cur = cur->next;\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_GAME_H
|
#ifndef CC_GAME_H
|
||||||
#define CC_GAME_H
|
#define CC_GAME_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Represents the game and related structures.
|
/* Represents the game and related structures.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -159,4 +161,6 @@ struct ScheduledTask {
|
||||||
typedef void (*ScheduledTaskCallback)(struct ScheduledTask* task);
|
typedef void (*ScheduledTaskCallback)(struct ScheduledTask* task);
|
||||||
/* Adds a task to list of scheduled tasks. (always at end) */
|
/* Adds a task to list of scheduled tasks. (always at end) */
|
||||||
CC_API int ScheduledTask_Add(double interval, ScheduledTaskCallback callback);
|
CC_API int ScheduledTask_Add(double interval, ScheduledTaskCallback callback);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define CC_MAP_GEN_H
|
#define CC_MAP_GEN_H
|
||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Implements flatgrass map generator, and original classic vanilla map generation (with perlin noise)
|
/* Implements flatgrass map generator, and original classic vanilla map generation (with perlin noise)
|
||||||
Based on: https://github.com/ClassiCube/ClassiCube/wiki/Minecraft-Classic-map-generation-algorithm
|
Based on: https://github.com/ClassiCube/ClassiCube/wiki/Minecraft-Classic-map-generation-algorithm
|
||||||
Thanks to Jerralish for originally reverse engineering classic's algorithm, then preparing a high level overview of the algorithm.
|
Thanks to Jerralish for originally reverse engineering classic's algorithm, then preparing a high level overview of the algorithm.
|
||||||
|
@ -41,4 +43,6 @@ cc_bool TreeGen_CanGrow(int treeX, int treeY, int treeZ, int treeHeight);
|
||||||
/* Generates the blocks (and their positions in the world) that actually make up a tree. */
|
/* Generates the blocks (and their positions in the world) that actually make up a tree. */
|
||||||
/* Returns the number of blocks generated, which will be <= TREE_MAX_COUNT */
|
/* Returns the number of blocks generated, which will be <= TREE_MAX_COUNT */
|
||||||
int TreeGen_Grow(int treeX, int treeY, int treeZ, int height, IVec3* coords, BlockRaw* blocks);
|
int TreeGen_Grow(int treeX, int treeY, int treeZ, int height, IVec3* coords, BlockRaw* blocks);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define CC_GFXAPI_H
|
#define CC_GFXAPI_H
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
#include "PackedCol.h"
|
#include "PackedCol.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Abstracts a 3D graphics rendering API
|
Abstracts a 3D graphics rendering API
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -314,4 +316,6 @@ void Gfx_RestoreAlphaState(cc_uint8 draw);
|
||||||
void Texture_Render(const struct Texture* tex);
|
void Texture_Render(const struct Texture* tex);
|
||||||
/* Binds then renders the given texture */
|
/* Binds then renders the given texture */
|
||||||
void Texture_RenderShaded(const struct Texture* tex, PackedCol shadeColor);
|
void Texture_RenderShaded(const struct Texture* tex, PackedCol shadeColor);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_GUI_H
|
#ifndef CC_GUI_H
|
||||||
#define CC_GUI_H
|
#define CC_GUI_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Describes and manages 2D GUI elements on screen.
|
/* Describes and manages 2D GUI elements on screen.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -304,4 +306,6 @@ void TextAtlas_AddInt(struct TextAtlas* atlas, int value, struct VertexTextured*
|
||||||
#define Widget_BuildMesh(widget, vertices) (widget)->VTABLE->BuildMesh(widget, vertices)
|
#define Widget_BuildMesh(widget, vertices) (widget)->VTABLE->BuildMesh(widget, vertices)
|
||||||
#define Widget_Render2(widget, offset) (widget)->VTABLE->Render2(widget, offset)
|
#define Widget_Render2(widget, offset) (widget)->VTABLE->Render2(widget, offset)
|
||||||
#define Widget_Layout(widget) (widget)->VTABLE->Reposition(widget)
|
#define Widget_Layout(widget) (widget)->VTABLE->Reposition(widget)
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_HELDBLOCKRENDERER_H
|
#ifndef CC_HELDBLOCKRENDERER_H
|
||||||
#define CC_HELDBLOCKRENDERER_H
|
#define CC_HELDBLOCKRENDERER_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Renders the held block/arm at bottom right of game
|
Renders the held block/arm at bottom right of game
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -12,4 +14,6 @@ extern cc_bool HeldBlockRenderer_Show;
|
||||||
|
|
||||||
void HeldBlockRenderer_ClickAnim(cc_bool digging);
|
void HeldBlockRenderer_ClickAnim(cc_bool digging);
|
||||||
void HeldBlockRenderer_Render(float delta);
|
void HeldBlockRenderer_Render(float delta);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define CC_HTTP_H
|
#define CC_HTTP_H
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Aysnchronously performs http GET, HEAD, and POST requests
|
Aysnchronously performs http GET, HEAD, and POST requests
|
||||||
Typically this is used to download skins, texture packs, etc
|
Typically this is used to download skins, texture packs, etc
|
||||||
|
@ -87,4 +89,6 @@ int Http_CheckProgress(int reqID);
|
||||||
void Http_ClearPending(void);
|
void Http_ClearPending(void);
|
||||||
|
|
||||||
void Http_LogError(const char* action, const struct HttpRequest* item);
|
void Http_LogError(const char* action, const struct HttpRequest* item);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_INPUT_H
|
#ifndef CC_INPUT_H
|
||||||
#define CC_INPUT_H
|
#define CC_INPUT_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Manages input state and raising input related events
|
Manages input state and raising input related events
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -258,4 +260,6 @@ void InputBind_Set(InputBind binding, int btn, const struct InputDevice* device)
|
||||||
void InputBind_Reset(InputBind binding, const struct InputDevice* device);
|
void InputBind_Reset(InputBind binding, const struct InputDevice* device);
|
||||||
/* Loads the bindings for the given device from either options or its defaults */
|
/* Loads the bindings for the given device from either options or its defaults */
|
||||||
void InputBind_Load(const struct InputDevice* device);
|
void InputBind_Load(const struct InputDevice* device);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_INPUTHANDLER_H
|
#ifndef CC_INPUTHANDLER_H
|
||||||
#define CC_INPUTHANDLER_H
|
#define CC_INPUTHANDLER_H
|
||||||
#include "Input.h"
|
#include "Input.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Manages base game input handling
|
Manages base game input handling
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -63,4 +65,6 @@ extern BindTriggered Bind_OnTriggered[BIND_COUNT];
|
||||||
extern BindReleased Bind_OnReleased[BIND_COUNT];
|
extern BindReleased Bind_OnReleased[BIND_COUNT];
|
||||||
/* Whether the given input binding is activated by one or more devices */
|
/* Whether the given input binding is activated by one or more devices */
|
||||||
extern cc_uint8 Bind_IsTriggered[BIND_COUNT];
|
extern cc_uint8 Bind_IsTriggered[BIND_COUNT];
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define CC_INVENTORY_H
|
#define CC_INVENTORY_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
#include "BlockID.h"
|
#include "BlockID.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
|
|
||||||
/* Manages inventory hotbar, and ordering of blocks in the inventory menu.
|
/* Manages inventory hotbar, and ordering of blocks in the inventory menu.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -60,4 +62,6 @@ void Inventory_ResetMapping(void);
|
||||||
void Inventory_AddDefault(BlockID block);
|
void Inventory_AddDefault(BlockID block);
|
||||||
/* Removes any slots with the given block from the inventory. */
|
/* Removes any slots with the given block from the inventory. */
|
||||||
void Inventory_Remove(BlockID block);
|
void Inventory_Remove(BlockID block);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_ISOMETRICDRAWER_H
|
#ifndef CC_ISOMETRICDRAWER_H
|
||||||
#define CC_ISOMETRICDRAWER_H
|
#define CC_ISOMETRICDRAWER_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Draws 2D isometric blocks for the hotbar and inventory UIs.
|
/* Draws 2D isometric blocks for the hotbar and inventory UIs.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -17,4 +19,6 @@ void IsometricDrawer_AddBatch(BlockID block, float size, float x, float y);
|
||||||
int IsometricDrawer_EndBatch(void);
|
int IsometricDrawer_EndBatch(void);
|
||||||
/* Draws the buffered vertices */
|
/* Draws the buffered vertices */
|
||||||
void IsometricDrawer_Render(int count, int offset, int* state);
|
void IsometricDrawer_Render(int count, int offset, int* state);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_LBACKEND_H
|
#ifndef CC_LBACKEND_H
|
||||||
#define CC_LBACKEND_H
|
#define CC_LBACKEND_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Abstracts the gui drawing backend for the Launcher
|
Abstracts the gui drawing backend for the Launcher
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -83,4 +85,6 @@ void LBackend_TableDraw(struct LTable* w);
|
||||||
void LBackend_TableMouseDown(struct LTable* w, int idx);
|
void LBackend_TableMouseDown(struct LTable* w, int idx);
|
||||||
void LBackend_TableMouseUp(struct LTable* w, int idx);
|
void LBackend_TableMouseUp(struct LTable* w, int idx);
|
||||||
void LBackend_TableMouseMove(struct LTable* w, int idx);
|
void LBackend_TableMouseMove(struct LTable* w, int idx);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_LSCREENS_H
|
#ifndef CC_LSCREENS_H
|
||||||
#define CC_LSCREENS_H
|
#define CC_LSCREENS_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Implements all of the screens/menus in the launcher
|
Implements all of the screens/menus in the launcher
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -50,4 +52,6 @@ void ServersScreen_SetActive(void);
|
||||||
void SettingsScreen_SetActive(void);
|
void SettingsScreen_SetActive(void);
|
||||||
void ThemesScreen_SetActive(void);
|
void ThemesScreen_SetActive(void);
|
||||||
void UpdatesScreen_SetActive(void);
|
void UpdatesScreen_SetActive(void);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define CC_LWEB_H
|
#define CC_LWEB_H
|
||||||
#include "Bitmap.h"
|
#include "Bitmap.h"
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Implements asynchronous web tasks for the launcher.
|
/* Implements asynchronous web tasks for the launcher.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -133,4 +135,6 @@ void Flags_Free(void);
|
||||||
|
|
||||||
void Session_Load(void);
|
void Session_Load(void);
|
||||||
void Session_Save(void);
|
void Session_Save(void);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define CC_LWIDGETS_H
|
#define CC_LWIDGETS_H
|
||||||
#include "Bitmap.h"
|
#include "Bitmap.h"
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Describes and manages individual 2D GUI elements in the launcher.
|
/* Describes and manages individual 2D GUI elements in the launcher.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -250,4 +252,6 @@ void LTable_SetSelectedTo(struct LTable* w, int index);
|
||||||
void LTable_RowClick(struct LTable* w, int row);
|
void LTable_RowClick(struct LTable* w, int row);
|
||||||
/* Works out the background color of the given row */
|
/* Works out the background color of the given row */
|
||||||
BitmapCol LTable_RowColor(int row, cc_bool selected, cc_bool featured);
|
BitmapCol LTable_RowColor(int row, cc_bool selected, cc_bool featured);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_LAUNCHER_H
|
#ifndef CC_LAUNCHER_H
|
||||||
#define CC_LAUNCHER_H
|
#define CC_LAUNCHER_H
|
||||||
#include "Bitmap.h"
|
#include "Bitmap.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Implements the launcher part of the game.
|
/* Implements the launcher part of the game.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -78,4 +80,6 @@ cc_bool Launcher_StartGame(const cc_string* user, const cc_string* mppass, const
|
||||||
/* Prints information about a http error to dst. (for status widget) */
|
/* Prints information about a http error to dst. (for status widget) */
|
||||||
/* If req->result is non-zero, also displays a dialog box on-screen. */
|
/* If req->result is non-zero, also displays a dialog box on-screen. */
|
||||||
void Launcher_DisplayHttpError(struct HttpRequest* req, const char* action, cc_string* dst);
|
void Launcher_DisplayHttpError(struct HttpRequest* req, const char* action, cc_string* dst);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_WORLDLIGHTING_H
|
#ifndef CC_WORLDLIGHTING_H
|
||||||
#define CC_WORLDLIGHTING_H
|
#define CC_WORLDLIGHTING_H
|
||||||
#include "PackedCol.h"
|
#include "PackedCol.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Abstracts lighting of blocks in the world
|
Abstracts lighting of blocks in the world
|
||||||
Built-in lighting engines:
|
Built-in lighting engines:
|
||||||
|
@ -85,4 +87,5 @@ cc_bool ClassicLighting_IsLit(int x, int y, int z);
|
||||||
cc_bool ClassicLighting_IsLit_Fast(int x, int y, int z);
|
cc_bool ClassicLighting_IsLit_Fast(int x, int y, int z);
|
||||||
void ClassicLighting_OnBlockChanged(int x, int y, int z, BlockID oldBlock, BlockID newBlock);
|
void ClassicLighting_OnBlockChanged(int x, int y, int z, BlockID oldBlock, BlockID newBlock);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_LOGGER_H
|
#ifndef CC_LOGGER_H
|
||||||
#define CC_LOGGER_H
|
#define CC_LOGGER_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Logs warnings/errors and also abstracts platform specific logging for fatal errors
|
Logs warnings/errors and also abstracts platform specific logging for fatal errors
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -55,4 +57,6 @@ void Logger_Abort(const char* raw_msg);
|
||||||
/* Typically used to abort due to an unrecoverable error. (e.g. out of memory) */
|
/* Typically used to abort due to an unrecoverable error. (e.g. out of memory) */
|
||||||
CC_NOINLINE void Logger_Abort2(cc_result result, const char* raw_msg);
|
CC_NOINLINE void Logger_Abort2(cc_result result, const char* raw_msg);
|
||||||
void Logger_FailToStart(const char* raw_msg);
|
void Logger_FailToStart(const char* raw_msg);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define CC_MAPRENDERER_H
|
#define CC_MAPRENDERER_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Renders the blocks of the world by subdividing it into chunks.
|
/* Renders the blocks of the world by subdividing it into chunks.
|
||||||
Also manages the process of building/deleting chunk meshes.
|
Also manages the process of building/deleting chunk meshes.
|
||||||
Also sorts chunks so nearest chunks are rendered first, and calculates chunk visibility.
|
Also sorts chunks so nearest chunks are rendered first, and calculates chunk visibility.
|
||||||
|
@ -75,4 +77,6 @@ void MapRenderer_RefreshChunk(int cx, int cy, int cz);
|
||||||
void MapRenderer_OnBlockChanged(int x, int y, int z, BlockID block);
|
void MapRenderer_OnBlockChanged(int x, int y, int z, BlockID block);
|
||||||
/* Deletes all chunks and resets internal state. */
|
/* Deletes all chunks and resets internal state. */
|
||||||
void MapRenderer_Refresh(void);
|
void MapRenderer_Refresh(void);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1299,12 +1299,14 @@ static void NF_SetCPE(cc_bool v) {
|
||||||
|
|
||||||
static void NostalgiaScreen_Version(void* screen, void* widget) {
|
static void NostalgiaScreen_Version(void* screen, void* widget) {
|
||||||
struct MenuOptionsScreen* s = (struct MenuOptionsScreen*)screen;
|
struct MenuOptionsScreen* s = (struct MenuOptionsScreen*)screen;
|
||||||
|
struct ButtonWidget* btn = (struct ButtonWidget*)widget;
|
||||||
|
|
||||||
int ver = Game_Version.Version - 1;
|
int ver = Game_Version.Version - 1;
|
||||||
if (ver < VERSION_0017) ver = VERSION_0030;
|
if (ver < VERSION_0017) ver = VERSION_0030;
|
||||||
|
|
||||||
Options_SetInt(OPT_GAME_VERSION, ver);
|
Options_SetInt(OPT_GAME_VERSION, ver);
|
||||||
GameVersion_Load();
|
GameVersion_Load();
|
||||||
MenuOptionsScreen_Update(s, widget);
|
MenuOptionsScreen_Update(s, btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NF_GetVersion(struct ButtonWidget* btn, cc_string* v) {
|
static void NF_GetVersion(struct ButtonWidget* btn, cc_string* v) {
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define CC_MENUS_H
|
#define CC_MENUS_H
|
||||||
#include "Gui.h"
|
#include "Gui.h"
|
||||||
#include "PackedCol.h"
|
#include "PackedCol.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
|
|
||||||
/* Contains all 2D menu screen implementations.
|
/* Contains all 2D menu screen implementations.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -100,4 +102,6 @@ typedef void (*Button_SetNum)(const cc_string* v);
|
||||||
void MenuOptionsScreen_AddNum(struct MenuOptionsScreen* s, const char* name,
|
void MenuOptionsScreen_AddNum(struct MenuOptionsScreen* s, const char* name,
|
||||||
float minValue, float maxValue, float defaultValue,
|
float minValue, float maxValue, float defaultValue,
|
||||||
Button_GetNum getValue, Button_SetNum setValue, const char* desc);
|
Button_GetNum getValue, Button_SetNum setValue, const char* desc);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include "PackedCol.h"
|
#include "PackedCol.h"
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
#include "Physics.h"
|
#include "Physics.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Contains various structs and methods for an entity model.
|
/* Contains various structs and methods for an entity model.
|
||||||
Also contains a list of models and default textures for those models.
|
Also contains a list of models and default textures for those models.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -298,4 +300,5 @@ void CustomModel_BuildPart(struct CustomModel* cm, struct CustomModelPartDef* pa
|
||||||
void CustomModel_Register(struct CustomModel* cm);
|
void CustomModel_Register(struct CustomModel* cm);
|
||||||
void CustomModel_Undefine(struct CustomModel* cm);
|
void CustomModel_Undefine(struct CustomModel* cm);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_OPTIONS_H
|
#ifndef CC_OPTIONS_H
|
||||||
#define CC_OPTIONS_H
|
#define CC_OPTIONS_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Manages loading and saving options
|
Manages loading and saving options
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -155,4 +157,6 @@ void Options_SetSecure(const char* opt, const cc_string* data);
|
||||||
/* Attempts to securely decode an option. */
|
/* Attempts to securely decode an option. */
|
||||||
/* NOTE: Not all platforms support secure saving. */
|
/* NOTE: Not all platforms support secure saving. */
|
||||||
void Options_GetSecure(const char* opt, cc_string* data);
|
void Options_GetSecure(const char* opt, cc_string* data);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_PACKEDCOL_H
|
#ifndef CC_PACKEDCOL_H
|
||||||
#define CC_PACKEDCOL_H
|
#define CC_PACKEDCOL_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Manipulates a packed 32 bit RGBA colour, in a format suitable for the native 3D graphics API vertex colours.
|
/* Manipulates a packed 32 bit RGBA colour, in a format suitable for the native 3D graphics API vertex colours.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -61,4 +63,6 @@ CC_NOINLINE cc_bool PackedCol_TryParseHex(const cc_string* str, cc_uint8* rgb);
|
||||||
#define PACKEDCOL_SHADE_YMIN 0.5f
|
#define PACKEDCOL_SHADE_YMIN 0.5f
|
||||||
/* Retrieves shaded colours for ambient block face lighting */
|
/* Retrieves shaded colours for ambient block face lighting */
|
||||||
void PackedCol_GetShaded(PackedCol normal, PackedCol* xSide, PackedCol* zSide, PackedCol* yMin);
|
void PackedCol_GetShaded(PackedCol normal, PackedCol* xSide, PackedCol* zSide, PackedCol* yMin);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define CC_PARTICLE_H
|
#define CC_PARTICLE_H
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
#include "PackedCol.h"
|
#include "PackedCol.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Represents particle effects, and manages rendering and spawning particles
|
Represents particle effects, and manages rendering and spawning particles
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -43,4 +45,6 @@ void Particles_Render(float t);
|
||||||
void Particles_BreakBlockEffect(IVec3 coords, BlockID oldBlock, BlockID block);
|
void Particles_BreakBlockEffect(IVec3 coords, BlockID oldBlock, BlockID block);
|
||||||
void Particles_RainSnowEffect(float x, float y, float z);
|
void Particles_RainSnowEffect(float x, float y, float z);
|
||||||
void Particles_CustomEffect(int effectID, float x, float y, float z, float originX, float originY, float originZ);
|
void Particles_CustomEffect(int effectID, float x, float y, float z, float originX, float originY, float originZ);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_PHYSICS_H
|
#ifndef CC_PHYSICS_H
|
||||||
#define CC_PHYSICS_H
|
#define CC_PHYSICS_H
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Provides various physics related structs and methods such as:
|
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.
|
||||||
|
@ -38,4 +40,6 @@ extern struct SearcherState* Searcher_States;
|
||||||
int Searcher_FindReachableBlocks(struct Entity* entity, struct AABB* entityBB, struct AABB* entityExtentBB);
|
int Searcher_FindReachableBlocks(struct Entity* entity, struct AABB* entityBB, struct AABB* entityExtentBB);
|
||||||
void Searcher_CalcTime(Vec3* vel, struct AABB *entityBB, struct AABB* blockBB, float* tx, float* ty, float* tz);
|
void Searcher_CalcTime(Vec3* vel, struct AABB *entityBB, struct AABB* blockBB, float* tx, float* ty, float* tz);
|
||||||
void Searcher_Free(void);
|
void Searcher_Free(void);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_PICKING_H
|
#ifndef CC_PICKING_H
|
||||||
#define CC_PICKING_H
|
#define CC_PICKING_H
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Provides ray tracer functionality for calculating picking/selecting intersection
|
Provides ray tracer functionality for calculating picking/selecting intersection
|
||||||
e.g. calculating block selected in the world by the user, clipping the camera
|
e.g. calculating block selected in the world by the user, clipping the camera
|
||||||
|
@ -43,4 +45,6 @@ void RayTracer_Step(struct RayTracer* t);
|
||||||
or not being able to find a suitable candiate within the given reach distance.*/
|
or not being able to find a suitable candiate within the given reach distance.*/
|
||||||
void Picking_CalcPickedBlock(const Vec3* origin, const Vec3* dir, float reach, struct RayTracer* t);
|
void Picking_CalcPickedBlock(const Vec3* origin, const Vec3* dir, float reach, struct RayTracer* t);
|
||||||
void Picking_ClipCameraPos(const Vec3* origin, const Vec3* dir, float reach, struct RayTracer* t);
|
void Picking_ClipCameraPos(const Vec3* origin, const Vec3* dir, float reach, struct RayTracer* t);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_PLATFORM_H
|
#ifndef CC_PLATFORM_H
|
||||||
#define CC_PLATFORM_H
|
#define CC_PLATFORM_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Abstracts platform specific memory management, I/O, etc
|
Abstracts platform specific memory management, I/O, etc
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -348,4 +350,6 @@ void JavaCall_String_String(const char* name, const cc_string* arg, cc_string* d
|
||||||
/* Calls a static method in the activity class that returns a jobject */
|
/* Calls a static method in the activity class that returns a jobject */
|
||||||
#define JavaSCall_Obj(env, method, args) (*env)->CallStaticObjectMethodA(env,App_Class, method, args)
|
#define JavaSCall_Obj(env, method, args) (*env)->CallStaticObjectMethodA(env,App_Class, method, args)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_PROTOCOL_H
|
#ifndef CC_PROTOCOL_H
|
||||||
#define CC_PROTOCOL_H
|
#define CC_PROTOCOL_H
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Implements network protocols for original classic, CPE, and WoM textures
|
Implements network protocols for original classic, CPE, and WoM textures
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -72,4 +74,6 @@ void CPE_SendPlayerClick(int button, cc_bool pressed, cc_uint8 targetId, struct
|
||||||
|
|
||||||
/* Send a PluginMessage to the server; data must contain 64 bytes. */
|
/* Send a PluginMessage to the server; data must contain 64 bytes. */
|
||||||
CC_API void CPE_SendPluginMessage(cc_uint8 channel, cc_uint8* data);
|
CC_API void CPE_SendPluginMessage(cc_uint8 channel, cc_uint8* data);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef CC_QUEUE_H
|
#ifndef CC_QUEUE_H
|
||||||
#define CC_QUEUE_H
|
#define CC_QUEUE_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
struct Queue {
|
struct Queue {
|
||||||
cc_uint8* entries; /* Buffer holding the bytes of the queue */
|
cc_uint8* entries; /* Buffer holding the bytes of the queue */
|
||||||
|
@ -18,4 +19,6 @@ void Queue_Enqueue(struct Queue* queue, void* item);
|
||||||
void* Queue_Dequeue(struct Queue* queue);
|
void* Queue_Dequeue(struct Queue* queue);
|
||||||
/* Frees the memory of the queue and resets the members to 0. */
|
/* Frees the memory of the queue and resets the members to 0. */
|
||||||
void Queue_Clear(struct Queue* queue);
|
void Queue_Clear(struct Queue* queue);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_RESOURCES_H
|
#ifndef CC_RESOURCES_H
|
||||||
#define CC_RESOURCES_H
|
#define CC_RESOURCES_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Implements checking, fetching, and patching the default game assets.
|
/* Implements checking, fetching, and patching the default game assets.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -34,4 +36,6 @@ void Fetcher_Run(void);
|
||||||
/* Checks if any resources have finished downloading. */
|
/* Checks if any resources have finished downloading. */
|
||||||
/* If any have, performs required patching and saving. */
|
/* If any have, performs required patching and saving. */
|
||||||
void Fetcher_Update(void);
|
void Fetcher_Update(void);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_SSL_H
|
#ifndef CC_SSL_H
|
||||||
#define CC_SSL_H
|
#define CC_SSL_H
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Wraps a socket connection in a TLS/SSL connection
|
Wraps a socket connection in a TLS/SSL connection
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -13,4 +15,6 @@ cc_result SSL_Init(cc_socket socket, const cc_string* host, void** ctx);
|
||||||
cc_result SSL_Read(void* ctx, cc_uint8* data, cc_uint32 count, cc_uint32* read);
|
cc_result SSL_Read(void* ctx, cc_uint8* data, cc_uint32 count, cc_uint32* read);
|
||||||
cc_result SSL_WriteAll(void* ctx, const cc_uint8* data, cc_uint32 count);
|
cc_result SSL_WriteAll(void* ctx, const cc_uint8* data, cc_uint32 count);
|
||||||
cc_result SSL_Free(void* ctx);
|
cc_result SSL_Free(void* ctx);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_SCREENS_H
|
#ifndef CC_SCREENS_H
|
||||||
#define CC_SCREENS_H
|
#define CC_SCREENS_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Contains all 2D non-menu screen implementations.
|
/* Contains all 2D non-menu screen implementations.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -44,4 +46,6 @@ void ChatScreen_OpenInput(const cc_string* text);
|
||||||
void ChatScreen_AppendInput(const cc_string* text);
|
void ChatScreen_AppendInput(const cc_string* text);
|
||||||
/* Sets number of visible lines in the main chat widget. */
|
/* Sets number of visible lines in the main chat widget. */
|
||||||
void ChatScreen_SetChatlines(int lines);
|
void ChatScreen_SetChatlines(int lines);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_SELOUTLINERENDERER_H
|
#ifndef CC_SELOUTLINERENDERER_H
|
||||||
#define CC_SELOUTLINERENDERER_H
|
#define CC_SELOUTLINERENDERER_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Renders an outline around the block the player is looking at.
|
/* Renders an outline around the block the player is looking at.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -9,4 +11,6 @@ struct IGameComponent;
|
||||||
extern struct IGameComponent SelOutlineRenderer_Component;
|
extern struct IGameComponent SelOutlineRenderer_Component;
|
||||||
|
|
||||||
void SelOutlineRenderer_Render(struct RayTracer* selected, cc_bool dirty);
|
void SelOutlineRenderer_Render(struct RayTracer* selected, cc_bool dirty);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define CC_SELECTIONBOX_H
|
#define CC_SELECTIONBOX_H
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
#include "PackedCol.h"
|
#include "PackedCol.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Describes a selection box, and contains methods related to the selection box.
|
/* Describes a selection box, and contains methods related to the selection box.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -13,4 +15,6 @@ void Selections_Render(void);
|
||||||
CC_API void Selections_Add(cc_uint8 id, const IVec3* p1, const IVec3* p2, PackedCol color);
|
CC_API void Selections_Add(cc_uint8 id, const IVec3* p1, const IVec3* p2, PackedCol color);
|
||||||
/* Removes the selection box with the givne ID */
|
/* Removes the selection box with the givne ID */
|
||||||
CC_API void Selections_Remove(cc_uint8 id);
|
CC_API void Selections_Remove(cc_uint8 id);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_SERVERCONNECTION_H
|
#ifndef CC_SERVERCONNECTION_H
|
||||||
#define CC_SERVERCONNECTION_H
|
#define CC_SERVERCONNECTION_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Represents a connection to either a multiplayer or an internal singleplayer server
|
Represents a connection to either a multiplayer or an internal singleplayer server
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -71,4 +73,6 @@ void Server_RetrieveTexturePack(const cc_string* url);
|
||||||
|
|
||||||
/* Path of map to automatically load in singleplayer */
|
/* Path of map to automatically load in singleplayer */
|
||||||
extern cc_string SP_AutoloadMap;
|
extern cc_string SP_AutoloadMap;
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define CC_STREAM_H
|
#define CC_STREAM_H
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Defines an abstract way of reading and writing data in a streaming manner.
|
/* Defines an abstract way of reading and writing data in a streaming manner.
|
||||||
Also provides common helper methods for reading/writing data to/from streams.
|
Also provides common helper methods for reading/writing data to/from streams.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -98,4 +100,6 @@ cc_result Stream_ReadU32_BE(struct Stream* s, cc_uint32* value);
|
||||||
CC_API cc_result Stream_ReadLine(struct Stream* s, cc_string* text);
|
CC_API cc_result Stream_ReadLine(struct Stream* s, cc_string* text);
|
||||||
/* Writes a line of UTF8 encoded text to the stream. */
|
/* Writes a line of UTF8 encoded text to the stream. */
|
||||||
CC_API cc_result Stream_WriteLine(struct Stream* s, cc_string* text);
|
CC_API cc_result Stream_WriteLine(struct Stream* s, cc_string* text);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_STRING_H
|
#ifndef CC_STRING_H
|
||||||
#define CC_STRING_H
|
#define CC_STRING_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Provides various string related operations
|
Provides various string related operations
|
||||||
Also provides conversions betweens strings and numbers
|
Also provides conversions betweens strings and numbers
|
||||||
|
@ -270,4 +272,6 @@ void WordWrap_GetCoords(int index, const cc_string* lines, int numLines, int* co
|
||||||
int WordWrap_GetBackLength(const cc_string* text, int index);
|
int WordWrap_GetBackLength(const cc_string* text, int index);
|
||||||
/* Returns number of characters from current character to start of next word. */
|
/* Returns number of characters from current character to start of next word. */
|
||||||
int WordWrap_GetForwardLength(const cc_string* text, int index);
|
int WordWrap_GetForwardLength(const cc_string* text, int index);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_SYSTEMFONTS_H
|
#ifndef CC_SYSTEMFONTS_H
|
||||||
#define CC_SYSTEMFONTS_H
|
#define CC_SYSTEMFONTS_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Manages loading and drawing platform specific system fonts
|
/* Manages loading and drawing platform specific system fonts
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -40,4 +42,6 @@ CC_API void SysFonts_GetNames(struct StringsBuffer* buffer);
|
||||||
/* NOTE: If this file has been decoded before (fontscache.txt), does nothing */
|
/* NOTE: If this file has been decoded before (fontscache.txt), does nothing */
|
||||||
cc_result SysFonts_Register(const cc_string* path, SysFont_RegisterCallback callback);
|
cc_result SysFonts_Register(const cc_string* path, SysFont_RegisterCallback callback);
|
||||||
void SysFonts_SaveCache(void);
|
void SysFonts_SaveCache(void);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_TEXPACKS_H
|
#ifndef CC_TEXPACKS_H
|
||||||
#define CC_TEXPACKS_H
|
#define CC_TEXPACKS_H
|
||||||
#include "Bitmap.h"
|
#include "Bitmap.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
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
|
||||||
|
@ -113,4 +115,6 @@ struct TextureEntry {
|
||||||
struct TextureEntry* next;
|
struct TextureEntry* next;
|
||||||
};
|
};
|
||||||
void TextureEntry_Register(struct TextureEntry* entry);
|
void TextureEntry_Register(struct TextureEntry* entry);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_UTILS_H
|
#ifndef CC_UTILS_H
|
||||||
#define CC_UTILS_H
|
#define CC_UTILS_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Provides various utility functions
|
Provides various utility functions
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -77,4 +79,6 @@ CC_NOINLINE int EntryList_Find(struct StringsBuffer* list, const cc_string* key,
|
||||||
|
|
||||||
cc_bool DirectUrl_Claims(const cc_string* STRING_REF input, cc_string* addr, cc_string* user, cc_string* mppass);
|
cc_bool DirectUrl_Claims(const cc_string* STRING_REF input, cc_string* addr, cc_string* user, cc_string* mppass);
|
||||||
cc_bool DirectUrl_ExtractAddress(const cc_string* STRING_REF addr, cc_string* ip, cc_string* port, int* portNum);
|
cc_bool DirectUrl_ExtractAddress(const cc_string* STRING_REF addr, cc_string* ip, cc_string* port, int* portNum);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define CC_VECTORS_H
|
#define CC_VECTORS_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
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
|
||||||
|
@ -136,4 +138,6 @@ cc_bool FrustumCulling_SphereInFrustum(float x, float y, float z, float radius);
|
||||||
/* Calculates the clipping planes from the combined modelview and projection matrices */
|
/* Calculates the clipping planes from the combined modelview and projection matrices */
|
||||||
/* Matrix_Mul(&clip, modelView, projection); */
|
/* Matrix_Mul(&clip, modelView, projection); */
|
||||||
void FrustumCulling_CalcFrustumEquations(struct Matrix* clip);
|
void FrustumCulling_CalcFrustumEquations(struct Matrix* clip);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_VORBIS_H
|
#ifndef CC_VORBIS_H
|
||||||
#define CC_VORBIS_H
|
#define CC_VORBIS_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Decodes ogg vorbis audio into 16 bit PCM samples
|
Decodes ogg vorbis audio into 16 bit PCM samples
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -66,4 +68,6 @@ cc_result Vorbis_DecodeHeaders(struct VorbisState* ctx);
|
||||||
cc_result Vorbis_DecodeFrame(struct VorbisState* ctx);
|
cc_result Vorbis_DecodeFrame(struct VorbisState* ctx);
|
||||||
/* Produces final interleaved audio samples for the current frame. */
|
/* Produces final interleaved audio samples for the current frame. */
|
||||||
int Vorbis_OutputFrame(struct VorbisState* ctx, cc_int16* data);
|
int Vorbis_OutputFrame(struct VorbisState* ctx, cc_int16* data);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "Inventory.h"
|
#include "Inventory.h"
|
||||||
#include "IsometricDrawer.h"
|
#include "IsometricDrawer.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/* Contains all 2D widget implementations.
|
/* Contains all 2D widget implementations.
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
@ -312,4 +314,6 @@ struct ThumbstickWidget {
|
||||||
void ThumbstickWidget_Init(struct ThumbstickWidget* w);
|
void ThumbstickWidget_Init(struct ThumbstickWidget* w);
|
||||||
void ThumbstickWidget_GetMovement(struct ThumbstickWidget* w, float* xMoving, float* zMoving);
|
void ThumbstickWidget_GetMovement(struct ThumbstickWidget* w, float* xMoving, float* zMoving);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CC_WINDOW_H
|
#ifndef CC_WINDOW_H
|
||||||
#define CC_WINDOW_H
|
#define CC_WINDOW_H
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Abstracts interaction with a windowing system (creating window, moving cursor, etc)
|
Abstracts interaction with a windowing system (creating window, moving cursor, etc)
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -260,4 +262,5 @@ void GLContext_SetVSync(cc_bool vsync);
|
||||||
void GLContext_GetApiInfo(cc_string* info);
|
void GLContext_GetApiInfo(cc_string* info);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -397,11 +397,11 @@ static void DoCreateWindow(int width, int height) {
|
||||||
/* So right name appears in e.g. Ubuntu Unity launchbar */
|
/* So right name appears in e.g. Ubuntu Unity launchbar */
|
||||||
XClassHint hint = { 0 };
|
XClassHint hint = { 0 };
|
||||||
#ifdef CC_BUILD_FLATPAK
|
#ifdef CC_BUILD_FLATPAK
|
||||||
hint.res_name = "net.classicube.flatpak.client";
|
hint.res_name = (char*)"net.classicube.flatpak.client";
|
||||||
hint.res_class = "net.classicube.flatpak.client";
|
hint.res_class = (char*)"net.classicube.flatpak.client";
|
||||||
#else
|
#else
|
||||||
hint.res_name = GAME_APP_TITLE;
|
hint.res_name = (char*)GAME_APP_TITLE;
|
||||||
hint.res_class = GAME_APP_TITLE;
|
hint.res_class = (char*)GAME_APP_TITLE;
|
||||||
#endif
|
#endif
|
||||||
XSetClassHint(win_display, win, &hint);
|
XSetClassHint(win_display, win, &hint);
|
||||||
ApplyIcon(win);
|
ApplyIcon(win);
|
||||||
|
@ -1160,7 +1160,7 @@ void Window_AllocFramebuffer(struct Bitmap* bmp, int width, int height) {
|
||||||
fb_data = fb_fast ? bmp->scan0 : Mem_Alloc(width * height, BITMAPCOLOR_SIZE, "window blit");
|
fb_data = fb_fast ? bmp->scan0 : Mem_Alloc(width * height, BITMAPCOLOR_SIZE, "window blit");
|
||||||
|
|
||||||
fb_image = XCreateImage(win_display, win_visual.visual,
|
fb_image = XCreateImage(win_display, win_visual.visual,
|
||||||
win_visual.depth, ZPixmap, 0, fb_data,
|
win_visual.depth, ZPixmap, 0, (char*)fb_data,
|
||||||
width, height, 32, 0);
|
width, height, 32, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define CC_WORLD_H
|
#define CC_WORLD_H
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
#include "PackedCol.h"
|
#include "PackedCol.h"
|
||||||
|
CC_BEGIN_HEADER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Represents a fixed size 3D array of blocks and associated metadata
|
Represents a fixed size 3D array of blocks and associated metadata
|
||||||
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||||
|
@ -214,4 +216,6 @@ float Respawn_HighestSolidY(struct AABB* bb);
|
||||||
/* Finds a suitable initial spawn position for the entity. */
|
/* Finds a suitable initial spawn position for the entity. */
|
||||||
/* Works by iterating downwards from top of world until solid ground is found. */
|
/* Works by iterating downwards from top of world until solid ground is found. */
|
||||||
Vec3 Respawn_FindSpawnPosition(float x, float z, Vec3 modelSize);
|
Vec3 Respawn_FindSpawnPosition(float x, float z, Vec3 modelSize);
|
||||||
|
|
||||||
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue