make dynamic gl function imports a bit nicer

This commit is contained in:
UnknownShadow200 2020-09-18 18:31:05 +10:00
parent 8d2afa5e15
commit 0eb62ffb24
3 changed files with 16 additions and 22 deletions

View File

@ -549,7 +549,7 @@ static struct SoundGroup* Soundboard_Find(struct Soundboard* board, const String
return NULL;
}
static void Soundboard_Init(struct Soundboard* board, const String* boardName, struct StringsBuffer* files) {
static void Soundboard_Init(struct Soundboard* board, const String* boardName) {
String file, name;
struct SoundGroup* group;
struct Sound* snd;
@ -557,8 +557,8 @@ static void Soundboard_Init(struct Soundboard* board, const String* boardName, s
int i, dotIndex;
board->inited = true;
for (i = 0; i < files->count; i++) {
file = StringsBuffer_UNSAFE_Get(files, i);
for (i = 0; i < files.count; i++) {
file = StringsBuffer_UNSAFE_Get(&files, i);
name = file;
/* dig_grass1.wav -> dig_grass1 */
@ -740,8 +740,8 @@ static void Sounds_Init(void) {
static const String step = String_FromConst("step_");
if (digBoard.inited || stepBoard.inited) return;
Soundboard_Init(&digBoard, &dig, &files);
Soundboard_Init(&stepBoard, &step, &files);
Soundboard_Init(&digBoard, &dig);
Soundboard_Init(&stepBoard, &step);
}
static void Sounds_Free(void) {

View File

@ -135,8 +135,8 @@ enum INFLATE_STATE_ {
INFLATE_STATE_UNCOMPRESSED_DATA, INFLATE_STATE_DYNAMIC_HEADER,
INFLATE_STATE_DYNAMIC_CODELENS, INFLATE_STATE_DYNAMIC_LITSDISTS,
INFLATE_STATE_DYNAMIC_LITSDISTSREPEAT, INFLATE_STATE_COMPRESSED_LIT,
INFLATE_STATE_COMPRESSED_LITREPEAT, INFLATE_STATE_COMPRESSED_DIST,
INFLATE_STATE_COMPRESSED_DISTREPEAT, INFLATE_STATE_COMPRESSED_DATA,
INFLATE_STATE_COMPRESSED_LITEXTRA, INFLATE_STATE_COMPRESSED_DIST,
INFLATE_STATE_COMPRESSED_DISTEXTRA, INFLATE_STATE_COMPRESSED_DATA,
INFLATE_STATE_FASTCOMPRESSED, INFLATE_STATE_DONE
};
@ -649,11 +649,11 @@ void Inflate_Process(struct InflateState* s) {
break;
} else {
s->TmpLit = lit - 257;
s->State = INFLATE_STATE_COMPRESSED_LITREPEAT;
s->State = INFLATE_STATE_COMPRESSED_LITEXTRA;
}
}
case INFLATE_STATE_COMPRESSED_LITREPEAT: {
case INFLATE_STATE_COMPRESSED_LITEXTRA: {
lenIdx = s->TmpLit;
bits = len_bits[lenIdx];
Inflate_EnsureBits(s, bits);
@ -664,10 +664,10 @@ void Inflate_Process(struct InflateState* s) {
case INFLATE_STATE_COMPRESSED_DIST: {
s->TmpDist = Huffman_Decode(s, &s->TableDists);
if (s->TmpDist == -1) return;
s->State = INFLATE_STATE_COMPRESSED_DISTREPEAT;
s->State = INFLATE_STATE_COMPRESSED_DISTEXTRA;
}
case INFLATE_STATE_COMPRESSED_DISTREPEAT: {
case INFLATE_STATE_COMPRESSED_DISTEXTRA: {
distIdx = s->TmpDist;
bits = dist_bits[distIdx];
Inflate_EnsureBits(s, bits);

View File

@ -1057,17 +1057,11 @@ static cc_uint16 gl_indices[GFX_MAX_INDICES];
#ifndef APIENTRY
#define APIENTRY
#endif
typedef void (APIENTRY *FUNC_GLBINDBUFFER) (GLenum target, GLuint buffer);
typedef void (APIENTRY *FUNC_GLDELETEBUFFERS) (GLsizei n, const GLuint *buffers);
typedef void (APIENTRY *FUNC_GLGENBUFFERS) (GLsizei n, GLuint *buffers);
typedef void (APIENTRY *FUNC_GLBUFFERDATA) (GLenum target, cc_uintptr size, const GLvoid* data, GLenum usage);
typedef void (APIENTRY *FUNC_GLBUFFERSUBDATA) (GLenum target, cc_uintptr offset, cc_uintptr size, const GLvoid* data);
static FUNC_GLBINDBUFFER _glBindBuffer;
static FUNC_GLDELETEBUFFERS _glDeleteBuffers;
static FUNC_GLGENBUFFERS _glGenBuffers;
static FUNC_GLBUFFERDATA _glBufferData;
static FUNC_GLBUFFERSUBDATA _glBufferSubData;
static void (APIENTRY *_glBindBuffer)(GLenum target, GLuint buffer);
static void (APIENTRY *_glDeleteBuffers)(GLsizei n, const GLuint *buffers);
static void (APIENTRY *_glGenBuffers)(GLsizei n, GLuint *buffers);
static void (APIENTRY *_glBufferData)(GLenum target, cc_uintptr size, const GLvoid* data, GLenum usage);
static void (APIENTRY *_glBufferSubData)(GLenum target, cc_uintptr offset, cc_uintptr size, const GLvoid* data);
#endif
#if defined CC_BUILD_WEB || defined CC_BUILD_ANDROID