mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
Combine GameStructs.h into Game.h
Also breaks all plugin source code, sorry about that
This commit is contained in:
parent
6f05953799
commit
9d68364781
@ -36,7 +36,7 @@ Here's the idea for a basic plugin that shows "Hello world" in chat when the gam
|
||||
### Basic plugin boilerplate
|
||||
```C
|
||||
#include "src/Chat.h"
|
||||
#include "src/GameStructs.h"
|
||||
#include "src/Game.h"
|
||||
|
||||
#ifdef CC_BUILD_WIN
|
||||
#define CC_API __declspec(dllimport)
|
||||
@ -66,7 +66,7 @@ When writing plugins with C++, game headers must be surroundined with `extern "C
|
||||
```C
|
||||
extern "C" {
|
||||
#include "src/Chat.h"
|
||||
#include "src/GameStructs.h"
|
||||
#include "src/Game.h"
|
||||
}
|
||||
```
|
||||
Otherwise you will get obscure `Undefined reference` errors when compiling.
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "ExtMath.h"
|
||||
#include "Funcs.h"
|
||||
#include "Game.h"
|
||||
#include "GameStructs.h"
|
||||
#include "Errors.h"
|
||||
#include "Vorbis.h"
|
||||
#include "Chat.h"
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "Camera.h"
|
||||
#include "Event.h"
|
||||
#include "Entity.h"
|
||||
#include "GameStructs.h"
|
||||
|
||||
cc_bool AxisLinesRenderer_Enabled;
|
||||
static GfxResourceID axisLines_vb;
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "Inventory.h"
|
||||
#include "Event.h"
|
||||
#include "Platform.h"
|
||||
#include "GameStructs.h"
|
||||
|
||||
struct _BlockLists Blocks;
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "TexturePack.h"
|
||||
#include "Game.h"
|
||||
#include "Options.h"
|
||||
#include "GameStructs.h"
|
||||
|
||||
int Builder_SidesLevel, Builder_EdgeLevel;
|
||||
/* Packs an index into the 16x16x16 count array. Coordinates range from 0 to 15. */
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "Funcs.h"
|
||||
#include "Block.h"
|
||||
#include "EnvRenderer.h"
|
||||
#include "GameStructs.h"
|
||||
#include "Utils.h"
|
||||
#include "TexturePack.h"
|
||||
#include "Options.h"
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "Errors.h"
|
||||
#include "Window.h"
|
||||
#include "Options.h"
|
||||
#include "GameStructs.h"
|
||||
|
||||
cc_bool Drawer2D_BitmappedText;
|
||||
cc_bool Drawer2D_BlackTextShadows;
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "Logger.h"
|
||||
#include "Options.h"
|
||||
#include "Errors.h"
|
||||
#include "GameStructs.h"
|
||||
|
||||
const char* const NameMode_Names[NAME_MODE_COUNT] = { "None", "Hovered", "All", "AllHovered", "AllUnscaled" };
|
||||
const char* const ShadowMode_Names[SHADOW_MODE_COUNT] = { "None", "SnapToBlock", "Circle", "CircleAll" };
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Camera.h"
|
||||
#include "Particle.h"
|
||||
#include "Options.h"
|
||||
#include "GameStructs.h"
|
||||
|
||||
cc_bool EnvRenderer_Legacy, EnvRenderer_Minimal;
|
||||
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "Audio.h"
|
||||
#include "Stream.h"
|
||||
#include "Builder.h"
|
||||
#include "GameStructs.h"
|
||||
#include "Protocol.h"
|
||||
|
||||
struct _GameData Game;
|
||||
|
36
src/Game.h
36
src/Game.h
@ -3,7 +3,7 @@
|
||||
#include "Picking.h"
|
||||
#include "String.h"
|
||||
#include "Bitmap.h"
|
||||
/* Represents the game.
|
||||
/* Represents the game and related structures.
|
||||
Copyright 2014-2019 ClassiCube | Licensed under BSD-3
|
||||
*/
|
||||
|
||||
@ -82,4 +82,38 @@ void Game_SetFpsLimit(int method);
|
||||
|
||||
/* Runs the main game loop until the window is closed. */
|
||||
void Game_Run(int width, int height, const String* title);
|
||||
|
||||
/* Represents a game component. */
|
||||
struct IGameComponent;
|
||||
struct IGameComponent {
|
||||
/* Called when the game is being loaded. */
|
||||
void(*Init)(void);
|
||||
/* Called when the component is being freed. (e.g. due to game being closed) */
|
||||
void(*Free)(void);
|
||||
/* Called to reset the component's state. (e.g. reconnecting to server) */
|
||||
void(*Reset)(void);
|
||||
/* Called to update the component's state when the user begins loading a new map. */
|
||||
void(*OnNewMap)(void);
|
||||
/* Called to update the component's state when the user has finished loading a new map. */
|
||||
void(*OnNewMapLoaded)(void);
|
||||
/* Next component in linked list of components. */
|
||||
struct IGameComponent* next;
|
||||
};
|
||||
/* Adds a component to linked list of components. (always at end) */
|
||||
CC_NOINLINE void Game_AddComponent(struct IGameComponent* comp);
|
||||
|
||||
/* Represents a task that periodically runs on the main thread every specified interval. */
|
||||
struct ScheduledTask;
|
||||
struct ScheduledTask {
|
||||
/* How long (in seconds) has elapsed since callback was last invoked */
|
||||
double Accumulator;
|
||||
/* How long (in seconds) between invocations of the callback */
|
||||
double Interval;
|
||||
/* Callback function that is periodically invoked */
|
||||
void (*Callback)(struct ScheduledTask* task);
|
||||
};
|
||||
|
||||
typedef void (*ScheduledTaskCallback)(struct ScheduledTask* task);
|
||||
/* Adds a component to list of scheduled tasks. (always at end) */
|
||||
CC_NOINLINE int ScheduledTask_Add(double interval, ScheduledTaskCallback callback);
|
||||
#endif
|
||||
|
@ -1,41 +0,0 @@
|
||||
#ifndef CC_GAMESTRUCTS_H
|
||||
#define CC_GAMESTRUCTS_H
|
||||
#include "Core.h"
|
||||
/* Represents Game related structures.
|
||||
Copyright 2014-2019 ClassiCube | Licensed under BSD-3
|
||||
*/
|
||||
struct IGameComponent;
|
||||
|
||||
/* Represents a game component. */
|
||||
struct IGameComponent {
|
||||
/* Called when the game is being loaded. */
|
||||
void (*Init)(void);
|
||||
/* Called when the component is being freed. (e.g. due to game being closed) */
|
||||
void (*Free)(void);
|
||||
/* Called to reset the component's state. (e.g. reconnecting to server) */
|
||||
void (*Reset)(void);
|
||||
/* Called to update the component's state when the user begins loading a new map. */
|
||||
void (*OnNewMap)(void);
|
||||
/* Called to update the component's state when the user has finished loading a new map. */
|
||||
void (*OnNewMapLoaded)(void);
|
||||
/* Next component in linked list of components. */
|
||||
struct IGameComponent* next;
|
||||
};
|
||||
/* Adds a component to linked list of components. (always at end) */
|
||||
CC_NOINLINE void Game_AddComponent(struct IGameComponent* comp);
|
||||
|
||||
/* Represents a task that periodically runs on the main thread every specified interval. */
|
||||
struct ScheduledTask;
|
||||
struct ScheduledTask {
|
||||
/* How long (in seconds) has elapsed since callback was last invoked */
|
||||
double Accumulator;
|
||||
/* How long (in seconds) between invocations of the callback */
|
||||
double Interval;
|
||||
/* Callback function that is periodically invoked */
|
||||
void (*Callback)(struct ScheduledTask* task);
|
||||
};
|
||||
|
||||
typedef void (*ScheduledTaskCallback)(struct ScheduledTask* task);
|
||||
/* Adds a component to list of scheduled tasks. (always at end) */
|
||||
CC_NOINLINE int ScheduledTask_Add(double interval, ScheduledTaskCallback callback);
|
||||
#endif
|
@ -12,7 +12,6 @@
|
||||
#include "Platform.h"
|
||||
#include "Bitmap.h"
|
||||
#include "Options.h"
|
||||
#include "GameStructs.h"
|
||||
#include "Funcs.h"
|
||||
|
||||
cc_bool Gui_ClassicTexture, Gui_ClassicTabList, Gui_ClassicMenu, Gui_ClassicChat;
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "Event.h"
|
||||
#include "Entity.h"
|
||||
#include "Model.h"
|
||||
#include "GameStructs.h"
|
||||
#include "Options.h"
|
||||
|
||||
cc_bool HeldBlockRenderer_Show;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "Funcs.h"
|
||||
#include "Logger.h"
|
||||
#include "Stream.h"
|
||||
#include "GameStructs.h"
|
||||
#include "Game.h"
|
||||
|
||||
void HttpRequest_Free(struct HttpRequest* request) {
|
||||
Mem_Free(request->data);
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "Block.h"
|
||||
#include "Event.h"
|
||||
#include "Chat.h"
|
||||
#include "GameStructs.h"
|
||||
|
||||
struct _InventoryData Inventory;
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "Utils.h"
|
||||
#include "Input.h"
|
||||
#include "Window.h"
|
||||
#include "GameStructs.h"
|
||||
#include "Event.h"
|
||||
#include "Http.h"
|
||||
#include "ExtMath.h"
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "World.h"
|
||||
#include "Logger.h"
|
||||
#include "Event.h"
|
||||
#include "GameStructs.h"
|
||||
#include "Game.h"
|
||||
|
||||
cc_int16* Lighting_Heightmap;
|
||||
#define HEIGHT_UNCALCULATED Int16_MaxValue
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "Utils.h"
|
||||
#include "World.h"
|
||||
#include "Options.h"
|
||||
#include "GameStructs.h"
|
||||
|
||||
int MapRenderer_ChunksX, MapRenderer_ChunksY, MapRenderer_ChunksZ;
|
||||
int MapRenderer_1DUsedCount, MapRenderer_ChunksCount;
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "Stream.h"
|
||||
#include "Funcs.h"
|
||||
#include "Options.h"
|
||||
#include "GameStructs.h"
|
||||
|
||||
struct _ModelsData Models;
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "Funcs.h"
|
||||
#include "Game.h"
|
||||
#include "Event.h"
|
||||
#include "GameStructs.h"
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "Picking.h"
|
||||
#include "Funcs.h"
|
||||
#include "Camera.h"
|
||||
#include "GameStructs.h"
|
||||
|
||||
static GfxResourceID pickedPos_vb;
|
||||
#define PICKEDPOS_NUM_VERTICES (16 * 6)
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "Camera.h"
|
||||
#include "Window.h"
|
||||
#include "Particle.h"
|
||||
#include "GameStructs.h"
|
||||
|
||||
cc_uint16 Net_PacketSizes[OPCODE_COUNT];
|
||||
Net_Handler Net_Handlers[OPCODE_COUNT];
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "Funcs.h"
|
||||
#include "Game.h"
|
||||
#include "Camera.h"
|
||||
#include "GameStructs.h"
|
||||
|
||||
/* Data for a selection box. */
|
||||
struct SelectionBox {
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "Protocol.h"
|
||||
#include "Inventory.h"
|
||||
#include "Platform.h"
|
||||
#include "GameStructs.h"
|
||||
|
||||
static char nameBuffer[STRING_SIZE];
|
||||
static char motdBuffer[STRING_SIZE];
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Chat.h"
|
||||
#include "Options.h"
|
||||
#include "Logger.h"
|
||||
#include "GameStructs.h"
|
||||
|
||||
#define LIQUID_ANIM_MAX 64
|
||||
#define WATER_TEX_LOC 14
|
||||
|
Loading…
x
Reference in New Issue
Block a user