diff --git a/src/Animations.c b/src/Animations.c index e6da228c2..75a29f3a9 100644 --- a/src/Animations.c +++ b/src/Animations.c @@ -12,7 +12,7 @@ #include "Options.h" #include "Logger.h" -#ifdef CC_BUILD_ANIMATIONS +#ifndef CC_DISABLE_ANIMATIONS static void Animations_Update(int loc, struct Bitmap* bmp, int stride); #ifdef CC_BUILD_LOWMEM diff --git a/src/Core.h b/src/Core.h index d38b49e20..985ca3d4e 100644 --- a/src/Core.h +++ b/src/Core.h @@ -158,8 +158,6 @@ typedef cc_uint8 cc_bool; #define CC_BUILD_FREETYPE #define CC_BUILD_RESOURCES #define CC_BUILD_PLUGINS -#define CC_BUILD_ANIMATIONS -#define CC_BUILD_HELDBLOCK #define CC_BUILD_FILESYSTEM #define CC_BUILD_ADVLIGHTING /*#define CC_BUILD_GL11*/ @@ -402,7 +400,8 @@ typedef cc_uint8 cc_bool; #define CC_BUILD_TOUCH #define CC_BUILD_SMALLSTACK #define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN - #undef CC_BUILD_ANIMATIONS /* Very costly in FPU less system */ + #define CC_DISABLE_ANIMATIONS /* Very costly in FPU less system */ + #define CC_BUILD_LOW_VRAM /* Only ~640 kb of VRAM */ #undef CC_BUILD_ADVLIGHTING #elif defined __WIIU__ #define CC_BUILD_WIIU @@ -432,8 +431,8 @@ typedef cc_uint8 cc_bool; #define CC_BUILD_NOSOUNDS #undef CC_BUILD_RESOURCES #undef CC_BUILD_NETWORKING - #undef CC_BUILD_ANIMATIONS /* Very costly in FPU less system */ - #undef CC_BUILD_HELDBLOCK /* Very costly in FPU less system */ + #define CC_DISABLE_ANIMATIONS /* Very costly in FPU less system */ + #define CC_DISABLE_HELDBLOCK /* Very costly in FPU less system */ #undef CC_BUILD_ADVLIGHTING #undef CC_BUILD_FILESYSTEM #elif defined OS2 @@ -455,8 +454,8 @@ typedef cc_uint8 cc_bool; #define CC_BUILD_TINYSTACK #undef CC_BUILD_RESOURCES #undef CC_BUILD_NETWORKING - #undef CC_BUILD_ANIMATIONS /* Very costly in FPU less system */ - #undef CC_BUILD_HELDBLOCK /* Very costly in FPU less system */ + #define CC_DISABLE_ANIMATIONS /* Very costly in FPU less system */ + #define CC_DISABLE_HELDBLOCK /* Very costly in FPU less system */ #undef CC_BUILD_ADVLIGHTING #undef CC_BUILD_FILESYSTEM #endif diff --git a/src/EnvRenderer.c b/src/EnvRenderer.c index 3f77a8647..8b4b83ccd 100644 --- a/src/EnvRenderer.c +++ b/src/EnvRenderer.c @@ -916,10 +916,12 @@ static void OnInit(void) { EnvRenderer_Legacy = flags & ENV_LEGACY; EnvRenderer_Minimal = flags & ENV_MINIMAL; +#ifndef CC_BUILD_LOW_VRAM TextureEntry_Register(&clouds_entry); TextureEntry_Register(&skybox_entry); TextureEntry_Register(&snow_entry); TextureEntry_Register(&rain_entry); +#endif Event_Register_(&TextureEvents.PackChanged, NULL, OnTexturePackChanged); Event_Register_(&TextureEvents.AtlasChanged, NULL, OnTerrainAtlasChanged); diff --git a/src/Graphics.h b/src/Graphics.h index 288130c45..08fe488e3 100644 --- a/src/Graphics.h +++ b/src/Graphics.h @@ -104,15 +104,15 @@ SUMMARY: Textures are used to store a bitmap which can then later be used when drawing */ /* Texture should persist across gfx context loss (if backend supports ManagedTextures) */ -#define TEXTURE_FLAG_MANAGED 0x01 +#define TEXTURE_FLAG_MANAGED 0x01 /* Texture should allow updating via Gfx_UpdateTexture */ -#define TEXTURE_FLAG_DYNAMIC 0x02 +#define TEXTURE_FLAG_DYNAMIC 0x02 /* Texture is deliberately (and not accidentally) being created with non power of two dimensions */ -#define TEXTURE_FLAG_NONPOW2 0x04 +#define TEXTURE_FLAG_NONPOW2 0x04 /* Texture can fallback to fewer BPP when necessary (most backends don't do this) */ -#define TEXTURE_FLAG_LOWRES 0x08 +#define TEXTURE_FLAG_LOWRES 0x08 /* Texture should be rendered using bilinear filtering if possible */ -#define TEXTURE_FLAG_BILINEAR 0x10 +#define TEXTURE_FLAG_BILINEAR 0x10 cc_bool Gfx_CheckTextureSize(int width, int height, cc_uint8 flags); /* Creates a new texture. (and also generates mipmaps if mipmaps) */ diff --git a/src/Graphics_NDS.c b/src/Graphics_NDS.c index 37ee273ac..4c08659bc 100644 --- a/src/Graphics_NDS.c +++ b/src/Graphics_NDS.c @@ -401,22 +401,24 @@ static int matrix_modes[] = { GL_PROJECTION, GL_MODELVIEW, GL_TEXTURE }; static int lastMatrix; void Gfx_LoadMatrix(MatrixType type, const struct Matrix* matrix) { - if (type != lastMatrix) { lastMatrix = type; glMatrixMode(matrix_modes[type]); } + if (type != lastMatrix) { + lastMatrix = type; + MATRIX_CONTROL = matrix_modes[type]; + } + // loads 4x4 identity matrix if (matrix == &Matrix_Identity) { - glLoadIdentity(); + MATRIX_IDENTITY = 0; return; // TODO still scale? } - m4x4 m; + // loads 4x4 matrix from memory const float* src = (const float*)matrix; - for (int i = 0; i < 4 * 4; i++) { - m.m[i] = floattof32(src[i]); + MATRIX_LOAD4x4 = floattof32(src[i]); } - glLoadMatrix4x4(&m); // Vertex commands are signed 16 bit values, with 12 bits fractional // aka only from -8.0 to 8.0 diff --git a/src/HeldBlockRenderer.c b/src/HeldBlockRenderer.c index a728fbd48..585fa405c 100644 --- a/src/HeldBlockRenderer.c +++ b/src/HeldBlockRenderer.c @@ -11,7 +11,7 @@ #include "Options.h" cc_bool HeldBlockRenderer_Show; -#ifdef CC_BUILD_HELDBLOCK +#ifndef CC_DISABLE_HELDBLOCK static BlockID held_block; static struct Entity held_entity; static struct Matrix held_blockProj; diff --git a/src/Platform_NDS.c b/src/Platform_NDS.c index 7ae4bc6da..b027b57c4 100644 --- a/src/Platform_NDS.c +++ b/src/Platform_NDS.c @@ -122,8 +122,9 @@ void Platform_EncodePath(cc_filepath* dst, const cc_string* path) { cc_result Directory_Create(const cc_filepath* path) { if (!fat_available) return 0; - Platform_Log1("mkdir %c", path->buffer); - return mkdir(path->buffer, 0) == -1 ? errno : 0; + int ret = mkdir(path->buffer, 0) == -1 ? errno : 0; + Platform_Log2("mkdir %c = %i", path->buffer, &ret); + return ret; } int File_Exists(const cc_filepath* path) {