mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 09:35:23 -04:00
N64: Change controls, default to flatgrass, add more blocks in default textures
Also switch to dynamically allocating memory for vorbis decoder when converting .ogg sounds to .wav
This commit is contained in:
parent
3dd9b32f22
commit
cc35e79766
Binary file not shown.
@ -327,9 +327,12 @@ static void SoundPatcher_Save(const char* name, struct HttpRequest* req) {
|
|||||||
cc_string path; char pathBuffer[STRING_SIZE];
|
cc_string path; char pathBuffer[STRING_SIZE];
|
||||||
struct OggState ogg;
|
struct OggState ogg;
|
||||||
struct Stream src, dst;
|
struct Stream src, dst;
|
||||||
struct VorbisState ctx = { 0 };
|
struct VorbisState* ctx;
|
||||||
cc_result res;
|
cc_result res;
|
||||||
|
|
||||||
|
ctx = (struct VorbisState*)Mem_TryAllocCleared(1, sizeof(struct VorbisState));
|
||||||
|
if (!ctx) { Logger_SysWarn(ERR_OUT_OF_MEMORY, "allocating memory"); return; }
|
||||||
|
|
||||||
Stream_ReadonlyMemory(&src, req->data, req->size);
|
Stream_ReadonlyMemory(&src, req->data, req->size);
|
||||||
String_InitArray(path, pathBuffer);
|
String_InitArray(path, pathBuffer);
|
||||||
String_Format1(&path, "audio/%c.wav", name);
|
String_Format1(&path, "audio/%c.wav", name);
|
||||||
@ -338,12 +341,14 @@ static void SoundPatcher_Save(const char* name, struct HttpRequest* req) {
|
|||||||
if (res) { Logger_SysWarn(res, "creating .wav file"); return; }
|
if (res) { Logger_SysWarn(res, "creating .wav file"); return; }
|
||||||
|
|
||||||
Ogg_Init(&ogg, &src);
|
Ogg_Init(&ogg, &src);
|
||||||
ctx.source = &ogg;
|
ctx->source = &ogg;
|
||||||
SoundPatcher_WriteWav(&dst, &ctx);
|
SoundPatcher_WriteWav(&dst, ctx);
|
||||||
|
|
||||||
res = dst.Close(&dst);
|
res = dst.Close(&dst);
|
||||||
if (res) Logger_SysWarn(res, "closing .wav file");
|
if (res) Logger_SysWarn(res, "closing .wav file");
|
||||||
Vorbis_Free(&ctx);
|
|
||||||
|
Vorbis_Free(ctx);
|
||||||
|
Mem_Free(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,13 +127,19 @@ static void SPConnection_BeginConnect(void) {
|
|||||||
|
|
||||||
Random_SeedFromCurrentTime(&rnd);
|
Random_SeedFromCurrentTime(&rnd);
|
||||||
World_NewMap();
|
World_NewMap();
|
||||||
|
|
||||||
#if defined CC_BUILD_LOWMEM
|
#if defined CC_BUILD_LOWMEM
|
||||||
World_SetDimensions(64, 64, 64);
|
World_SetDimensions(64, 64, 64);
|
||||||
#else
|
#else
|
||||||
World_SetDimensions(128, 64, 128);
|
World_SetDimensions(128, 64, 128);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CC_BUILD_N64
|
||||||
|
Gen_Active = &FlatgrassGen;
|
||||||
|
#else
|
||||||
Gen_Active = &NotchyGen;
|
Gen_Active = &NotchyGen;
|
||||||
|
#endif
|
||||||
|
|
||||||
Gen_Seed = Random_Next(&rnd, Int32_MaxValue);
|
Gen_Seed = Random_Next(&rnd, Int32_MaxValue);
|
||||||
Gen_Start();
|
Gen_Start();
|
||||||
|
|
||||||
|
@ -39,7 +39,11 @@ void Window_Init(void) {
|
|||||||
|
|
||||||
// change defaults to make more sense for N64
|
// change defaults to make more sense for N64
|
||||||
cc_uint8* binds = (cc_uint8*)KeyBind_GamepadDefaults;
|
cc_uint8* binds = (cc_uint8*)KeyBind_GamepadDefaults;
|
||||||
binds[KEYBIND_INVENTORY] = CCPAD_Z;
|
binds[KEYBIND_INVENTORY] = CCPAD_B;
|
||||||
|
binds[KEYBIND_PLACE_BLOCK] = CCPAD_Z;
|
||||||
|
binds[KEYBIND_HOTBAR_RIGHT] = CCPAD_L;
|
||||||
|
binds[KEYBIND_DELETE_BLOCK] = CCPAD_R;
|
||||||
|
|
||||||
binds[KEYBIND_FORWARD] = CCPAD_CUP;
|
binds[KEYBIND_FORWARD] = CCPAD_CUP;
|
||||||
binds[KEYBIND_BACK] = CCPAD_CDOWN;
|
binds[KEYBIND_BACK] = CCPAD_CDOWN;
|
||||||
binds[KEYBIND_LEFT] = CCPAD_CLEFT;
|
binds[KEYBIND_LEFT] = CCPAD_CLEFT;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user