diff --git a/src/Http.c b/src/Http.c index dfb7f4fce..dd2790c2d 100644 --- a/src/Http.c +++ b/src/Http.c @@ -743,7 +743,7 @@ static void Http_WorkerLoop(void) { #ifdef CC_BUILD_WEB /* Access to XMLHttpRequest at 'http://static.classicube.net' from origin 'http://www.classicube.net' has been blocked by CORS policy: */ /* No 'Access-Control-Allow-Origin' header is present on the requested resource. */ -const static String skinServer = String_FromConst("http://www.classicube.net/static/skins/"); +const static String skinServer = String_FromConst("/static/skins/"); #else const static String skinServer = String_FromConst("http://static.classicube.net/skins/"); #endif diff --git a/src/Options.c b/src/Options.c index bec1b0413..0744ca9f3 100644 --- a/src/Options.c +++ b/src/Options.c @@ -123,6 +123,10 @@ void Options_SetString(const String* key, const String* value) { EntryList_Set(&Options, key, value); } +#ifdef CC_BUILD_WEB + Options_Save(); +#endif + if (Options_HasChanged(key)) return; StringsBuffer_Add(&Options_Changed, key); } diff --git a/src/TexturePack.c b/src/TexturePack.c index c99f0a03c..3bb96e109 100644 --- a/src/TexturePack.c +++ b/src/TexturePack.c @@ -18,6 +18,7 @@ #include "Options.h" #include "Logger.h" +#ifndef CC_BUILD_WEB #define LIQUID_ANIM_MAX 64 /* Based off the incredible work from https://dl.dropboxusercontent.com/u/12694594/lava.txt mirrored at https://github.com/UnknownShadow200/ClassicalSharp/wiki/Minecraft-Classic-lava-animation-algorithm @@ -143,6 +144,7 @@ static void WaterAnimation_Tick(BitmapCol* ptr, int size) { } } } +#endif /*########################################################################################################################* @@ -237,11 +239,13 @@ static void Animations_Draw(struct AnimationData* data, TextureLoc texLoc, int s Bitmap_Init(frame, size, size, ptr); if (!data) { +#ifndef CC_BUILD_WEB if (texLoc == 30) { LavaAnimation_Tick((BitmapCol*)frame.Scan0, size); } else if (texLoc == 14) { WaterAnimation_Tick((BitmapCol*)frame.Scan0, size); } +#endif } else { srcX = data->FrameX + data->State * size; Bitmap_CopyBlock(srcX, data->FrameY, 0, 0, &anims_bmp, &frame, size); @@ -262,8 +266,10 @@ static void Animations_Apply(struct AnimationData* data) { data->Tick = data->TickDelay; loc = data->TexLoc; +#ifndef CC_BUILD_WEB if (loc == 30 && anims_useLavaAnim) return; if (loc == 14 && anims_useWaterAnim) return; +#endif Animations_Draw(data, loc, data->FrameSize); } @@ -316,6 +322,7 @@ static void Animations_Validate(void) { static void Animations_Tick(struct ScheduledTask* task) { int i, size; +#ifndef CC_BUILD_WEB if (anims_useLavaAnim) { size = min(Atlas2D.TileSize, 64); Animations_Draw(NULL, 30, size); @@ -324,6 +331,7 @@ static void Animations_Tick(struct ScheduledTask* task) { size = min(Atlas2D.TileSize, 64); Animations_Draw(NULL, 14, size); } +#endif if (!anims_count) return; if (!anims_bmp.Scan0) { diff --git a/src/Window.c b/src/Window.c index f1bb9340e..9696b3941 100644 --- a/src/Window.c +++ b/src/Window.c @@ -4,6 +4,7 @@ #include "Event.h" #include "Logger.h" #include "Funcs.h" +#include "ExtMath.h" int Display_BitsPerPixel; Rect2D Display_Bounds; @@ -2573,9 +2574,8 @@ static void Window_CorrectFocus(void) { } static EM_BOOL Window_MouseWheel(int type, const EmscriptenWheelEvent* ev, void* data) { - /* On my laptop, wheel movement of '1' is reported as '6.666666507' */ - /* TODO: Verify this is the case on other platforms */ - Mouse_SetWheel(Mouse_Wheel - ev->deltaY / 6.666666507f); + /* TODO: The scale factor isn't standardised.. is there a better way though? */ + Mouse_SetWheel(Mouse_Wheel - Math_Sign(ev->deltaY)); Window_CorrectFocus(); return true; } @@ -2734,7 +2734,7 @@ static EM_BOOL Window_KeyPress(int type, const EmscriptenKeyboardEvent* ev, void } static void Window_HookEvents(void) { - emscripten_set_wheel_callback("#canvas", NULL, 0, Window_MouseWheel); + emscripten_set_wheel_callback("#window", NULL, 0, Window_MouseWheel); emscripten_set_mousedown_callback("#canvas", NULL, 0, Window_MouseButton); emscripten_set_mouseup_callback("#canvas", NULL, 0, Window_MouseButton); emscripten_set_mousemove_callback("#canvas", NULL, 0, Window_MouseMove); @@ -2752,7 +2752,7 @@ static void Window_HookEvents(void) { } static void Window_UnhookEvents(void) { - emscripten_set_wheel_callback("#canvas", NULL, 0, NULL); + emscripten_set_wheel_callback("#window", NULL, 0, NULL); emscripten_set_mousedown_callback("#canvas", NULL, 0, NULL); emscripten_set_mouseup_callback("#canvas", NULL, 0, NULL); emscripten_set_mousemove_callback("#canvas", NULL, 0, NULL);