diff --git a/.gitignore b/.gitignore index 7d2913b..3c46845 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,7 @@ # This .gitignore file was automatically created by Microsoft(R) Visual Studio. ################################################################################ -/.vs -/out +/.vs/CnC_Remastered_Collection/config +/.vs/CnC_Remastered_Collection/v16/ipch/AutoPCH +/.vs/CnC_Remastered_Collection/v16 +/out/build/x86-Debug diff --git a/.vs/CMake Overview b/.vs/CMake Overview new file mode 100644 index 0000000..e69de29 diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json new file mode 100644 index 0000000..38c5f00 --- /dev/null +++ b/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": "x86-Debug" +} \ No newline at end of file diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..2a11e55 --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,8 @@ +{ + "ExpandedNodes": [ + "", + "\\REDALERT" + ], + "SelectedNode": "\\REDALERT\\INIT.CPP", + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/.vs/cmake.db b/.vs/cmake.db new file mode 100644 index 0000000..310343d Binary files /dev/null and b/.vs/cmake.db differ diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 0000000..4de6fe6 Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/.vs/tasks.vs.json b/.vs/tasks.vs.json new file mode 100644 index 0000000..78c226b --- /dev/null +++ b/.vs/tasks.vs.json @@ -0,0 +1,10 @@ +{ + "version": "0.2.1", + "tasks": [ + { + "taskLabel": "task-CMakeLists", + "appliesTo": "CMakeLists.txt", + "type": "launch" + } + ] +} \ No newline at end of file diff --git a/DevIL.dll b/DevIL.dll new file mode 100644 index 0000000..1bd3822 Binary files /dev/null and b/DevIL.dll differ diff --git a/code/.gitignore b/code/.gitignore new file mode 100644 index 0000000..7d2913b --- /dev/null +++ b/code/.gitignore @@ -0,0 +1,6 @@ +################################################################################ +# This .gitignore file was automatically created by Microsoft(R) Visual Studio. +################################################################################ + +/.vs +/out diff --git a/CMakeLists.txt b/code/CMakeLists.txt similarity index 95% rename from CMakeLists.txt rename to code/CMakeLists.txt index b364d1c..3de4312 100644 --- a/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -112,6 +112,7 @@ set(src_redalert ./RedAlert/AIRCRAFT.CPP ./RedAlert/AIRCRAFT.H ./RedAlert/ANIM.CPP + ./RedAlert/CONSOLE.CPP ./RedAlert/ANIM.H ./RedAlert/AUDIO.CPP ./RedAlert/AUDIO.H @@ -709,9 +710,6 @@ add_definitions(-DCHEAT_KEYS -DIMGUI_IMPL_OPENGL_LOADER_GLEW -DSCENARIO_EDITOR - add_compile_options(/permissive+ /Zc:forScope- /Zp1) add_executable(RedAlert ${src_win32lib} ${src_redalert} ${src_external}) -set_target_properties(RedAlert PROPERTIES OUTPUT_NAME "RedAlert" LINK_FLAGS "/PDB:\"RedAlert.pdb\" /SUBSYSTEM:WINDOWS" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/../bin" ) -target_include_directories(RedAlert PRIVATE ./external/;./redalert/win32lib;./external/lua/;./external/imgui;./external/dxsdk/Include;./external/ffmpeg-win32/include;./external/sdl2/include;./win32lib;./external/openal/include) -target_link_libraries(RedAlert "opengl32.lib" "winmm.lib" "Ws2_32.lib" "${CMAKE_SOURCE_DIR}/external/sdl2/lib/x86/SDL2.lib" "${CMAKE_SOURCE_DIR}/external/openal/out/build/x86-Release/OpenAL32.lib") - -add_custom_command( TARGET RedAlert COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/external/openal/out/build/x86-Release/OpenAL32.dll" "${CMAKE_SOURCE_DIR}/../bin/" ) -add_custom_command( TARGET RedAlert COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/external/sdl2/lib/x86/SDL2.dll" "${CMAKE_SOURCE_DIR}/../bin/" ) \ No newline at end of file +set_target_properties(RedAlert PROPERTIES OUTPUT_NAME "RedAlert" LINK_FLAGS "/PDB:\"RedAlert.pdb\" /SUBSYSTEM:WINDOWS" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/.." ) +target_include_directories(RedAlert PRIVATE ./external/devil/;./external/;./redalert/win32lib;./external/lua/;./external/imgui;./external/dxsdk/Include;./external/ffmpeg-win32/include;./external/sdl2/include;./win32lib;./external/openal/include) +target_link_libraries(RedAlert "opengl32.lib" "winmm.lib" "Ws2_32.lib" "${CMAKE_SOURCE_DIR}/external/devil/DevIL.lib" "${CMAKE_SOURCE_DIR}/external/sdl2/lib/x86/SDL2.lib" "${CMAKE_SOURCE_DIR}/external/openal/out/build/x86-Release/OpenAL32.lib") diff --git a/CMakeSettings.json b/code/CMakeSettings.json similarity index 51% rename from CMakeSettings.json rename to code/CMakeSettings.json index c0cb4d9..a54a82d 100644 --- a/CMakeSettings.json +++ b/code/CMakeSettings.json @@ -11,6 +11,18 @@ "ctestCommandArgs": "", "inheritEnvironments": [ "msvc_x86" ], "variables": [] + }, + { + "name": "x86-Release", + "generator": "Ninja", + "configurationType": "RelWithDebInfo", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x86" ], + "variables": [] } ] } \ No newline at end of file diff --git a/code/REDALERT/CONSOLE.CPP b/code/REDALERT/CONSOLE.CPP new file mode 100644 index 0000000..6d96959 --- /dev/null +++ b/code/REDALERT/CONSOLE.CPP @@ -0,0 +1,305 @@ +// CONSOLE.CPP +// + +#include "imgui.h" +#include "FUNCTION.H" + +char console_text[16384]; +int console_text_len = 0; +char command_text[512]; + +#define MAX_ARGS 80 + +static int cmd_argc; +static char* cmd_argv[MAX_ARGS]; +static char* cmd_null_string = ""; +static char* cmd_args = NULL; + +char com_token[1024]; +int com_argc; +char** com_argv; + +typedef struct cmd_function_s +{ + struct cmd_function_s* next; + char* name; + xcommand_t function; +} cmd_function_t; + +static bool executeConsoleCommand = false; + +static cmd_function_t* cmd_functions; // possible commands to execute + +/* +============ +Cmd_AddCommand +============ +*/ +void Cmd_AddCommand(char* cmd_name, xcommand_t function) +{ + cmd_function_t* cmd; + + // fail if the command already exists + for (cmd = cmd_functions; cmd; cmd = cmd->next) + { + if (!strcmp(cmd_name, cmd->name)) + { + Console_Printf("Cmd_AddCommand: %s already defined\n", cmd_name); + return; + } + } + + cmd = (cmd_function_t *)malloc(sizeof(cmd_function_t)); + cmd->name = cmd_name; + cmd->function = function; + cmd->next = cmd_functions; + cmd_functions = cmd; +} + + +/* +============== +Cmd_Argc +============== +*/ +int Cmd_Argc() { + return cmd_argc; +} + +/* +============== +Cmd_Argv +============== +*/ +char* Cmd_Argv(int index) { + return cmd_argv[index]; +} + +/* +============== +COM_Parse + +Parse a token out of a string +============== +*/ +char* COM_Parse(char* data) +{ + int c; + int len; + + len = 0; + com_token[0] = 0; + + if (!data) + return NULL; + + // skip whitespace +skipwhite: + while ((c = *data) <= ' ') + { + if (c == 0) + return NULL; // end of file; + data++; + } + + // skip // comments + if (c == '/' && data[1] == '/') + { + while (*data && *data != '\n') + data++; + goto skipwhite; + } + + + // handle quoted strings specially + if (c == '\"') + { + data++; + while (1) + { + c = *data++; + if (c == '\"' || !c) + { + com_token[len] = 0; + return data; + } + com_token[len] = c; + len++; + } + } + + // parse single characters + if (c == '{' || c == '}' || c == ')' || c == '(' || c == '\'' || c == ':') + { + com_token[len] = c; + len++; + com_token[len] = 0; + return data + 1; + } + + // parse a regular word + do + { + com_token[len] = c; + data++; + len++; + c = *data; + if (c == '{' || c == '}' || c == ')' || c == '(' || c == '\'' || c == ':') + break; + } while (c > 32); + + com_token[len] = 0; + return data; +} + + +/* +============ +Cmd_TokenizeString + +Parses the given string into command line tokens. +============ +*/ +void Cmd_TokenizeString(char* text) +{ + int i; + + // clear the args from the last string + for (i = 0; i < cmd_argc; i++) + free(cmd_argv[i]); + + cmd_argc = 0; + cmd_args = NULL; + + while (1) + { + // skip whitespace up to a /n + while (*text && *text <= ' ' && *text != '\n') + { + text++; + } + + if (*text == '\n') + { // a newline seperates commands in the buffer + text++; + break; + } + + if (!*text) + return; + + if (cmd_argc == 1) + cmd_args = text; + + text = COM_Parse(text); + if (!text) + return; + + if (cmd_argc < MAX_ARGS) + { + cmd_argv[cmd_argc] = (char *)malloc(strlen(com_token) + 1); + strcpy(cmd_argv[cmd_argc], com_token); + cmd_argc++; + } + } + +} + +/* +==================== +Console_Init +==================== +*/ +void Console_Init(void) { + memset(command_text, 0, sizeof(command_text)); + memset(console_text, 0, sizeof(console_text)); + console_text_len = 0; +} + +/* +==================== +Console_Render +==================== +*/ +void Console_Printf(const char* fmt, ...) { + va_list argptr; + char msg[4096]; + + va_start(argptr, fmt); + vsprintf(msg, fmt, argptr); + va_end(argptr); + + int len = strlen(msg); + strcpy(&console_text[console_text_len], msg); + + OutputDebugStringA(msg); + console_text_len += len; +} + +/* +==================== +ExecuteConsoleCommand +==================== +*/ +void ExecuteConsoleCommand(void) { + cmd_function_t* cmd; + + if (strlen(command_text) <= 0) + return; + + Console_Printf("%s\n", command_text); + Cmd_TokenizeString(command_text); + + memset(command_text, 0, sizeof(command_text)); + + for (cmd = cmd_functions; cmd; cmd = cmd->next) + { + if (!strcmp(Cmd_Argv(0), cmd->name)) + { + cmd->function(); + return; + } + } + + Console_Printf("Unknown command %s\n", Cmd_Argv(0)); +} + +/* +==================== +Console_Render +==================== +*/ +void Console_Render(void) { + bool ScreenActive; + + ImGuiStyle& style = ImGui::GetStyle(); + style.FramePadding = ImVec2(0, 0); + ImGui::SetNextWindowSize(ImVec2(420, 270)); + ImGui::SetNextWindowPos(ImVec2(0, 0)); + ImGui::Begin("Developer Console", &ScreenActive, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoScrollbar); + ImVec2 textres(420, 180); + ImGui::PushID("ConsoleTxt"); + ImGui::InputTextMultiline("", &console_text[0], sizeof(console_text), textres, ImGuiInputTextFlags_ReadOnly); + ImGui::PopID(); + ImGui::Text("Commands"); + ImGui::PushID("CmdTxt"); + ImGui::InputText("", &command_text[0], sizeof(command_text)); + ImGui::PopID(); + ImGui::SameLine(); + if (ImGui::Button("Execute")) { + executeConsoleCommand = true; + } + ImGui::End(); +} + +/* +================= +Console_Tick +================= +*/ +void Console_Tick(void) { + if (executeConsoleCommand) { + ExecuteConsoleCommand(); + executeConsoleCommand = false; + } +} \ No newline at end of file diff --git a/code/REDALERT/FUNCTION.H b/code/REDALERT/FUNCTION.H index 3f51fe3..d67c906 100644 --- a/code/REDALERT/FUNCTION.H +++ b/code/REDALERT/FUNCTION.H @@ -1084,6 +1084,21 @@ void GlyphX_Debug_Print(const char *debug_text); void Disable_Uncompressed_Shapes (void); void Enable_Uncompressed_Shapes (void); +int Cmd_Argc(); +char* Cmd_Argv(int index); + +void Console_Init(void); +void Console_Render(void); +void Console_Printf(const char* fmt, ...); +void Console_Tick(void); + +typedef void (*xcommand_t) (void); +void Cmd_AddCommand(char* cmd_name, xcommand_t function); + + +#include +extern jmp_buf select_game_jump; + /* ** Achievement event. ST - 11/11/2019 11:39AM */ diff --git a/code/REDALERT/INIT.CPP b/code/REDALERT/INIT.CPP index e180f4e..40ff26c 100644 --- a/code/REDALERT/INIT.CPP +++ b/code/REDALERT/INIT.CPP @@ -446,6 +446,9 @@ bool Init_Game(int , char * []) extern bool Get_Broadcast_Addresses (void); #endif + +jmp_buf select_game_jump; + /*********************************************************************************************** * Select_Game -- The game's main menu * * * @@ -515,6 +518,13 @@ bool Select_Game(bool fade) int cdcheck = 0; bool cs = Is_Counterstrike_Installed(); #endif + + setjmp(select_game_jump); + + if (Scen.warpIntoMap) { + Scen.warpIntoMap = false; + return true; + } // #ifndef DVD // Denzil - We want the menu screen ajw No we don't // if (Special.IsFromInstall) { @@ -3399,7 +3409,7 @@ static void Init_Mouse(void) if (MouseInstalled) { void const * temp_mouse_shapes = MFCD::Retrieve("MOUSE.SHP"); if (temp_mouse_shapes) { - Set_Mouse_Cursor(0, 0, Extract_Shape(temp_mouse_shapes, 0)); + Set_Mouse_Cursor(0, 0, 0); while (Get_Mouse_State() > 1) Show_Mouse(); } } else { diff --git a/code/REDALERT/Image.h b/code/REDALERT/Image.h new file mode 100644 index 0000000..144c1e6 --- /dev/null +++ b/code/REDALERT/Image.h @@ -0,0 +1,10 @@ +// Image.h +// + +struct Image_t { + unsigned int image; + int width; + int height; +}; + +Image_t* Image_LoadImage(const char* name); \ No newline at end of file diff --git a/code/REDALERT/MAPSEL.CPP b/code/REDALERT/MAPSEL.CPP index 837afa9..d893c50 100644 --- a/code/REDALERT/MAPSEL.CPP +++ b/code/REDALERT/MAPSEL.CPP @@ -257,7 +257,7 @@ char const * Map_Selection(void) frame++; frame %= count; timer = delay; - Set_Mouse_Cursor(xspot, yspot, Extract_Shape(MouseClass::MouseShapes, start + frame)); + Set_Mouse_Cursor(xspot, yspot, start + frame); } if (_flags == KN_LMOUSE) { { @@ -287,7 +287,7 @@ char const * Map_Selection(void) ** Restore the mouse to normal shape before leaving this routine. */ Set_Mouse(MOUSE_NORMAL, start, count, delay, xspot, yspot); - Set_Mouse_Cursor(xspot, yspot, Extract_Shape(MouseClass::MouseShapes, start)); + Set_Mouse_Cursor(xspot, yspot, start); Keyboard->Clear(); // BlackPalette.Set(FADE_PALETTE_SLOW, Call_Back); diff --git a/code/REDALERT/MENUS.CPP b/code/REDALERT/MENUS.CPP index cc521e8..524d4e7 100644 --- a/code/REDALERT/MENUS.CPP +++ b/code/REDALERT/MENUS.CPP @@ -33,6 +33,7 @@ * Main_Menu -- Menu processing * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include "imgui.h" #include "function.h" #ifdef WIN32 #include "ccdde.h" @@ -734,7 +735,6 @@ int Main_Menu(unsigned long ) bool display = true; bool process = true; while (process) { - #ifdef WIN32 /* ** If we have just received input focus again after running in the background then diff --git a/code/REDALERT/MOUSE.CPP b/code/REDALERT/MOUSE.CPP index 9a11571..cf9c0ab 100644 --- a/code/REDALERT/MOUSE.CPP +++ b/code/REDALERT/MOUSE.CPP @@ -151,12 +151,12 @@ void MouseClass::Mouse_Small(bool wsmall) if (wsmall) { if (control->SmallFrame != -1) { - Set_Mouse_Cursor(control->X, control->Y, Extract_Shape(MouseShapes, control->SmallFrame + Frame/4)); + Set_Mouse_Cursor(control->X, control->Y, control->SmallFrame + Frame / 4); } else { - Set_Mouse_Cursor(MouseControl[MOUSE_NORMAL].X, MouseControl[MOUSE_NORMAL].Y, Extract_Shape(MouseShapes, MOUSE_NORMAL)); + Set_Mouse_Cursor(MouseControl[MOUSE_NORMAL].X, MouseControl[MOUSE_NORMAL].Y, MOUSE_NORMAL); } } else { - Set_Mouse_Cursor(control->X, control->Y, Extract_Shape(MouseShapes, control->StartFrame + Frame/4)); + Set_Mouse_Cursor(control->X, control->Y, control->StartFrame + Frame / 4); } } @@ -217,7 +217,7 @@ bool MouseClass::Override_Mouse_Shape(MouseType mouse, bool wsmall) baseshp = control->StartFrame; } - Set_Mouse_Cursor(control->X, control->Y, Extract_Shape(MouseShapes, baseshp)); + Set_Mouse_Cursor(control->X, control->Y, baseshp); CurrentMouseShape = mouse; IsSmall = wsmall; return(true); @@ -260,7 +260,7 @@ void MouseClass::AI(KeyNumType &input, int x, int y) if (!IsSmall || control->SmallFrame != -1) { int baseframe = (IsSmall) ? control->SmallFrame : control->StartFrame; if (baseframe == -1) baseframe = control->StartFrame; - Set_Mouse_Cursor(control->X, control->Y, Extract_Shape(MouseShapes, baseframe + Frame)); + Set_Mouse_Cursor(control->X, control->Y, baseframe + Frame); } } diff --git a/code/REDALERT/SCENARIO.CPP b/code/REDALERT/SCENARIO.CPP index 489fc7e..0d890b4 100644 --- a/code/REDALERT/SCENARIO.CPP +++ b/code/REDALERT/SCENARIO.CPP @@ -114,6 +114,8 @@ bool Is_Mission_Aftermath (char *file_name); MapScript* mapScript = nullptr; bool mapScriptPlayStart = false; +void Cmd_Map(void); + /*********************************************************************************************** * ScenarioClass::ScenarioClass -- Constructor for the scenario control object. * * * @@ -183,6 +185,10 @@ ScenarioClass::ScenarioClass(void) : strcpy(BriefingText, ""); memset(GlobalFlags, '\0', sizeof(GlobalFlags)); memset(Views, '\0', sizeof(Views)); +// jmarshall + warpIntoMap = false; + Cmd_AddCommand("map", Cmd_Map); +// jmarshall end } @@ -316,9 +322,12 @@ bool ScenarioClass::Set_Global_To(int global, bool value) bool Start_Scenario(char * name, bool briefing) { //BG Theme.Queue_Song(THEME_QUIET); + Console_Printf("Start_Scenario: %s\n", name); + Theme.Stop(); IsTanyaDead = SaveTanya; if (!Read_Scenario(name)) { + Console_Printf("Failed to load scenario!\n"); return(false); } @@ -3738,4 +3747,19 @@ void Disect_Scenario_Name(char const * name, int & scenario, ScenarioPlayerType */ var = SCEN_VAR_A; var = ScenarioVarType((name[6] - 'A') + SCEN_VAR_A); +} + +/* +============= +Cmd_Map +============= +*/ +void Cmd_Map(void) { + if (Cmd_Argc() != 2) { + Console_Printf("usage: map \n"); + return; + } + Scen.warpIntoMap = true; + Start_Scenario(Cmd_Argv(1)); + longjmp(select_game_jump, 1); } \ No newline at end of file diff --git a/code/REDALERT/SCENARIO.H b/code/REDALERT/SCENARIO.H index 3bf0d91..10eb9fc 100644 --- a/code/REDALERT/SCENARIO.H +++ b/code/REDALERT/SCENARIO.H @@ -327,6 +327,7 @@ class ScenarioClass { bool bOtherProposesDraw; // True if the other player in a 2-player game has a draw offer extended. #endif + bool warpIntoMap; }; diff --git a/code/REDALERT/STARTUP.CPP b/code/REDALERT/STARTUP.CPP index 41ce665..ed3f40c 100644 --- a/code/REDALERT/STARTUP.CPP +++ b/code/REDALERT/STARTUP.CPP @@ -195,6 +195,10 @@ int PASCAL WinMain ( HINSTANCE instance , HINSTANCE , char * command_line , int ** and if so, switch to the existing instance and terminate ourselves. */ SpawnedFromWChat = false; + + Console_Init(); + Console_Printf("Red Alert Build %s %s\n", __DATE__, __TIME__); + #if (0)//PG if (RA95AlreadyRunning) { //Set in the DDEServer constructor //MessageBox (NULL, "Error - attempt to restart Red Alert 95 when already running.", "Red Alert", MB_ICONEXCLAMATION|MB_OK); @@ -545,24 +549,6 @@ int PASCAL WinMain ( HINSTANCE instance , HINSTANCE , char * command_line , int video_success = TRUE; } -// jmarshall - IMGUI_CHECKVERSION(); - ImGui::CreateContext(); - ImGuiIO& io = ImGui::GetIO(); (void)io; - //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls - //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls - - // Setup Dear ImGui style - ImGui::StyleColorsDark(); - //ImGui::StyleColorsClassic(); - - // Setup Platform/Renderer bindings - ImGui_ImplSDL2_InitForD3D(game_window); - ImGui_ImplOpenGL3_Init(); - - io.Fonts->AddFontFromFileTTF("Roboto-Medium.ttf", 16.0f); -// jmarshall end - if (!video_success) { MessageBox(MainWindow, TEXT_VIDEO_ERROR, TEXT_SHORT_TITLE, MB_ICONEXCLAMATION|MB_OK); if (WindowsTimer) delete WindowsTimer; diff --git a/code/REDALERT/VQAMOVIE.CPP b/code/REDALERT/VQAMOVIE.CPP index 64d143a..66234ce 100644 --- a/code/REDALERT/VQAMOVIE.CPP +++ b/code/REDALERT/VQAMOVIE.CPP @@ -101,8 +101,6 @@ long VQA_Play(_VQAHandle* vqaHandle) { int currentFrame = 0; bool shouldSampleAudio = true; - return 0; - smk_first(vqaHandle->smacker_video); while (currentFrame < vqaHandle->frame_count) { @@ -138,6 +136,7 @@ long VQA_Play(_VQAHandle* vqaHandle) { //} raw_image_buffer = smk_get_palette(vqaHandle->smacker_video); + Set_DD_Palette(raw_image_buffer, false); vqaHandle->video_graphics_buffer->Lock(); VQA_Dropsample(smk_get_video(vqaHandle->smacker_video), vqaHandle->width, vqaHandle->height, ScreenWidth, ScreenHeight); diff --git a/code/REDALERT/WIN32LIB/DrawMisc.cpp b/code/REDALERT/WIN32LIB/DrawMisc.cpp index 8083d38..5c6b0e8 100644 --- a/code/REDALERT/WIN32LIB/DrawMisc.cpp +++ b/code/REDALERT/WIN32LIB/DrawMisc.cpp @@ -1352,60 +1352,219 @@ unsigned char* Draw_Dropsample(const unsigned char* in, int inwidth, int inheigh return out; } -BOOL __cdecl Linear_Scale_To_Linear(void *this_object, void *dest, int src_x, int src_y, int dst_x, int dst_y, int src_width, int src_height, int dst_width, int dst_height, BOOL trans, char *remap) +BOOL __cdecl Linear_Scale_To_Linear(void* this_object, void* dest, int src_x, int src_y, int dst_x, int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL use_keysrc, char* fade) { - GraphicViewPortClass* viewportClass = (GraphicViewPortClass*)this_object; - GraphicViewPortClass* destViewportClass = (GraphicViewPortClass*)dest; + GraphicViewPortClass& src_vp = *(GraphicViewPortClass*)this_object; + GraphicViewPortClass& dst_vp = *(GraphicViewPortClass*)dest; - unsigned char* viewportBuffer = ((unsigned char*)viewportClass->Get_Offset()); + // If there is nothing to scale, just return. + if (src_w <= 0 || src_h <= 0 || dst_w <= 0 || dst_h <= 0) { + return false; + } - // Scale the GraphicViewPortClass to dest_x, dest_y - unsigned char* scaled_buffer = Draw_Dropsample((unsigned char*)viewportBuffer, viewportClass->Get_Width(), viewportClass->Get_Height(), dst_width, dst_height); + int sx = src_x; + int sy = src_y; + int dx = dst_x; + int dy = dst_y; + int dw = dst_w + dst_x; + int dh = dst_h + dst_y; - // Blit the scaled_buffer to dest. - Nearest_CopyImage(scaled_buffer, src_x, src_y, dst_width, dst_height, (unsigned char*)destViewportClass->Get_Offset(), dst_x, dst_y, destViewportClass->Get_Width(), dst_width, dst_height, trans); + // These ifs are all for clipping purposes incase coords are outside + // the expected area. + if (src_x < 0) { + sx = 0; + dx = dst_x + ((dst_w * -src_x) / src_w); + } + + if (src_y < 0) { + sy = 0; + dy = dst_y + ((dst_h * -src_y) / src_h); + } + + if (src_x + src_w > src_vp.Get_Width() + 1) { + dw = dst_x + (dst_w * (src_vp.Get_Width() - src_x) / src_w); + } + + if (src_y + src_h > src_vp.Get_Height() + 1) { + dh = dst_y + (dst_h * (src_vp.Get_Height() - src_y) / src_h); + } + + if (dx < 0) { + dx = 0; + sx = src_x + ((src_w * -dst_x) / dst_w); + } + + if (dy < 0) { + dy = 0; + sy = src_y + ((src_h * -dst_y) / dst_h); + } + + if (dw > dst_vp.Get_Width() + 1) { + dw = dst_vp.Get_Width(); + } + + if (dh > dst_vp.Get_Height() + 1) { + dh = dst_vp.Get_Height(); + } + + if (dy > dh || dx > dw) { + return false; + } + + uint8_t* src = sy * src_vp.Get_Full_Pitch() + sx + (uint8_t*)(src_vp.Get_Offset()); + uint8_t* dst = dy * dst_vp.Get_Full_Pitch() + dx + (uint8_t*)(dst_vp.Get_Offset()); + dw -= dx; + dh -= dy; + int x_ratio = ((src_w << 16) / dw) + 1; + int y_ratio = ((src_h << 16) / dh) + 1; + + // keysrc basically means do we skip index 0 entries, thus treating them as + // transparent? + if (use_keysrc) { + if (fade != nullptr) { + for (int i = 0; i < dh; ++i) { + uint8_t* d = dst + i * dst_vp.Get_Full_Pitch(); + uint8_t* s = src + ((i * y_ratio) >> 16) * src_vp.Get_Full_Pitch(); + int xrat = 0; + + for (int j = 0; j < dw; ++j) { + uint8_t tmp = s[xrat >> 16]; + + if (tmp != 0) { + *d = ((uint8_t*)(fade))[tmp]; + } + + ++d; + xrat += x_ratio; + } + } + } + else { + for (int i = 0; i < dh; ++i) { + uint8_t* d = dst + i * dst_vp.Get_Full_Pitch(); + uint8_t* s = src + ((i * y_ratio) >> 16) * src_vp.Get_Full_Pitch(); + int xrat = 0; + + for (int j = 0; j < dw; ++j) { + uint8_t tmp = s[xrat >> 16]; + + if (tmp != 0) { + *d = tmp; + } + + ++d; + xrat += x_ratio; + } + } + } + } + else { + if (fade != nullptr) { + for (int i = 0; i < dh; ++i) { + uint8_t* d = dst + i * dst_vp.Get_Full_Pitch(); + uint8_t* s = src + ((i * y_ratio) >> 16) * src_vp.Get_Full_Pitch(); + int xrat = 0; + + for (int j = 0; j < dw; ++j) { + *d++ = ((uint8_t*)(fade))[s[xrat >> 16]]; + xrat += x_ratio; + } + } + } + else { + for (int i = 0; i < dh; ++i) { + uint8_t* d = dst + i * dst_vp.Get_Full_Pitch(); + uint8_t* s = src + ((i * y_ratio) >> 16) * src_vp.Get_Full_Pitch(); + int xrat = 0; + + for (int j = 0; j < dw; ++j) { + *d++ = s[xrat >> 16]; + xrat += x_ratio; + } + } + } + } return true; } -BOOL __cdecl Linear_Blit_To_Linear(void* this_object, void* dest, int x_pixel, int y_pixel, int dest_x0, int dest_y0, int pixel_width, int pixel_height, BOOL trans) +BOOL __cdecl Linear_Blit_To_Linear(void* this_object, void* dest, int src_x, int src_y, int dst_x, int dst_y, int w, int h, BOOL use_key) { - GraphicViewPortClass* viewportClass = (GraphicViewPortClass*)this_object; - GraphicViewPortClass* destViewportClass = (GraphicViewPortClass*)dest; - bool needsUnlock = false; - bool sourceNeedsUnlock = false; + GraphicViewPortClass& src_vp = *(GraphicViewPortClass *)this_object; + GraphicViewPortClass& dst_vp = *(GraphicViewPortClass*)dest; - unsigned char* viewportBuffer = NULL; - viewportBuffer = ((unsigned char*)viewportClass->Get_Offset()); + uint8_t* src = (uint8_t*)(src_vp.Get_Offset()); + uint8_t* dst = (uint8_t*)(dst_vp.Get_Offset()); + int src_pitch = src_vp.Get_Full_Pitch(); + int dst_pitch = dst_vp.Get_Full_Pitch(); - unsigned char* destBuffer = NULL; - destBuffer = ((unsigned char*)destViewportClass->Get_Offset()); + if (src_x >= src_vp.Get_Width() || src_y >= src_vp.Get_Height() || dst_x >= dst_vp.Get_Width() + || dst_y >= dst_vp.Get_Height() || h < 0 || w < 1) { + return 0; + } - //if (destViewportClass->Get_Graphic_Buffer()->Get_Buffer() != NULL) { - // destBuffer = (byte*)destViewportClass->Get_Graphic_Buffer()->Get_Buffer(); - //} - //else { - // destViewportClass->Get_Graphic_Buffer()->Lock(); - // destBuffer = ((byte*)destViewportClass->Get_Graphic_Buffer()->GetMemoryBuffer()); - // needsUnlock = true; - //} - // - //if (viewportBuffer == NULL) { - // viewportClass->Get_Graphic_Buffer()->Lock(); - // viewportBuffer = ((byte*)viewportClass->Get_Graphic_Buffer()->GetMemoryBuffer()); - // sourceNeedsUnlock = true; - //} - - // Blit the buffer to dest. - Nearest_CopyImage(viewportBuffer, x_pixel, y_pixel, viewportClass->Get_Width(), viewportClass->Get_Height(), (unsigned char*)destBuffer, dest_x0, dest_y0, destViewportClass->Get_Width(), pixel_width, pixel_height, trans); + src_x = max(0, src_x); + src_y = max(0, src_y); + dst_x = max(0, dst_x); + dst_y = max(0, dst_y); - //if (needsUnlock) { - // destViewportClass->Get_Graphic_Buffer()->Unlock(); - //} - // - //if (sourceNeedsUnlock) { - // viewportClass->Get_Graphic_Buffer()->Unlock(); - //} + h = (dst_y + h) > dst_vp.Get_Height() ? dst_vp.Get_Height() - 1 - dst_y : h; + w = (dst_x + w) > dst_vp.Get_Width() ? dst_vp.Get_Width() - 1 - dst_x : w; + + // move our pointers to the start locations + src += src_x + src_y * src_pitch; + dst += dst_x + dst_y * dst_pitch; + + // If src is before dst, we run the risk of overlapping memory regions so we + // need to move src and dst to the last line and work backwards + if (src < dst) { + uint8_t* esrc = src + (h - 1) * src_pitch; + uint8_t* edst = dst + (h - 1) * dst_pitch; + if (use_key) { + char key_colour = 0; + while (h-- != 0) { + // Can't optimize as we need to check every pixel against key colour :( + for (int i = w - 1; i >= 0; --i) { + if (esrc[i] != key_colour) { + edst[i] = esrc[i]; + } + } + + edst -= dst_pitch; + esrc -= src_pitch; + } + } + else { + while (h-- != 0) { + memmove(edst, esrc, w); + edst -= dst_pitch; + esrc -= src_pitch; + } + } + } + else { + if (use_key) { + uint8_t key_colour = 0; + while (h-- != 0) { + // Can't optimize as we need to check every pixel against key colour :( + for (int i = 0; i < w; ++i) { + if (src[i] != key_colour) { + dst[i] = src[i]; + } + } + + dst += dst_pitch; + src += src_pitch; + } + } + else { + while (h-- != 0) { + memmove(dst, src, w); + dst += dst_pitch; + src += src_pitch; + } + } + } return true; } diff --git a/code/REDALERT/WIN32LIB/GBUFFER.CPP b/code/REDALERT/WIN32LIB/GBUFFER.CPP index f9b9a4b..946545d 100644 --- a/code/REDALERT/WIN32LIB/GBUFFER.CPP +++ b/code/REDALERT/WIN32LIB/GBUFFER.CPP @@ -553,43 +553,3 @@ BOOL GraphicBufferClass::Unlock(void) LockCount--; return(TRUE); } - - -/*********************************************************************************************** - * GVPC::DD_Linear_Blit_To_Linear -- blit using the hardware blitter * - * * - * * - * * - * INPUT: destination vvpc * - * x coord to blit from * - * y coord to blit from * - * x coord to blit to * - * y coord to blit to * - * width to blit * - * height to blit * - * * - * OUTPUT: DD_OK if successful * - * * - * WARNINGS: None * - * * - * HISTORY: * - * 09-22-95 11:05am ST : Created * - *=============================================================================================*/ - -HRESULT GraphicViewPortClass::DD_Linear_Blit_To_Linear ( - GraphicViewPortClass &dest - , int source_x - , int source_y - , int dest_x - , int dest_y - , int width - , int height - , BOOL mask ) - -{ - Nearest_CopyImage((unsigned char*)GraphicBuff->GetMemoryBuffer(), source_x, source_y, GraphicBuff->Get_Width(), GraphicBuff->Get_Height(), (unsigned char *)dest.Get_Graphic_Buffer()->GetMemoryBuffer(), dest_x, dest_y, dest.Get_Graphic_Buffer()->Get_Width(), GraphicBuff->Get_Width(), GraphicBuff->Get_Height(), true); - return S_OK; -} - - - diff --git a/code/REDALERT/WIN32LIB/GBUFFER.H b/code/REDALERT/WIN32LIB/GBUFFER.H index 4faa102..6aad38d 100644 --- a/code/REDALERT/WIN32LIB/GBUFFER.H +++ b/code/REDALERT/WIN32LIB/GBUFFER.H @@ -140,45 +140,6 @@ extern unsigned char* backbuffer_data_raw; #ifndef FUNCTION_H - -__forceinline void Nearest_Fill(unsigned char source, unsigned char* dest, int destX, int destY, int destWidth, int width, int height, bool trans) -{ - for (int y = 0; y < height; y++) - { - for (int x = 0; x < width; x++) - { - int _x = x; - int _y = y; - int destPos = (destWidth * (_y + (destY))) + (_x + (destX)); - - dest[destPos] = source; - } - } -} - -__forceinline void Nearest_CopyImage(unsigned char* source, int sourceX, int sourceY, int sourceWidth, int sourceHeight, unsigned char* dest, int destX, int destY, int destWidth, int width, int height, bool trans) -{ - for (int y = 0; y < height; y++) - { - for (int x = 0; x < width; x++) - { - int _x = x; - int _y = y; - int destPos = (destWidth * (_y + (destY))) + (_x + (destX)); - int sourcePos = (sourceWidth * (_y + (sourceY))) + (_x + (sourceX)); - - if (sourcePos > sourceWidth * sourceHeight) - return; - - if (destPos < 0) - return; - - if (source[sourcePos] != 0 || trans == false) - dest[destPos] = source[sourcePos]; - } - } -} - //#pragma off (unreferenced) #ifndef BITMAPCLASS @@ -353,9 +314,6 @@ class GraphicViewPortClass { inline BOOL Unlock(); inline int Get_LockCount(); - // Member to blit using direct draw access to hardware blitter - HRESULT DD_Linear_Blit_To_Linear ( GraphicViewPortClass &dest, int source_x, int source_y, int dest_x, int dest_y, int width , int height, BOOL mask ); - /*===================================================================*/ /* Define functions to attach the viewport to a graphicbuffer */ /*===================================================================*/ @@ -793,22 +751,15 @@ inline HRESULT GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int x_pix { HRESULT return_code=0; - if ( IsDirectDraw && dest.IsDirectDraw ){ - return(DD_Linear_Blit_To_Linear( dest, XPos+x_pixel, YPos+y_pixel - , dest.Get_XPos()+dx_pixel, dest.Get_YPos()+dy_pixel - , pixel_width, pixel_height, trans)); - } else { - - if (Lock()){ - if (dest.Lock()){ - return_code=(Linear_Blit_To_Linear(this, &dest, x_pixel, y_pixel - , dx_pixel, dy_pixel - , pixel_width, pixel_height, trans)); - } - dest.Unlock(); + if (Lock()) { + if (dest.Lock()) { + return_code = (Linear_Blit_To_Linear(this, &dest, x_pixel, y_pixel + , dx_pixel, dy_pixel + , pixel_width, pixel_height, trans)); } - Unlock(); + dest.Unlock(); } + Unlock(); return ( return_code ); } @@ -830,22 +781,15 @@ inline HRESULT GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int dx, i HRESULT return_code=0; - if ( IsDirectDraw && dest.IsDirectDraw ){ - return(DD_Linear_Blit_To_Linear( dest, XPos, YPos - , dest.Get_XPos()+dx, dest.Get_YPos()+dy - , Width, Height, trans)); - } else { - - if (Lock()){ - if (dest.Lock()){ - return_code=(Linear_Blit_To_Linear(this, &dest, 0, 0 - , dx, dy - , Width, Height, trans)); - } - dest.Unlock(); + if (Lock()) { + if (dest.Lock()) { + return_code = (Linear_Blit_To_Linear(this, &dest, 0, 0 + , dx, dy + , Width, Height, trans)); } - Unlock(); + dest.Unlock(); } + Unlock(); return (return_code); @@ -868,24 +812,15 @@ inline HRESULT GraphicViewPortClass::Blit( GraphicViewPortClass& dest, BOOL tran HRESULT return_code=0; - if ( IsDirectDraw && dest.IsDirectDraw ){ - return (DD_Linear_Blit_To_Linear(dest, XPos, YPos - , dest.Get_XPos(), dest.Get_YPos() - , MAX(Width, dest.Get_Width()) - , MAX(Height, dest.Get_Height()) - , trans)); - } else { - - if (Lock()){ - if (dest.Lock()){ - return_code=(Linear_Blit_To_Linear(this, &dest, 0, 0 - , 0, 0 - , Width, Height, trans)); - } - dest.Unlock(); + if (Lock()) { + if (dest.Lock()) { + return_code = (Linear_Blit_To_Linear(this, &dest, 0, 0 + , 0, 0 + , Width, Height, trans)); } - Unlock(); + dest.Unlock(); } + Unlock(); return (return_code); diff --git a/code/REDALERT/WIN32LIB/MISC.H b/code/REDALERT/WIN32LIB/MISC.H index 8d4aafd..a9a23aa 100644 --- a/code/REDALERT/WIN32LIB/MISC.H +++ b/code/REDALERT/WIN32LIB/MISC.H @@ -56,7 +56,7 @@ void Wait_Blit(void); unsigned Get_Video_Hardware_Capabilities(void); void Wait_Vert_Blank(void); -void Set_DD_Palette (void *palette); +void Set_DD_Palette (void *palette, bool raShift = true); /* ** Pointer to function to call if we detect a focus loss diff --git a/code/REDALERT/WIN32LIB/MOUSE.H b/code/REDALERT/WIN32LIB/MOUSE.H index 51ebe44..e84b473 100644 --- a/code/REDALERT/WIN32LIB/MOUSE.H +++ b/code/REDALERT/WIN32LIB/MOUSE.H @@ -34,11 +34,13 @@ #include +#define MAX_CURSOR_FRAMES 221 + class WWMouseClass { public: WWMouseClass(GraphicViewPortClass *scr, int mouse_max_width, int mouse_max_height); ~WWMouseClass(); - void *Set_Cursor(int xhotspot, int yhotspot, void *cursor); + void *Set_Cursor(int xhotspot, int yhotspot, int cursor); void Process_Mouse(void); void Hide_Mouse(void); void Show_Mouse(void); @@ -77,6 +79,8 @@ class WWMouseClass { char* Get_Image_Buff(void) { return MouseCursor; } void* Get_Frame_Pointer() { return PrevCursor; } void Set_Frame_Pointer(void* frame) { PrevCursor = (char *)frame; } + + void RenderMouse(void); // jmarshall end private: enum { @@ -120,7 +124,12 @@ class WWMouseClass { CRITICAL_SECTION MouseCriticalSection; // Control for mouse re-enterancy unsigned TimerHandle; - +// jmarshall +private: + struct Image_t* cursor_frames[MAX_CURSOR_FRAMES]; + struct Image_t* current_cursor; + bool isMouseVisible; +// jmarshall end }; void __cdecl Mouse_Shadow_Buffer(WWMouseClass& mouse, GraphicViewPortClass& viewport, void* buffer, int x_pos, int y_pos, int hspot_x, int hspot_y, BOOL save); @@ -134,7 +143,7 @@ void Show_Mouse(bool clearPrevious = true); void Conditional_Hide_Mouse(int x1, int y1, int x2, int y2); void Conditional_Show_Mouse(void); int Get_Mouse_State(void); -void *Set_Mouse_Cursor(int hotx, int hoty, void *cursor); +void *Set_Mouse_Cursor(int hotx, int hoty, int cursor); int Get_Mouse_X(void); int Get_Mouse_Y(void); diff --git a/code/REDALERT/WIN32LIB/MOUSEWW.CPP b/code/REDALERT/WIN32LIB/MOUSEWW.CPP index 0e170f4..d2a27a1 100644 --- a/code/REDALERT/WIN32LIB/MOUSEWW.CPP +++ b/code/REDALERT/WIN32LIB/MOUSEWW.CPP @@ -30,7 +30,9 @@ * WWMouseClass::WWMouseClass -- Constructor for the Mouse Class * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include "imgui.h" #include "mouse.h" +#include "../image.h" #include static WWMouseClass *_Mouse=NULL; @@ -98,6 +100,15 @@ WWMouseClass::WWMouseClass(GraphicViewPortClass *scr, int mouse_max_width, int m ** Force the windows mouse pointer to stay withing the graphic view port region */ Set_Cursor_Clip(); + + for (int i = 0; i < MAX_CURSOR_FRAMES; i++) { + char mouseFrameName[512]; + sprintf(mouseFrameName, "ui/mouse/mouse-%05d.png", i); + + cursor_frames[i] = Image_LoadImage(mouseFrameName); + } + + isMouseVisible = false; } WWMouseClass::~WWMouseClass() @@ -185,112 +196,20 @@ void WWMouseClass::Clear_Cursor_Clip(void) void WWMouseClass::Process_Mouse(void) { - POINT pt; // define a structure to hold current cursor pos - - // - // If the mouse is currently hidden or it has not been installed, then we - // have no need to redraw the mouse. - // - if (!Screen || !_Mouse || State > 0 || MouseUpdate || EraseFlags || !GameInFocus) - return; - - // - // Make sure there are no conflicts with other - // threads that may try and lock the screen buffer - // - //Block_Mouse(Screen->Get_Graphic_Buffer()); - - // - // If the screen is already locked by another thread then just exit - // - if (Screen->Get_LockCount()!=0){ - //Unblock_Mouse(Screen->Get_Graphic_Buffer()); - return; - } - - // - // Get the mouse's current real cursor position - // - GetCursorPos(&pt); // get the current cursor position - // - // If the mouse has moved then we are responsible to redraw the mouse - // - if (pt.x != MouseBuffX || pt.y != MouseBuffY) { - // - // If we can't lock the surface we need to draw to, we cannot update - // the mouse. - // - if (Screen->Lock()) { - // - // Erase the old mouse by dumping the mouses shadow buff - // to the screen (if its position had ever been recorded). - // - Low_Hide_Mouse(); - - // - // Verify that the mouse has not gone into a conditional hiden area - // If it has, mark it as being in one. - // - if (MCFlags & CONDHIDE && pt.x >= MouseCXLeft && pt.x <= MouseCXRight && pt.y >= MouseCYUpper && pt.y <= MouseCYLower) { - MCFlags |= CONDHIDDEN; - } - - // - // Show the mouse if we are allowed to. - // - if (!(MCFlags & CONDHIDDEN)) { - Low_Show_Mouse(pt.x, pt.y); - } - // - // Finally unlock the destination surface as we have sucessfully - // updated the mouse. - // - Screen->Unlock(); - } - } - - // - // Allow other threads to lock the screen again - // - //Unblock_Mouse(Screen->Get_Graphic_Buffer()); + } -void *WWMouseClass::Set_Cursor(int xhotspot, int yhotspot, void *cursor) +void *WWMouseClass::Set_Cursor(int xhotspot, int yhotspot, int cursor) { - // - // If the pointer to the cursor we got is invalid, or its the same as the - // currently set cursor then just return. - if (!cursor || cursor == PrevCursor) - return(cursor); + Set_Hotspot_X(xhotspot); + Set_Hotspot_Y(yhotspot); - // - // Wait until we have exclusive access to our data - // - MouseUpdate++; - // - // Since we are updating the mouse we need to hide the cursor so we - // do not get some sort of weird transformation. - // - Hide_Mouse(); - // - // Now convert the shape to a mouse cursor with the given hotspots and - // set it as our current mouse. - // - void *retval = Mouse_Set_Cursor(*this, xhotspot, yhotspot, cursor); - // - // Show the mouse which will force it to appear with the new shape we - // have assigned. - // - Show_Mouse(); - // - // We are done updating the mouse cursor so on to bigger and better things. - // - MouseUpdate--; - // - // Return the previous mouse cursor which as conveniantly passed back by - // Asm_Set_Mouse_Cursor. - // - return(retval); + if (cursor >= MAX_CURSOR_FRAMES) { + assert(!"Max_Cursor_Frames out of range!"); + } + + current_cursor = cursor_frames[cursor]; + return NULL; } void WWMouseClass::Low_Hide_Mouse() @@ -311,55 +230,39 @@ void WWMouseClass::Low_Hide_Mouse() void WWMouseClass::Hide_Mouse() { MouseUpdate++; - Low_Hide_Mouse(); + //Low_Hide_Mouse(); + isMouseVisible = false; MouseUpdate--; } +void WWMouseClass::RenderMouse(void) { + if (!isMouseVisible) + return; + + //ImVec2 size(current_cursor->width, current_cursor->height); + //ImGui::Image((ImTextureID)current_cursor->image, size); + int _my = mousey + (current_cursor->height * 0.25); + int xstart = mousex - Get_Hotspot_X(); + int ystart = _my - Get_Hotspot_Y(); + int yend = current_cursor->height + ystart - 1; + int xend = current_cursor->width + xstart - 1; + + ImVec2 mi(xstart, ystart); + ImVec2 ma(xend, yend); + + + ImGui::SetMouseCursor(ImGuiMouseCursor_None); + ImGui::GetForegroundDrawList()->AddImage((ImTextureID)current_cursor->image, mi, ma); +} void WWMouseClass::Low_Show_Mouse(int x, int y) { - extern bool Debug_Map; - if (Debug_Map) - return; - // - // If the mouse is completely visible then draw it at its current - // position. - // - { - // - // Try to lock the screen til we sucessfully get a lock. - // - if (Screen->Lock()){ - // - // Save off the area behind the mouse. - // - Mouse_Shadow_Buffer(*this, *Screen, MouseBuffer, x, y, MouseXHot, MouseYHot, 1); - // - // Draw the mouse in its new location - // - Mouse_Draw(*this, *Screen, x, y); - // - // Save off the positions that we saved the buffer from - // - MouseBuffX = x; - MouseBuffY = y; - // - // Unlock the screen and lets get moving. - // - Screen->Unlock(); - } - } } void WWMouseClass::Show_Mouse() { - //POINT pt; - //GetCursorPos(&pt); - // - //MouseUpdate++; - Low_Show_Mouse(mousex, mousey); - //MouseUpdate--; + isMouseVisible = true; } void WWMouseClass::Conditional_Hide_Mouse(int x1, int y1, int x2, int y2) @@ -664,7 +567,7 @@ int Get_Mouse_State(void) return(_Mouse->Get_Mouse_State()); } -void *Set_Mouse_Cursor(int hotx, int hoty, void *cursor) +void *Set_Mouse_Cursor(int hotx, int hoty, int cursor) { if (!_Mouse) return(0); return(_Mouse->Set_Cursor(hotx,hoty,cursor)); diff --git a/code/REDALERT/WINSTUB.CPP b/code/REDALERT/WINSTUB.CPP index b67ea07..8f92330 100644 --- a/code/REDALERT/WINSTUB.CPP +++ b/code/REDALERT/WINSTUB.CPP @@ -44,6 +44,8 @@ #include "imgui.h" #include "examples/imgui_impl_sdl.h" #include "function.h" +#include "il/il.h" +#include "image.h" #ifdef WINSOCK_IPX #include "WSProto.h" @@ -69,11 +71,56 @@ SDL_Window* game_window; SDL_GLContext game_context; int OverlappedVideoBlits = 0; +bool renderConsole = false; + void (*Misc_Focus_Loss_Function)(void) = nullptr; void (*Misc_Focus_Restore_Function)(void) = nullptr; void (*Imgui_Dialog_Function)(void) = nullptr; +Image_t* Image_LoadImage(const char* name) { + ILuint ImageName; + ilGenImages(1, &ImageName); + ilBindImage(ImageName); + if (!ilLoadImage(name)) { + return NULL; + } + + ILuint Width, Height, Bpp; + Width = ilGetInteger(IL_IMAGE_WIDTH); + Height = ilGetInteger(IL_IMAGE_HEIGHT); + Bpp = ilGetInteger(IL_IMAGE_BPP); + ILubyte* Data = ilGetData(); + + GLuint texture; + glGenTextures(1, &texture); + glBindTexture(GL_TEXTURE_2D, texture); + + if (Bpp == 4) { + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, Data); + } + else if (Bpp == 3) { + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, GL_RGB, GL_UNSIGNED_BYTE, Data); + } + else if (Bpp == 1) { + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, GL_R, GL_UNSIGNED_BYTE, Data); + } + else { + assert(!"Unknown BPP in image!"); + } + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + + ilDeleteImages(1, &ImageName); + + Image_t* image = new Image_t(); + image->image = texture; + image->width = Width; + image->height = Height; + return image; +} + BOOL Set_Video_Mode(HWND hwnd, int w, int h, int bits_per_pixel) { // Todo implement resoluton scaling. return true; // Always return true; @@ -91,15 +138,20 @@ void Reset_Video_Mode(void) { } -void Set_DD_Palette(void* palette) +void Set_DD_Palette(void* palette, bool raShift) { char* palette_get = (char*)palette; //CCPalette.Get_Data(); for (int j = 0; j < 768; j++) { - backbuffer_palette[j] = palette_get[j] << 2; + if (raShift) { + backbuffer_palette[j] = palette_get[j] << 2; + } + else { + backbuffer_palette[j] = palette_get[j]; + } } } -void Device_Present(void) { +void ImGui_NewFrame(void) { ImGuiIO& io = ImGui::GetIO(); glClearColor(0, 0, 0, 1); glClear(GL_COLOR_BUFFER_BIT); @@ -109,6 +161,10 @@ void Device_Present(void) { ImGui::NewFrame(); ImGui_ImplSDL2_NewFrame(game_window); +} + +void Device_Present(void) { + // Rasterize the palette. for (int i = 0; i < ScreenWidth * ScreenHeight; i++) { @@ -129,7 +185,7 @@ void Device_Present(void) { ImGui::SetNextWindowPos(ImVec2(0, 0)); ImGui::Begin("RenderWindow", &ScreenActive, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar); ImVec2 desktopSize(ScreenWidth, ScreenHeight); - ImGui::Image((ImTextureID)backbuffer_texture, desktopSize); + ImGui::Image((ImTextureID)backbuffer_texture, desktopSize); ImGui::End(); } @@ -137,10 +193,21 @@ void Device_Present(void) { Imgui_Dialog_Function(); } + if (renderConsole) { + Console_Render(); + } + + WWMouse->RenderMouse(); + ImGui::Render(); ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); SDL_GL_SwapWindow(game_window); + + // Last thing we do is execute any console commands + Console_Tick(); + + ImGui_NewFrame(); } @@ -450,34 +517,7 @@ HANDLE DebugFile = INVALID_HANDLE_VALUE; *=============================================================================================*/ void WWDebugString (char *string) { -#if (0) - char outstr[256]; - - sprintf (outstr, "%s", string); - - DWORD actual; - if (DebugFile == INVALID_HANDLE_VALUE){ - DebugFile = CreateFile("debug.txt", GENERIC_WRITE, 0, - NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - }else{ - DebugFile = CreateFile("debug.txt", GENERIC_WRITE, 0, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - } - - if (DebugFile != INVALID_HANDLE_VALUE){ - SetFilePointer (DebugFile, 0, NULL, FILE_END); - WriteFile(DebugFile, outstr, strlen(outstr)+1, &actual, NULL); - CloseHandle (DebugFile); - } - - OutputDebugString (string); -#else //(0) - - string = string; -// debugprint( string ); - -#endif //(0) - + Console_Printf(string); } @@ -512,6 +552,8 @@ void Create_Main_Window ( HANDLE instance , int command_show , int width , int h { HWND hwnd ; + ilInit(); + SDL_Init(SDL_INIT_VIDEO); game_window = SDL_CreateWindow(WINDOW_NAME, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL); game_context = SDL_GL_CreateContext(game_window); @@ -551,6 +593,24 @@ void Create_Main_Window ( HANDLE instance , int command_show , int width , int h glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glewInit(); + + IMGUI_CHECKVERSION(); + ImGui::CreateContext(); + ImGuiIO& io = ImGui::GetIO(); (void)io; + //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls + //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls + + // Setup Dear ImGui style + ImGui::StyleColorsDark(); + //ImGui::StyleColorsClassic(); + + // Setup Platform/Renderer bindings + ImGui_ImplSDL2_InitForD3D(game_window); + ImGui_ImplOpenGL3_Init(); + + io.Fonts->AddFontFromFileTTF("fonts/Roboto-Medium.ttf", 16.0f); + + ImGui_NewFrame(); } @@ -810,6 +870,20 @@ void WWSDL_ProcessEvents(KeyNumType& key, int& flags) { break; case SDL_KEYDOWN: + if (event.key.keysym.scancode == SDL_SCANCODE_GRAVE) { + renderConsole = !renderConsole; + + if (renderConsole) { + ShowCursor(TRUE); + Hide_Mouse(); + } + else { + ShowCursor(FALSE); + Show_Mouse(); + } + break; + } + const Uint8* state = SDL_GetKeyboardState(NULL); if (state[SDL_SCANCODE_RALT] || state[SDL_SCANCODE_LALT]) @@ -824,7 +898,7 @@ void WWSDL_ProcessEvents(KeyNumType& key, int& flags) { break; } - if (Debug_Map) + if (Debug_Map || renderConsole) { ImGui_ImplSDL2_ProcessEvent(&event); } diff --git a/code/TIBERIANDAWN/INIT.CPP b/code/TIBERIANDAWN/INIT.CPP index d927335..4f6ee3f 100644 --- a/code/TIBERIANDAWN/INIT.CPP +++ b/code/TIBERIANDAWN/INIT.CPP @@ -240,7 +240,7 @@ bool Init_Game(int , char *[]) if (MouseInstalled) { temp_mouse_shapes = MixFileClass::Retrieve("MOUSE.SHP"); if (temp_mouse_shapes) { - Set_Mouse_Cursor(0, 0, Extract_Shape(temp_mouse_shapes,0)); + Set_Mouse_Cursor(0, 0, 0); while (Get_Mouse_State() > 1) { Show_Mouse(); } diff --git a/code/TIBERIANDAWN/MOUSE.CPP b/code/TIBERIANDAWN/MOUSE.CPP index ee3eef7..29065bf 100644 --- a/code/TIBERIANDAWN/MOUSE.CPP +++ b/code/TIBERIANDAWN/MOUSE.CPP @@ -113,12 +113,12 @@ void MouseClass::Mouse_Small(bool wwsmall) if (wwsmall) { if (control->SmallFrame != -1) { - Set_Mouse_Cursor(control->X, control->Y, Extract_Shape(MouseShapes, control->SmallFrame + Frame/4)); + Set_Mouse_Cursor(control->X, control->Y, control->SmallFrame + Frame / 4); } else { - Set_Mouse_Cursor(MouseControl[MOUSE_NORMAL].X, MouseControl[MOUSE_NORMAL].Y, Extract_Shape(MouseShapes, MOUSE_NORMAL)); + Set_Mouse_Cursor(MouseControl[MOUSE_NORMAL].X, MouseControl[MOUSE_NORMAL].Y, MOUSE_NORMAL); } } else { - Set_Mouse_Cursor(control->X, control->Y, Extract_Shape(MouseShapes, control->StartFrame + Frame/4)); + Set_Mouse_Cursor(control->X, control->Y, control->StartFrame + Frame / 4); } } @@ -174,7 +174,7 @@ bool MouseClass::Override_Mouse_Shape(MouseType mouse, bool wwsmall) #endif baseshp = (wwsmall) ? control->SmallFrame : control->StartFrame; - Set_Mouse_Cursor(control->X, control->Y, Extract_Shape(MouseShapes, baseshp + Frame/4)); + Set_Mouse_Cursor(control->X, control->Y, baseshp + Frame / 4); CurrentMouseShape = mouse; IsSmall = wwsmall; return(true); @@ -222,10 +222,7 @@ void MouseClass::AI(KeyNumType &input, int x, int y) if (!IsSmall || control->SmallFrame != -1) { int baseframe = (IsSmall) ? control->SmallFrame : control->StartFrame; - mouse_shape_ptr = Extract_Shape(MouseShapes, baseframe + Frame); - if (mouse_shape_ptr){ - Set_Mouse_Cursor(control->X, control->Y, mouse_shape_ptr); - } + Set_Mouse_Cursor(control->X, control->Y, baseframe + Frame); } } diff --git a/code/external/devil/DevIL.lib b/code/external/devil/DevIL.lib new file mode 100644 index 0000000..cb7de1e Binary files /dev/null and b/code/external/devil/DevIL.lib differ diff --git a/code/external/devil/IL/DevIL.i b/code/external/devil/IL/DevIL.i new file mode 100644 index 0000000..820449d --- /dev/null +++ b/code/external/devil/IL/DevIL.i @@ -0,0 +1,13 @@ +%module DevIL +%{ +#include "il.h" +#include "ilu.h" +#include "ilut.h" +//#include "ilu_region.h" +%} + +%include "il.h" +%include "ilu.h" +%include "ilut.h" +//%include "ilu_region.h" + diff --git a/code/external/devil/IL/build-lua b/code/external/devil/IL/build-lua new file mode 100644 index 0000000..ed45659 --- /dev/null +++ b/code/external/devil/IL/build-lua @@ -0,0 +1,51 @@ +IL_INCLUDE_PATH="/usr/include" +IL_LIB_PATH="/usr/lib" +LUA_INCLUDE_PATH="/usr/include/lua5.1" +LUA_LIB_PATH="/usr/lib" +OSX=no + +echo "Building the lua binding!" + +export SWIG_FEATURES="-I$IL_INCLUDE_PATH" +swig -lua DevIL.i +if [ $? -ne 0 ] ; then + echo "swig Failed to build the lua interface" + exit 1 +fi + +compile() { + gcc luadevil.c "$1" -o luadevil "-L$LUA_LIB_PATH" "-I$LUA_INCLUDE_PATH" "-I$IL_LIB_PATH" -lIL -lILU -lILUT -llua5.1 &>/dev/null + err=$? + if [ "$OSX" = "no" ] ; then + gcc -shared "$1" -o DevIL.so "-L$LUA_LIB_PATH" "-I$LUA_INCLUDE_PATH" "-I$IL_LIB_PATH" -lIL -lILU -lILUT &>/dev/null + else + gcc -bundle -undefined dynamic_lookup "$1" -o DevIL.so "-L$LUA_LIB_PATH" "-I$LUA_INCLUDE_PATH" "-I$IL_LIB_PATH" -lIL -lILU -lILUT &>/dev/null + fi + return $err +} + +compile DevIL_wrap.c +if [ $? -ne 0 ] ; then + echo 'Failed compilation' + echo 'On some platform the file malloc.h is not present and produces a compilation error' + echo -n 'it can be removed safely, try [y/n] ? ' + while read i ; do + if [ "$i" = "y" ] ; then + sed 's/\#include\ \//' < DevIL_wrap.c > DevIL_wrap.mod.c + compile "DevIL_wrap.mod.c" + if [ $? -ne 0 ] ; then + echo 'still failing...' + exit 2 + fi + exit 0 + elif [ "$i" = "n" ] ; then + echo 'ok, failing...' + exit 3 + else + echo 'Unknown command [y/n] ? ' + fi + done +fi + +echo "ok!" +exit 0 diff --git a/code/external/devil/IL/build-python b/code/external/devil/IL/build-python new file mode 100644 index 0000000..bb16b6f --- /dev/null +++ b/code/external/devil/IL/build-python @@ -0,0 +1,17 @@ +#! /bin/bash + +IL_INCLUDE_PATH="/usr/local/include" +IL_LIB_PATH="/usr/local/lib" +PYTHON_INCLUDE_PATH="/usr/include/python2.5" + +swig "-I$IL_INCLUDE_PATH" -python -interface DevIL DevIL.i +if [ $? -ne 0 ] ; then + echo Error while building the swig interface + exit 1 +fi + +gcc -shared "-I$IL_INCLUDE_PATH" "-I$PYTHON_INCLUDE_PATH" "-L$IL_LIB_PATH" -lIL -lILU -lILUT DevIL_wrap.c -o DevIL.so +if [ $? -ne 0 ] ; then + echo Error while compiling the python module +fi +echo "DevIL.py and DevIL.so are ready" diff --git a/code/external/devil/IL/config.h.win b/code/external/devil/IL/config.h.win new file mode 100644 index 0000000..659f4ca --- /dev/null +++ b/code/external/devil/IL/config.h.win @@ -0,0 +1,79 @@ +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +#define IL_USE_PRAGMA_LIBS // Links to only the libraries that are requested. +#define IL_INLINE_ASM 1 // Define if you can support at least some ASM + +// Supported images formats (IL) + +// #define IL_NO_BLP +// #define IL_NO_BMP +// #define IL_NO_CUT +// #define IL_NO_CHEAD +// #define IL_NO_DCX +// #define IL_NO_DDS +// #define IL_NO_DICOM +// #define IL_NO_DOOM +// #define IL_NO_EXR +// #define IL_NO_FITS +// #define IL_NO_FTX +// #define IL_NO_GIF +// #define IL_NO_HDR +// #define IL_NO_ICO +// #define IL_NO_ICNS +// #define IL_NO_IWI +// #define IL_NO_JP2 +// #define IL_NO_JPG +// #define IL_NO_LCMS +// #define IL_NO_LIF +// #define IL_NO_MDL +// #define IL_NO_MNG +// #define IL_NO_PCD +// #define IL_NO_PCX +// #define IL_NO_PIC +// #define IL_NO_PIX +// #define IL_NO_PNG +// #define IL_NO_PNM +// #define IL_NO_PSD +// #define IL_NO_PSP +// #define IL_NO_PXR +// #define IL_NO_RAW +// #define IL_NO_ROT +// #define IL_NO_SGI +// #define IL_NO_SUN +// #define IL_NO_TGA +// #define IL_NO_TIF +// #define IL_NO_TPL +// #define IL_NO_WAL +// #define IL_NO_WDP +// #define IL_NO_XPM + +#define IL_USE_JPEGLIB_UNMODIFIED 1 +#define IL_USE_DXTC_NVIDIA +#define IL_USE_DXTC_SQUISH + +//#define IL_NO_GAMES + +/* Supported api (ilut) */ + + +// +// sorry just +// cant get this one to work under windows +// have disabled for the now +// +// will look at it some more later +// +// Kriss +// +#undef ILUT_USE_ALLEGRO + +#undef ILUT_USE_DIRECTX8 +#define ILUT_USE_DIRECTX9 +#define ILUT_USE_DIRECTX10 +#define ILUT_USE_OPENGL +#define ILUT_USE_SDL +#define ILUT_USE_WIN32 + + +#endif /* __CONFIG_H__ */ diff --git a/code/external/devil/IL/devil_cpp_wrapper.hpp b/code/external/devil/IL/devil_cpp_wrapper.hpp new file mode 100644 index 0000000..95c7f77 --- /dev/null +++ b/code/external/devil/IL/devil_cpp_wrapper.hpp @@ -0,0 +1,952 @@ +#ifndef DEVIL_CPP_WRAPPER_HPP +#define DEVIL_CPP_WRAPPER_HPP + +#include // Probably only have to #include this one + +class ilImage +{ +public: + ilImage(); + ilImage(ILconst_string); + ilImage(const ilImage &); + virtual ~ilImage(); + + ILboolean Load(ILconst_string); + ILboolean Load(ILconst_string, ILenum); + ILboolean Save(ILconst_string); + ILboolean Save(ILconst_string, ILenum); + + // ImageLib functions + ILboolean ActiveImage(ILuint); + ILboolean ActiveLayer(ILuint); + ILboolean ActiveMipmap(ILuint); + ILboolean Clear(void); + void ClearColour(ILclampf, ILclampf, ILclampf, ILclampf); + ILboolean Convert(ILenum); + ILboolean Copy(ILuint); + ILboolean Default(void); + ILboolean Flip(void); + ILboolean SwapColours(void); + ILboolean Resize(ILuint, ILuint, ILuint); + ILboolean TexImage(ILuint, ILuint, ILuint, ILubyte, ILenum, ILenum, void*); + + // Image handling + void Bind(void) const; + void Bind(ILuint); + void Close(void) { this->Delete(); } + void Delete(void); + void iGenBind(); + ILenum PaletteAlphaIndex(); + + // Image characteristics + ILuint Width(void); + ILuint Height(void); + ILuint Depth(void); + ILubyte Bpp(void); + ILubyte Bitpp(void); + ILenum PaletteType(void); + ILenum Format(void); + ILenum Type(void); + ILuint NumImages(void); + ILuint NumMipmaps(void); + ILuint GetId(void) const; + ILenum GetOrigin(void); + ILubyte *GetData(void); + ILubyte *GetPalette(void); + + // Rendering + ILuint BindImage(void); + ILuint BindImage(ILenum); + + // Operators + ilImage& operator = (ILuint); + ilImage& operator = (const ilImage &); + +protected: + ILuint Id; + +private: + static int ilStartUp(); + static ILboolean ilStartedUp; +}; + +// ensure that init is called exactly once +int ilImage::ilStartUp() +{ + ilInit(); + iluInit(); + //ilutInit(); + return true; +} +ILboolean ilImage::ilStartedUp = ilStartUp(); + +class ilFilters +{ +public: + static ILboolean Alienify(ilImage &); + static ILboolean BlurAvg(ilImage &, ILuint Iter); + static ILboolean BlurGaussian(ilImage &, ILuint Iter); + static ILboolean Contrast(ilImage &, ILfloat Contrast); + static ILboolean EdgeDetectE(ilImage &); + static ILboolean EdgeDetectP(ilImage &); + static ILboolean EdgeDetectS(ilImage &); + static ILboolean Emboss(ilImage &); + static ILboolean Gamma(ilImage &, ILfloat Gamma); + static ILboolean Negative(ilImage &); + static ILboolean Noisify(ilImage &, ILubyte Factor); + static ILboolean Pixelize(ilImage &, ILuint PixSize); + static ILboolean Saturate(ilImage &, ILfloat Saturation); + static ILboolean Saturate(ilImage &, ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation); + static ILboolean ScaleColours(ilImage &, ILfloat r, ILfloat g, ILfloat b); + static ILboolean Sharpen(ilImage &, ILfloat Factor, ILuint Iter); +}; + +#ifdef ILUT_USE_OPENGL +class ilOgl +{ +public: + static void Init(void); + static GLuint BindTex(ilImage &); + static ILboolean Upload(ilImage &, ILuint); + static GLuint Mipmap(ilImage &); + static ILboolean Screen(void); + static ILboolean Screenie(void); +}; +#endif//ILUT_USE_OPENGL + + +#ifdef ILUT_USE_ALLEGRO +class ilAlleg +{ +public: + static void Init(void); + static BITMAP *Convert(ilImage &); +}; +#endif//ILUT_USE_ALLEGRO + + +#ifdef ILUT_USE_WIN32 +class ilWin32 +{ +public: + static void Init(void); + static HBITMAP Convert(ilImage &); + static ILboolean GetClipboard(ilImage &); + static void GetInfo(ilImage &, BITMAPINFO *Info); + static ILubyte *GetPadData(ilImage &); + static HPALETTE GetPal(ilImage &); + static ILboolean GetResource(ilImage &, HINSTANCE hInst, ILint ID, char *ResourceType); + static ILboolean GetResource(ilImage &, HINSTANCE hInst, ILint ID, char *ResourceType, ILenum Type); + static ILboolean SetClipboard(ilImage &); +}; +#endif//ILUT_USE_WIN32 + + +class ilValidate +{ +public: + static ILboolean Valid(ILenum, ILconst_string); + static ILboolean Valid(ILenum, FILE *); + static ILboolean Valid(ILenum, void *, ILuint); + +protected: + +private: + +}; + +class ilState +{ +public: + static ILboolean Disable(ILenum); + static ILboolean Enable(ILenum); + static void Get(ILenum, ILboolean &); + static void Get(ILenum, ILint &); + static ILboolean GetBool(ILenum); + static ILint GetInt(ILenum); + static const char *GetString(ILenum); + static ILboolean IsDisabled(ILenum); + static ILboolean IsEnabled(ILenum); + static ILboolean Origin(ILenum); + static void Pop(void); + static void Push(ILuint); + +protected: + +private: + +}; + + +class ilError +{ +public: + static void Check(void (*Callback)(const char*)); + static void Check(void (*Callback)(ILenum)); + static ILenum Get(void); + static const char *String(void); + static const char *String(ILenum); + +protected: + +private: + +}; + + +// +// ILIMAGE +// +ilImage::ilImage() +{ + this->Id = 0; + //this->iStartUp(); // This was commented out, but it needs to be somewhere... + this->iGenBind(); + return; +} + + +ilImage::ilImage(ILconst_string FileName) +{ + this->Id = 0; + //this->iStartUp(); // This was commented out, but it needs to be somewhere... + this->iGenBind(); + ilLoadImage(FileName); + return; +} + + +ilImage::ilImage(const ilImage &Image) +{ + this->Id = 0; + // this->iStartUp(); + this->iGenBind(); + *this = Image; + return; +} + + +ilImage::~ilImage() +{ + if (this->Id) + ilDeleteImages(1, &this->Id); + this->Id = 0; + return; +} + + +ILboolean ilImage::Load(ILconst_string FileName) +{ + this->iGenBind(); + return ilLoadImage(FileName); +} + + +ILboolean ilImage::Load(ILconst_string FileName, ILenum Type) +{ + this->iGenBind(); + return ilLoad(Type, FileName); +} + + +ILboolean ilImage::Save(ILconst_string FileName) +{ + this->iGenBind(); + return ilSaveImage(FileName); +} + + +ILboolean ilImage::Save(ILconst_string FileName, ILenum Type) +{ + this->iGenBind(); + return ilSave(Type, FileName); +} + + + +// +// ImageLib functions +// +ILboolean ilImage::ActiveImage(ILuint Number) +{ + if (this->Id) { + this->Bind(); + return ilActiveImage(Number); + } + return IL_FALSE; +} + + +ILboolean ilImage::ActiveLayer(ILuint Number) +{ + if (this->Id) { + this->Bind(); + return ilActiveLayer(Number); + } + return IL_FALSE; +} + + +ILboolean ilImage::ActiveMipmap(ILuint Number) +{ + if (this->Id) { + this->Bind(); + return ilActiveMipmap(Number); + } + return IL_FALSE; +} + + +ILboolean ilImage::Clear() +{ + if (this->Id) { + this->Bind(); + return ilClearImage(); + } + return IL_FALSE; +} + + +void ilImage::ClearColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha) +{ + ilClearColour(Red, Green, Blue, Alpha); + return; +} + + +ILboolean ilImage::Convert(ILenum NewFormat) +{ + if (this->Id) { + this->Bind(); + return ilConvertImage(NewFormat, IL_UNSIGNED_BYTE); + } + return IL_FALSE; +} + + +ILboolean ilImage::Copy(ILuint Src) +{ + if (this->Id) { + this->Bind(); + return ilCopyImage(Src); + } + return IL_FALSE; +} + + +ILboolean ilImage::Default() +{ + if (this->Id) { + this->Bind(); + return ilDefaultImage(); + } + return IL_FALSE; +} + + +ILboolean ilImage::Flip() +{ + if (this->Id) { + this->Bind(); + return iluFlipImage(); + } + return IL_FALSE; +} + + +ILboolean ilImage::SwapColours() +{ + if (this->Id) { + this->Bind(); + return iluSwapColours(); + } + return IL_FALSE; +} + + +ILboolean ilImage::Resize(ILuint Width, ILuint Height, ILuint Depth) +{ + if (this->Id) { + this->Bind(); + return iluScale(Width, Height, Depth); + } + return IL_FALSE; +} + + +ILboolean ilImage::TexImage(ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data) +{ + if (this->Id) { + this->Bind(); + return ilTexImage(Width, Height, Depth, Bpp, Format, Type, Data); + } + return IL_FALSE; +} + + + +// +// Image handling +// +void ilImage::Bind() const +{ + if (this->Id) + ilBindImage(this->Id); + return; +} + +// Note: Behaviour may be changed! +void ilImage::Bind(ILuint Image) +{ + if (this->Id == Image) + return; + this->Delete(); // Should we delete it? + this->Id = Image; + ilBindImage(this->Id); + return; +} + + +void ilImage::Delete() +{ + if (this->Id == 0) + return; + ilDeleteImages(1, &this->Id); + this->Id = 0; + return; +} + + + + +// +// Image characteristics +// +ILuint ilImage::Width() +{ + if (this->Id) { + this->Bind(); + return ilGetInteger(IL_IMAGE_WIDTH); + } + return 0; +} + + +ILuint ilImage::Height() +{ + if (this->Id) { + this->Bind(); + return ilGetInteger(IL_IMAGE_HEIGHT); + } + return 0; +} + +ILuint ilImage::Depth() +{ + if (this->Id) { + this->Bind(); + return ilGetInteger(IL_IMAGE_DEPTH); + } + return 0; +} + +ILubyte ilImage::Bpp() +{ + if (this->Id) { + this->Bind(); + return ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL); + } + return 0; +} + +ILubyte ilImage::Bitpp() +{ + if (this->Id) { + this->Bind(); + return ilGetInteger(IL_IMAGE_BITS_PER_PIXEL); + } + return 0; +} + +ILenum ilImage::Format() +{ + if (this->Id) { + this->Bind(); + return ilGetInteger(IL_IMAGE_FORMAT); + } + return 0; +} + +ILenum ilImage::PaletteType() +{ + if (this->Id) { + this->Bind(); + return ilGetInteger(IL_PALETTE_TYPE); + } + return 0; +} + +ILenum ilImage::PaletteAlphaIndex() +{ + if (this->Id) { + this->Bind(); + return ilGetInteger(IL_PNG_ALPHA_INDEX); + } + return 0; +} + +ILenum ilImage::Type() +{ + if (this->Id) { + this->Bind(); + return ilGetInteger(IL_IMAGE_TYPE); + } + return 0; +} + +ILenum ilImage::NumImages() +{ + if (this->Id) { + this->Bind(); + return ilGetInteger(IL_NUM_IMAGES); + } + return 0; +} + +ILenum ilImage::NumMipmaps() +{ + if (this->Id) { + this->Bind(); + return ilGetInteger(IL_NUM_MIPMAPS); + } + return 0; +} + +ILuint ilImage::GetId() const +{ + return this->Id; +} + +ILenum ilImage::GetOrigin(void) +{ + ILinfo Info; + + if (this->Id) { + this->Bind(); + iluGetImageInfo(&Info); + return Info.Origin; + } + return 0; +} + +ILubyte* ilImage::GetData() +{ + if (this->Id) { + this->Bind(); + return ilGetData(); + } + return 0; +} + +ILubyte* ilImage::GetPalette() +{ + if (this->Id) { + this->Bind(); + return ilGetPalette(); + } + return 0; +} + +// +// Private members +// +/*void ilImage::iStartUp() +{ + ilInit(); + iluInit(); + ilutInit(); + return; +}*/ + +void ilImage::iGenBind() +{ + if (this->Id == 0) { + ilGenImages(1, &this->Id); + } + ilBindImage(this->Id); + return; +} + +// +// Operators +// +ilImage& ilImage::operator = (ILuint Image) +{ + if (this->Id == 0) + this->Id = Image; + else { + this->Bind(); + ilCopyImage(Image); + } + + return *this; +} + +ilImage& ilImage::operator = (const ilImage &Image) +{ + if (Id == 0) + Id = Image.GetId(); + else { + Bind(); + ilCopyImage(Image.GetId()); + } + + return *this; +} + +// +// ILFILTERS +// +ILboolean ilFilters::Alienify(ilImage &Image) +{ + Image.Bind(); + return iluAlienify(); +} + +ILboolean ilFilters::BlurAvg(ilImage &Image, ILuint Iter) +{ + Image.Bind(); + return iluBlurAvg(Iter); +} + +ILboolean ilFilters::BlurGaussian(ilImage &Image, ILuint Iter) +{ + Image.Bind(); + return iluBlurGaussian(Iter); +} + +ILboolean ilFilters::Contrast(ilImage &Image, ILfloat Contrast) +{ + Image.Bind(); + return iluContrast(Contrast); +} + +ILboolean ilFilters::EdgeDetectE(ilImage &Image) +{ + Image.Bind(); + return iluEdgeDetectP(); +} + +ILboolean ilFilters::EdgeDetectP(ilImage &Image) +{ + Image.Bind(); + return iluEdgeDetectP(); +} + +ILboolean ilFilters::EdgeDetectS(ilImage &Image) +{ + Image.Bind(); + return iluEdgeDetectS(); +} + +ILboolean ilFilters::Emboss(ilImage &Image) +{ + Image.Bind(); + return iluEmboss(); +} + +ILboolean ilFilters::Gamma(ilImage &Image, ILfloat Gamma) +{ + Image.Bind(); + return iluGammaCorrect(Gamma); +} + +ILboolean ilFilters::Negative(ilImage &Image) +{ + Image.Bind(); + return iluNegative(); +} + +ILboolean ilFilters::Noisify(ilImage &Image, ILubyte Factor) +{ + Image.Bind(); + return iluNoisify(Factor); +} + +ILboolean ilFilters::Pixelize(ilImage &Image, ILuint PixSize) +{ + Image.Bind(); + return iluPixelize(PixSize); +} + +ILboolean ilFilters::Saturate(ilImage &Image, ILfloat Saturation) +{ + Image.Bind(); + return iluSaturate1f(Saturation); +} + +ILboolean ilFilters::Saturate(ilImage &Image, ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation) +{ + Image.Bind(); + return iluSaturate4f(r, g, b, Saturation); +} + +ILboolean ilFilters::ScaleColours(ilImage &Image, ILfloat r, ILfloat g, ILfloat b) +{ + Image.Bind(); + return iluScaleColours(r, g, b); +} + + +ILboolean ilFilters::Sharpen(ilImage &Image, ILfloat Factor, ILuint Iter) +{ + Image.Bind(); + return iluSharpen(Factor, Iter); +} + + +// +// ILOPENGL +// +#ifdef ILUT_USE_OPENGL +void ilOgl::Init() +{ + ilutRenderer(ILUT_OPENGL); + return; +} + + +GLuint ilOgl::BindTex(ilImage &Image) +{ + Image.Bind(); + return ilutGLBindTexImage(); +} + +ILboolean ilOgl::Upload(ilImage &Image, ILuint Level) +{ + Image.Bind(); + return ilutGLTexImage(Level); +} + + +GLuint ilOgl::Mipmap(ilImage &Image) +{ + Image.Bind(); + return ilutGLBuildMipmaps(); +} + +ILboolean ilOgl::Screen() +{ + return ilutGLScreen(); +} + + +ILboolean ilOgl::Screenie() +{ + return ilutGLScreenie(); +} +#endif//ILUT_USE_OPENGL + +// +// ILALLEGRO +// +#ifdef ILUT_USE_ALLEGRO +void ilAlleg::Init() +{ + ilutRenderer(IL_ALLEGRO); + return; +} + +BITMAP *ilAlleg::Convert(ilImage &Image, PALETTE Pal) +{ + Image.Bind(); + return ilutConvertToAlleg(Pal); +} +#endif//ILUT_USE_ALLEGRO + +// +// ILWIN32 +// +#ifdef ILUT_USE_WIN32 +void ilWin32::Init() +{ + ilutRenderer(ILUT_WIN32); + return; +} + +HBITMAP ilWin32::Convert(ilImage &Image) +{ + Image.Bind(); + return ilutConvertToHBitmap(GetDC(NULL)); +} + +ILboolean ilWin32::GetClipboard(ilImage &Image) +{ + Image.Bind(); + return ilutGetWinClipboard(); +} + +void ilWin32::GetInfo(ilImage &Image, BITMAPINFO *Info) +{ + Image.Bind(); + ilutGetBmpInfo(Info); + return; +} + +ILubyte* ilWin32::GetPadData(ilImage &Image) +{ + Image.Bind(); + return ilutGetPaddedData(); +} + +HPALETTE ilWin32::GetPal(ilImage &Image) +{ + Image.Bind(); + return ilutGetHPal(); +} + +ILboolean ilWin32::GetResource(ilImage &Image, HINSTANCE hInst, ILint ID, char *ResourceType) +{ + Image.Bind(); + return ilutLoadResource(hInst, ID, ResourceType, IL_TYPE_UNKNOWN); +} + +ILboolean ilWin32::GetResource(ilImage &Image, HINSTANCE hInst, ILint ID, char *ResourceType, ILenum Type) +{ + Image.Bind(); + return ilutLoadResource(hInst, ID, ResourceType, Type); +} + +ILboolean ilWin32::SetClipboard(ilImage &Image) +{ + Image.Bind(); + return ilutSetWinClipboard(); +} +#endif//ILUT_USE_WIN32 + +// +// ILVALIDATE +// +ILboolean ilValidate::Valid(ILenum Type, ILconst_string FileName) +{ + return ilIsValid(Type, FileName); +} + +ILboolean ilValidate::Valid(ILenum Type, FILE *File) +{ + return ilIsValidF(Type, File); +} + +ILboolean ilValidate::Valid(ILenum Type, void *Lump, ILuint Size) +{ + return ilIsValidL(Type, Lump, Size); +} + +// +// ILSTATE +// +ILboolean ilState::Disable(ILenum State) +{ + return ilDisable(State); +} + +ILboolean ilState::Enable(ILenum State) +{ + return ilEnable(State); +} + +void ilState::Get(ILenum Mode, ILboolean &Param) +{ + ilGetBooleanv(Mode, &Param); + return; +} + +void ilState::Get(ILenum Mode, ILint &Param) +{ + ilGetIntegerv(Mode, &Param); + return; +} + +ILboolean ilState::GetBool(ILenum Mode) +{ + return ilGetBoolean(Mode); +} + +ILint ilState::GetInt(ILenum Mode) +{ + return ilGetInteger(Mode); +} + +const char *ilState::GetString(ILenum StringName) +{ + return ilGetString(StringName); +} + +ILboolean ilState::IsDisabled(ILenum Mode) +{ + return ilIsDisabled(Mode); +} + +ILboolean ilState::IsEnabled(ILenum Mode) +{ + return ilIsEnabled(Mode); +} + +ILboolean ilState::Origin(ILenum Mode) +{ + return ilOriginFunc(Mode); +} + +void ilState::Pop() +{ + ilPopAttrib(); + return; +} + +void ilState::Push(ILuint Bits = IL_ALL_ATTRIB_BITS) +{ + ilPushAttrib(Bits); + return; +} + +// +// ILERROR +// +void ilError::Check(void (*Callback)(const char*)) +{ + static ILenum Error; + + while ((Error = ilGetError()) != IL_NO_ERROR) { + Callback(iluErrorString(Error)); + } + + return; +} + +void ilError::Check(void (*Callback)(ILenum)) +{ + static ILenum Error; + + while ((Error = ilGetError()) != IL_NO_ERROR) { + Callback(Error); + } + + return; +} + +ILenum ilError::Get() +{ + return ilGetError(); +} + +const char *ilError::String() +{ + return iluErrorString(ilGetError()); +} + +const char *ilError::String(ILenum Error) +{ + return iluErrorString(Error); +} + +#endif// DEVIL_CPP_WRAPPER_HPP diff --git a/code/external/devil/IL/devil_internal_exports.h b/code/external/devil/IL/devil_internal_exports.h new file mode 100644 index 0000000..fd07d06 --- /dev/null +++ b/code/external/devil/IL/devil_internal_exports.h @@ -0,0 +1,159 @@ +//----------------------------------------------------------------------------- +// +// ImageLib Sources +// Copyright (C) 2000-2017 by Denton Woods +// Last modified: 01/06/2009 +// +// Filename: IL/devil_internal_exports.h +// +// Description: Internal stuff for DevIL (IL, ILU and ILUT) +// +//----------------------------------------------------------------------------- + +#ifndef IL_EXPORTS_H +#define IL_EXPORTS_H + +#include "IL/il.h" + +#ifdef DEBUG + #include +#else + #define assert(x) +#endif + + +#ifdef NOINLINE + // No inlining. Treat all inline funcs as static. + // Functions will be replicated in all translation units + // use them. + #define STATIC_INLINE static +#else + #if defined(_MSC_VER) && !defined(__cplusplus) + // MSVC compiler uses __inline when compiling C (not C++) + #define STATIC_INLINE static __inline + #else + // Portable across C99, GNU89, C++... + #define STATIC_INLINE static inline + #endif +#endif // NOINLINE + + +#ifdef __cplusplus +extern "C" { +#endif + +#define IL_MAX(a,b) (((a) > (b)) ? (a) : (b)) +#define IL_MIN(a,b) (((a) < (b)) ? (a) : (b)) + + +//! Basic Palette struct +typedef struct ILpal +{ + ILubyte* Palette; //!< the image palette (if any) + ILuint PalSize; //!< size of the palette (in bytes) + ILenum PalType; //!< the palette types in il.h (0x0500 range) +} ILpal; + + +//! The Fundamental Image structure +/*! Every bit of information about an image is stored in this internal structure.*/ +typedef struct ILimage +{ + ILuint Width; //!< the image's width + ILuint Height; //!< the image's height + ILuint Depth; //!< the image's depth + ILubyte Bpp; //!< bytes per pixel (now number of channels) + ILubyte Bpc; //!< bytes per channel + ILuint Bps; //!< bytes per scanline (components for IL) + ILubyte* Data; //!< the image data + ILuint SizeOfData; //!< the total size of the data (in bytes) + ILuint SizeOfPlane; //!< SizeOfData in a 2d image, size of each plane slice in a 3d image (in bytes) + ILenum Format; //!< image format (in IL enum style) + ILenum Type; //!< image type (in IL enum style) + ILenum Origin; //!< origin of the image + ILpal Pal; //!< palette details + ILuint Duration; //!< length of the time to display this "frame" + ILenum CubeFlags; //!< cube map flags for sides present in chain + struct ILimage* Mipmaps; //!< mipmapped versions of this image terminated by a NULL - usu. NULL + struct ILimage* Next; //!< next image in the chain - usu. NULL + struct ILimage* Faces; //!< next cubemap face in the chain - usu. NULL + struct ILimage* Layers; //!< subsequent layers in the chain - usu. NULL + ILuint* AnimList; //!< animation list + ILuint AnimSize; //!< animation list size + void* Profile; //!< colour profile + ILuint ProfileSize; //!< colour profile size + ILuint OffX; //!< x-offset of the image + ILuint OffY; //!< y-offset of the image + ILubyte* DxtcData; //!< compressed data + ILenum DxtcFormat; //!< compressed data format + ILuint DxtcSize; //!< compressed data size +} ILimage; + + +// Memory functions +ILAPI void* ILAPIENTRY ialloc(const ILsizei Size); +ILAPI void ILAPIENTRY ifree(const void *Ptr); +ILAPI void* ILAPIENTRY icalloc(const ILsizei Size, const ILsizei Num); +#ifdef ALTIVEC_GCC +ILAPI void* ILAPIENTRY ivec_align_buffer(void *buffer, const ILuint size); +#endif + +// Internal library functions in IL +ILAPI ILimage* ILAPIENTRY ilGetCurImage(void); +ILAPI void ILAPIENTRY ilSetCurImage(ILimage *Image); +ILAPI void ILAPIENTRY ilSetError(ILenum Error); +ILAPI void ILAPIENTRY ilSetPal(ILpal *Pal); + +// +// Utility functions +// +ILAPI ILubyte ILAPIENTRY ilGetBppFormat(ILenum Format); +ILAPI ILenum ILAPIENTRY ilGetFormatBpp(ILubyte Bpp); +ILAPI ILubyte ILAPIENTRY ilGetBpcType(ILenum Type); +ILAPI ILenum ILAPIENTRY ilGetTypeBpc(ILubyte Bpc); +ILAPI ILubyte ILAPIENTRY ilGetBppPal(ILenum PalType); +ILAPI ILenum ILAPIENTRY ilGetPalBaseType(ILenum PalType); +ILAPI ILuint ILAPIENTRY ilNextPower2(ILuint Num); +ILAPI ILenum ILAPIENTRY ilTypeFromExt(ILconst_string FileName); +ILAPI void ILAPIENTRY ilReplaceCurImage(ILimage *Image); +ILAPI void ILAPIENTRY iMemSwap(ILubyte *, ILubyte *, const ILuint); + +// +// Image functions +// +ILAPI void ILAPIENTRY iBindImageTemp (void); +ILAPI ILboolean ILAPIENTRY ilClearImage_ (ILimage *Image); +ILAPI void ILAPIENTRY ilCloseImage (ILimage *Image); +ILAPI void ILAPIENTRY ilClosePal (ILpal *Palette); +ILAPI ILpal* ILAPIENTRY iCopyPal (void); +ILAPI ILboolean ILAPIENTRY ilCopyImageAttr (ILimage *Dest, ILimage *Src); +ILAPI ILimage* ILAPIENTRY ilCopyImage_ (ILimage *Src); +ILAPI void ILAPIENTRY ilGetClear (void *Colours, ILenum Format, ILenum Type); +ILAPI ILuint ILAPIENTRY ilGetCurName (void); +ILAPI ILboolean ILAPIENTRY ilIsValidPal (ILpal *Palette); +ILAPI ILimage* ILAPIENTRY ilNewImage (ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILubyte Bpc); +ILAPI ILimage* ILAPIENTRY ilNewImageFull (ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data); +ILAPI ILboolean ILAPIENTRY ilInitImage (ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data); +ILAPI ILboolean ILAPIENTRY ilResizeImage (ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILubyte Bpc); +ILAPI ILboolean ILAPIENTRY ilTexImage_ (ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data); +ILAPI ILboolean ILAPIENTRY ilTexImageSurface_(ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data); +ILAPI ILboolean ILAPIENTRY ilTexSubImage_ (ILimage *Image, void *Data); +ILAPI void* ILAPIENTRY ilConvertBuffer (ILuint SizeOfData, ILenum SrcFormat, ILenum DestFormat, ILenum SrcType, ILenum DestType, ILpal *SrcPal, void *Buffer); +ILAPI ILimage* ILAPIENTRY iConvertImage (ILimage *Image, ILenum DestFormat, ILenum DestType); +ILAPI ILpal* ILAPIENTRY iConvertPal (ILpal *Pal, ILenum DestFormat); +ILAPI ILubyte* ILAPIENTRY iGetFlipped (ILimage *Image); +ILAPI ILboolean ILAPIENTRY iMirror(); +ILAPI void ILAPIENTRY iFlipBuffer(ILubyte *buff, ILuint depth, ILuint line_size, ILuint line_num); +ILubyte* iFlipNewBuffer(ILubyte *buff, ILuint depth, ILuint line_size, ILuint line_num); +ILAPI void ILAPIENTRY iGetIntegervImage(ILimage *Image, ILenum Mode, ILint *Param); + +// Internal library functions in ILU +ILAPI ILimage* ILAPIENTRY iluRotate_(ILimage *Image, ILfloat Angle); +ILAPI ILimage* ILAPIENTRY iluRotate3D_(ILimage *Image, ILfloat x, ILfloat y, ILfloat z, ILfloat Angle); +ILAPI ILimage* ILAPIENTRY iluScale_(ILimage *Image, ILuint Width, ILuint Height, ILuint Depth); + +#ifdef __cplusplus +} +#endif + +#endif//IL_EXPORTS_H diff --git a/code/external/devil/IL/il.h b/code/external/devil/IL/il.h new file mode 100644 index 0000000..47dfcd7 --- /dev/null +++ b/code/external/devil/IL/il.h @@ -0,0 +1,645 @@ +//----------------------------------------------------------------------------- +// +// ImageLib Sources +// Copyright (C) 2000-2017 by Denton Woods +// Last modified: 03/07/2009 +// +// Filename: IL/il.h +// +// Description: The main include file for DevIL +// +//----------------------------------------------------------------------------- + +// Doxygen comment +/*! \file il.h + The main include file for DevIL +*/ + +#ifndef __il_h_ +#ifndef __IL_H__ + +#define __il_h_ +#define __IL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +//this define controls if floats and doubles are clamped to [0..1] +//during conversion. It takes a little more time, but it is the correct +//way of doing this. If you are sure your floats are always valid, +//you can undefine this value... +#define CLAMP_HALF 1 +#define CLAMP_FLOATS 1 +#define CLAMP_DOUBLES 1 + +/*#ifdef _WIN32_WCE + #define IL_NO_EXR + #define IL_NO_GIF + #define IL_NO_JP2 + #define IL_NO_JPG + #define IL_NO_MNG + #define IL_NO_PNG + #define IL_NO_TIF + #define IL_NO_LCMS +#endif //_WIN32_WCE + +#ifdef DJGPP + #define IL_NO_EXR + #define IL_NO_GIF + #define IL_NO_JP2 + #define IL_NO_JPG + #define IL_NO_MNG + #define IL_NO_PNG + #define IL_NO_TIF + #define IL_NO_LCMS +#endif //DJGPP*/ + +#ifdef _WIN32 + #if (defined(IL_USE_PRAGMA_LIBS)) && (!defined(_IL_BUILD_LIBRARY)) + #if defined(_MSC_VER) || defined(__BORLANDC__) + #pragma comment(lib, "DevIL.lib") + #endif + #endif +#endif + +#if defined(RESTRICT_KEYWORD) && !defined(__cplusplus) +#define RESTRICT restrict +#define CONST_RESTRICT const restrict +#else +#define RESTRICT +#define CONST_RESTRICT const +#endif + +#include + +typedef unsigned int ILenum; +typedef unsigned char ILboolean; +typedef unsigned int ILbitfield; +typedef signed char ILbyte; +typedef signed short ILshort; +typedef int ILint; +typedef size_t ILsizei; +typedef unsigned char ILubyte; +typedef unsigned short ILushort; +typedef unsigned int ILuint; +typedef float ILfloat; +typedef float ILclampf; +typedef double ILdouble; +typedef double ILclampd; + +#ifdef _MSC_VER +typedef __int64 ILint64; +typedef unsigned __int64 ILuint64; +#else +typedef long long int ILint64; +typedef long long unsigned int ILuint64; +#endif + + +#include +#ifdef _UNICODE + #ifndef _WIN32_WCE + #include + #endif + //if we use a define instead of a typedef, + //ILconst_string works as intended + #define ILchar wchar_t + #define ILstring wchar_t* + #define ILconst_string wchar_t const * +#else + //if we use a define instead of a typedef, + //ILconst_string works as intended + #define ILchar char + #define ILstring char* + #define ILconst_string char const * +#endif //_UNICODE + +#define IL_FALSE 0 +#define IL_TRUE 1 + +// Matches OpenGL's right now. +//! Data formats \link Formats Formats\endlink +#define IL_COLOUR_INDEX 0x1900 +#define IL_COLOR_INDEX 0x1900 +#define IL_ALPHA 0x1906 +#define IL_RGB 0x1907 +#define IL_RGBA 0x1908 +#define IL_BGR 0x80E0 +#define IL_BGRA 0x80E1 +#define IL_LUMINANCE 0x1909 +#define IL_LUMINANCE_ALPHA 0x190A + +//! Data types \link Types Types\endlink +#define IL_BYTE 0x1400 +#define IL_UNSIGNED_BYTE 0x1401 +#define IL_SHORT 0x1402 +#define IL_UNSIGNED_SHORT 0x1403 +#define IL_INT 0x1404 +#define IL_UNSIGNED_INT 0x1405 +#define IL_FLOAT 0x1406 +#define IL_DOUBLE 0x140A +#define IL_HALF 0x140B + + +#define IL_MAX_BYTE SCHAR_MAX +#define IL_MAX_UNSIGNED_BYTE UCHAR_MAX +#define IL_MAX_SHORT SHRT_MAX +#define IL_MAX_UNSIGNED_SHORT USHRT_MAX +#define IL_MAX_INT INT_MAX +#define IL_MAX_UNSIGNED_INT UINT_MAX + +#define IL_LIMIT(x,m,M) (xM?M:x)) +#define IL_CLAMP(x) IL_LIMIT(x,0,1) + +#define IL_VENDOR 0x1F00 +#define IL_LOAD_EXT 0x1F01 +#define IL_SAVE_EXT 0x1F02 + + +// +// IL-specific #define's +// + +#define IL_VERSION_1_8_0 1 +#define IL_VERSION 180 + + +// Attribute Bits +#define IL_ORIGIN_BIT 0x00000001 +#define IL_FILE_BIT 0x00000002 +#define IL_PAL_BIT 0x00000004 +#define IL_FORMAT_BIT 0x00000008 +#define IL_TYPE_BIT 0x00000010 +#define IL_COMPRESS_BIT 0x00000020 +#define IL_LOADFAIL_BIT 0x00000040 +#define IL_FORMAT_SPECIFIC_BIT 0x00000080 +#define IL_ALL_ATTRIB_BITS 0x000FFFFF + + +// Palette types +#define IL_PAL_NONE 0x0400 +#define IL_PAL_RGB24 0x0401 +#define IL_PAL_RGB32 0x0402 +#define IL_PAL_RGBA32 0x0403 +#define IL_PAL_BGR24 0x0404 +#define IL_PAL_BGR32 0x0405 +#define IL_PAL_BGRA32 0x0406 + + +// Image types +#define IL_TYPE_UNKNOWN 0x0000 +#define IL_BMP 0x0420 //!< Microsoft Windows Bitmap - .bmp extension +#define IL_CUT 0x0421 //!< Dr. Halo - .cut extension +#define IL_DOOM 0x0422 //!< DooM walls - no specific extension +#define IL_DOOM_FLAT 0x0423 //!< DooM flats - no specific extension +#define IL_ICO 0x0424 //!< Microsoft Windows Icons and Cursors - .ico and .cur extensions +#define IL_JPG 0x0425 //!< JPEG - .jpg, .jpe and .jpeg extensions +#define IL_JFIF 0x0425 //!< +#define IL_ILBM 0x0426 //!< Amiga IFF (FORM ILBM) - .iff, .ilbm, .lbm extensions +#define IL_PCD 0x0427 //!< Kodak PhotoCD - .pcd extension +#define IL_PCX 0x0428 //!< ZSoft PCX - .pcx extension +#define IL_PIC 0x0429 //!< PIC - .pic extension +#define IL_PNG 0x042A //!< Portable Network Graphics - .png extension +#define IL_PNM 0x042B //!< Portable Any Map - .pbm, .pgm, .ppm and .pnm extensions +#define IL_SGI 0x042C //!< Silicon Graphics - .sgi, .bw, .rgb and .rgba extensions +#define IL_TGA 0x042D //!< TrueVision Targa File - .tga, .vda, .icb and .vst extensions +#define IL_TIF 0x042E //!< Tagged Image File Format - .tif and .tiff extensions +#define IL_CHEAD 0x042F //!< C-Style Header - .h extension +#define IL_RAW 0x0430 //!< Raw Image Data - any extension +#define IL_MDL 0x0431 //!< Half-Life Model Texture - .mdl extension +#define IL_WAL 0x0432 //!< Quake 2 Texture - .wal extension +#define IL_LIF 0x0434 //!< Homeworld Texture - .lif extension +#define IL_MNG 0x0435 //!< Multiple-image Network Graphics - .mng extension +#define IL_JNG 0x0435 //!< +#define IL_GIF 0x0436 //!< Graphics Interchange Format - .gif extension +#define IL_DDS 0x0437 //!< DirectDraw Surface - .dds extension +#define IL_DCX 0x0438 //!< ZSoft Multi-PCX - .dcx extension +#define IL_PSD 0x0439 //!< Adobe PhotoShop - .psd extension +#define IL_EXIF 0x043A //!< +#define IL_PSP 0x043B //!< PaintShop Pro - .psp extension +#define IL_PIX 0x043C //!< PIX - .pix extension +#define IL_PXR 0x043D //!< Pixar - .pxr extension +#define IL_XPM 0x043E //!< X Pixel Map - .xpm extension +#define IL_HDR 0x043F //!< Radiance High Dynamic Range - .hdr extension +#define IL_ICNS 0x0440 //!< Macintosh Icon - .icns extension +#define IL_JP2 0x0441 //!< Jpeg 2000 - .jp2 extension +#define IL_EXR 0x0442 //!< OpenEXR - .exr extension +#define IL_WDP 0x0443 //!< Microsoft HD Photo - .wdp and .hdp extension +#define IL_VTF 0x0444 //!< Valve Texture Format - .vtf extension +#define IL_WBMP 0x0445 //!< Wireless Bitmap - .wbmp extension +#define IL_SUN 0x0446 //!< Sun Raster - .sun, .ras, .rs, .im1, .im8, .im24 and .im32 extensions +#define IL_IFF 0x0447 //!< Interchange File Format - .iff extension +#define IL_TPL 0x0448 //!< Gamecube Texture - .tpl extension +#define IL_FITS 0x0449 //!< Flexible Image Transport System - .fit and .fits extensions +#define IL_DICOM 0x044A //!< Digital Imaging and Communications in Medicine (DICOM) - .dcm and .dicom extensions +#define IL_IWI 0x044B //!< Call of Duty Infinity Ward Image - .iwi extension +#define IL_BLP 0x044C //!< Blizzard Texture Format - .blp extension +#define IL_FTX 0x044D //!< Heavy Metal: FAKK2 Texture - .ftx extension +#define IL_ROT 0x044E //!< Homeworld 2 - Relic Texture - .rot extension +#define IL_TEXTURE 0x044F //!< Medieval II: Total War Texture - .texture extension +#define IL_DPX 0x0450 //!< Digital Picture Exchange - .dpx extension +#define IL_UTX 0x0451 //!< Unreal (and Unreal Tournament) Texture - .utx extension +#define IL_MP3 0x0452 //!< MPEG-1 Audio Layer 3 - .mp3 extension +#define IL_KTX 0x0453 //!< Khronos Texture - .ktx extension + + +#define IL_JASC_PAL 0x0475 //!< PaintShop Pro Palette + + +// Error Types +#define IL_NO_ERROR 0x0000 +#define IL_INVALID_ENUM 0x0501 +#define IL_OUT_OF_MEMORY 0x0502 +#define IL_FORMAT_NOT_SUPPORTED 0x0503 +#define IL_INTERNAL_ERROR 0x0504 +#define IL_INVALID_VALUE 0x0505 +#define IL_ILLEGAL_OPERATION 0x0506 +#define IL_ILLEGAL_FILE_VALUE 0x0507 +#define IL_INVALID_FILE_HEADER 0x0508 +#define IL_INVALID_PARAM 0x0509 +#define IL_COULD_NOT_OPEN_FILE 0x050A +#define IL_INVALID_EXTENSION 0x050B +#define IL_FILE_ALREADY_EXISTS 0x050C +#define IL_OUT_FORMAT_SAME 0x050D +#define IL_STACK_OVERFLOW 0x050E +#define IL_STACK_UNDERFLOW 0x050F +#define IL_INVALID_CONVERSION 0x0510 +#define IL_BAD_DIMENSIONS 0x0511 +#define IL_FILE_READ_ERROR 0x0512 // 05/12/2002: Addition by Sam. +#define IL_FILE_WRITE_ERROR 0x0512 + +#define IL_LIB_GIF_ERROR 0x05E1 +#define IL_LIB_JPEG_ERROR 0x05E2 +#define IL_LIB_PNG_ERROR 0x05E3 +#define IL_LIB_TIFF_ERROR 0x05E4 +#define IL_LIB_MNG_ERROR 0x05E5 +#define IL_LIB_JP2_ERROR 0x05E6 +#define IL_LIB_EXR_ERROR 0x05E7 +#define IL_UNKNOWN_ERROR 0x05FF + + +// Origin Definitions +#define IL_ORIGIN_SET 0x0600 +#define IL_ORIGIN_LOWER_LEFT 0x0601 +#define IL_ORIGIN_UPPER_LEFT 0x0602 +#define IL_ORIGIN_MODE 0x0603 + + +// Format and Type Mode Definitions +#define IL_FORMAT_SET 0x0610 +#define IL_FORMAT_MODE 0x0611 +#define IL_TYPE_SET 0x0612 +#define IL_TYPE_MODE 0x0613 + + +// File definitions +#define IL_FILE_OVERWRITE 0x0620 +#define IL_FILE_MODE 0x0621 + + +// Palette definitions +#define IL_CONV_PAL 0x0630 + + +// Load fail definitions +#define IL_DEFAULT_ON_FAIL 0x0632 + + +// Key colour and alpha definitions +#define IL_USE_KEY_COLOUR 0x0635 +#define IL_USE_KEY_COLOR 0x0635 +#define IL_BLIT_BLEND 0x0636 + + +// Interlace definitions +#define IL_SAVE_INTERLACED 0x0639 +#define IL_INTERLACE_MODE 0x063A + + +// Quantization definitions +#define IL_QUANTIZATION_MODE 0x0640 +#define IL_WU_QUANT 0x0641 +#define IL_NEU_QUANT 0x0642 +#define IL_NEU_QUANT_SAMPLE 0x0643 +#define IL_MAX_QUANT_INDEXS 0x0644 //XIX : ILint : Maximum number of colors to reduce to, default of 256. and has a range of 2-256 +#define IL_MAX_QUANT_INDICES 0x0644 // Redefined, since the above #define is misspelled + + +// Hints +#define IL_FASTEST 0x0660 +#define IL_LESS_MEM 0x0661 +#define IL_DONT_CARE 0x0662 +#define IL_MEM_SPEED_HINT 0x0665 +#define IL_USE_COMPRESSION 0x0666 +#define IL_NO_COMPRESSION 0x0667 +#define IL_COMPRESSION_HINT 0x0668 + + +// Compression +#define IL_NVIDIA_COMPRESS 0x0670 +#define IL_SQUISH_COMPRESS 0x0671 + + +// Subimage types +#define IL_SUB_NEXT 0x0680 +#define IL_SUB_MIPMAP 0x0681 +#define IL_SUB_LAYER 0x0682 + + +// Compression definitions +#define IL_COMPRESS_MODE 0x0700 +#define IL_COMPRESS_NONE 0x0701 +#define IL_COMPRESS_RLE 0x0702 +#define IL_COMPRESS_LZO 0x0703 +#define IL_COMPRESS_ZLIB 0x0704 + + +// File format-specific values +#define IL_TGA_CREATE_STAMP 0x0710 +#define IL_JPG_QUALITY 0x0711 +#define IL_PNG_INTERLACE 0x0712 +#define IL_TGA_RLE 0x0713 +#define IL_BMP_RLE 0x0714 +#define IL_SGI_RLE 0x0715 +#define IL_TGA_ID_STRING 0x0717 +#define IL_TGA_AUTHNAME_STRING 0x0718 +#define IL_TGA_AUTHCOMMENT_STRING 0x0719 +#define IL_PNG_AUTHNAME_STRING 0x071A +#define IL_PNG_TITLE_STRING 0x071B +#define IL_PNG_DESCRIPTION_STRING 0x071C +#define IL_TIF_DESCRIPTION_STRING 0x071D +#define IL_TIF_HOSTCOMPUTER_STRING 0x071E +#define IL_TIF_DOCUMENTNAME_STRING 0x071F +#define IL_TIF_AUTHNAME_STRING 0x0720 +#define IL_JPG_SAVE_FORMAT 0x0721 +#define IL_CHEAD_HEADER_STRING 0x0722 +#define IL_PCD_PICNUM 0x0723 +#define IL_PNG_ALPHA_INDEX 0x0724 // currently has no effect! +#define IL_JPG_PROGRESSIVE 0x0725 +#define IL_VTF_COMP 0x0726 + + +// DXTC definitions +#define IL_DXTC_FORMAT 0x0705 +#define IL_DXT1 0x0706 +#define IL_DXT2 0x0707 +#define IL_DXT3 0x0708 +#define IL_DXT4 0x0709 +#define IL_DXT5 0x070A +#define IL_DXT_NO_COMP 0x070B +#define IL_KEEP_DXTC_DATA 0x070C +#define IL_DXTC_DATA_FORMAT 0x070D +#define IL_3DC 0x070E +#define IL_RXGB 0x070F +#define IL_ATI1N 0x0710 +#define IL_DXT1A 0x0711 // Normally the same as IL_DXT1, except for nVidia Texture Tools. + +// Environment map definitions +#define IL_CUBEMAP_POSITIVEX 0x00000400 +#define IL_CUBEMAP_NEGATIVEX 0x00000800 +#define IL_CUBEMAP_POSITIVEY 0x00001000 +#define IL_CUBEMAP_NEGATIVEY 0x00002000 +#define IL_CUBEMAP_POSITIVEZ 0x00004000 +#define IL_CUBEMAP_NEGATIVEZ 0x00008000 +#define IL_SPHEREMAP 0x00010000 + + +// Values +#define IL_VERSION_NUM 0x0DE2 +#define IL_IMAGE_WIDTH 0x0DE4 +#define IL_IMAGE_HEIGHT 0x0DE5 +#define IL_IMAGE_DEPTH 0x0DE6 +#define IL_IMAGE_SIZE_OF_DATA 0x0DE7 +#define IL_IMAGE_BPP 0x0DE8 +#define IL_IMAGE_BYTES_PER_PIXEL 0x0DE8 +#define IL_IMAGE_BPP 0x0DE8 +#define IL_IMAGE_BITS_PER_PIXEL 0x0DE9 +#define IL_IMAGE_FORMAT 0x0DEA +#define IL_IMAGE_TYPE 0x0DEB +#define IL_PALETTE_TYPE 0x0DEC +#define IL_PALETTE_SIZE 0x0DED +#define IL_PALETTE_BPP 0x0DEE +#define IL_PALETTE_NUM_COLS 0x0DEF +#define IL_PALETTE_BASE_TYPE 0x0DF0 +#define IL_NUM_FACES 0x0DE1 +#define IL_NUM_IMAGES 0x0DF1 +#define IL_NUM_MIPMAPS 0x0DF2 +#define IL_NUM_LAYERS 0x0DF3 +#define IL_ACTIVE_IMAGE 0x0DF4 +#define IL_ACTIVE_MIPMAP 0x0DF5 +#define IL_ACTIVE_LAYER 0x0DF6 +#define IL_ACTIVE_FACE 0x0E00 +#define IL_CUR_IMAGE 0x0DF7 +#define IL_IMAGE_DURATION 0x0DF8 +#define IL_IMAGE_PLANESIZE 0x0DF9 +#define IL_IMAGE_BPC 0x0DFA +#define IL_IMAGE_OFFX 0x0DFB +#define IL_IMAGE_OFFY 0x0DFC +#define IL_IMAGE_CUBEFLAGS 0x0DFD +#define IL_IMAGE_ORIGIN 0x0DFE +#define IL_IMAGE_CHANNELS 0x0DFF + +# if defined __GNUC__ && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)) +// __attribute__((deprecated)) is supported by GCC 3.1 and later. +# define DEPRECATED(D) D __attribute__((deprecated)) +# elif defined _MSC_VER && _MSC_VER >= 1300 +// __declspec(deprecated) is supported by MSVC 7.0 and later. +# define DEPRECATED(D) __declspec(deprecated) D +# else +# define DEPRECATED (D) D +# endif + +// +// Section shamelessly modified from the glut header. +// + +// This is from Win32's +#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__) + #define ILAPIENTRY __stdcall + #define IL_PACKSTRUCT +//#elif defined(linux) || defined(MACOSX) || defined(__CYGWIN__) //fix bug 840364 +#elif defined( __GNUC__ ) + // this should work for any of the above commented platforms + // plus any platform using GCC + #ifdef __MINGW32__ + #define ILAPIENTRY __stdcall + #else + #define ILAPIENTRY + #endif + #define IL_PACKSTRUCT __attribute__ ((packed)) +#else + #define ILAPIENTRY + #define IL_PACKSTRUCT +#endif + +// This is from Win32's and +#if defined(__LCC__) + #define ILAPI __stdcall +#elif defined(_WIN32) //changed 20031221 to fix bug 840421 + #ifdef IL_STATIC_LIB + #define ILAPI + #else + #ifdef _IL_BUILD_LIBRARY + #define ILAPI __declspec(dllexport) + #else + #define ILAPI __declspec(dllimport) + #endif + #endif +#elif __APPLE__ + #define ILAPI extern +#else + #define ILAPI +#endif + + +#define IL_SEEK_SET 0 +#define IL_SEEK_CUR 1 +#define IL_SEEK_END 2 +#define IL_EOF -1 + + +// Callback functions for file reading +typedef void* ILHANDLE; +typedef void (ILAPIENTRY *fCloseRProc)(ILHANDLE); +typedef ILboolean (ILAPIENTRY *fEofProc) (ILHANDLE); +typedef ILint (ILAPIENTRY *fGetcProc) (ILHANDLE); +typedef ILHANDLE (ILAPIENTRY *fOpenRProc) (ILconst_string); +typedef ILint (ILAPIENTRY *fReadProc) (void*, ILuint, ILuint, ILHANDLE); +typedef ILint (ILAPIENTRY *fSeekRProc) (ILHANDLE, ILint, ILint); +typedef ILint (ILAPIENTRY *fTellRProc) (ILHANDLE); + +// Callback functions for file writing +typedef void (ILAPIENTRY *fCloseWProc)(ILHANDLE); +typedef ILHANDLE (ILAPIENTRY *fOpenWProc) (ILconst_string); +typedef ILint (ILAPIENTRY *fPutcProc) (ILubyte, ILHANDLE); +typedef ILint (ILAPIENTRY *fSeekWProc) (ILHANDLE, ILint, ILint); +typedef ILint (ILAPIENTRY *fTellWProc) (ILHANDLE); +typedef ILint (ILAPIENTRY *fWriteProc) (const void*, ILuint, ILuint, ILHANDLE); + +// Callback functions for allocation and deallocation +typedef void* (ILAPIENTRY *mAlloc)(const ILsizei); +typedef void (ILAPIENTRY *mFree) (const void* CONST_RESTRICT); + +// Registered format procedures +typedef ILenum (ILAPIENTRY *IL_LOADPROC)(ILconst_string); +typedef ILenum (ILAPIENTRY *IL_SAVEPROC)(ILconst_string); + + +// ImageLib Functions +ILAPI ILboolean ILAPIENTRY ilActiveFace(ILuint Number); +ILAPI ILboolean ILAPIENTRY ilActiveImage(ILuint Number); +ILAPI ILboolean ILAPIENTRY ilActiveLayer(ILuint Number); +ILAPI ILboolean ILAPIENTRY ilActiveMipmap(ILuint Number); +ILAPI ILboolean ILAPIENTRY ilApplyPal(ILconst_string FileName); +ILAPI ILboolean ILAPIENTRY ilApplyProfile(ILstring InProfile, ILstring OutProfile); +ILAPI void ILAPIENTRY ilBindImage(ILuint Image); +ILAPI ILboolean ILAPIENTRY ilBlit(ILuint Source, ILint DestX, ILint DestY, ILint DestZ, ILuint SrcX, ILuint SrcY, ILuint SrcZ, ILuint Width, ILuint Height, ILuint Depth); +ILAPI ILboolean ILAPIENTRY ilClampNTSC(void); +ILAPI void ILAPIENTRY ilClearColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha); +ILAPI ILboolean ILAPIENTRY ilClearImage(void); +ILAPI ILuint ILAPIENTRY ilCloneCurImage(void); +ILAPI ILubyte* ILAPIENTRY ilCompressDXT(ILubyte *Data, ILuint Width, ILuint Height, ILuint Depth, ILenum DXTCFormat, ILuint *DXTCSize); +ILAPI ILboolean ILAPIENTRY ilCompressFunc(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilConvertImage(ILenum DestFormat, ILenum DestType); +ILAPI ILboolean ILAPIENTRY ilConvertPal(ILenum DestFormat); +ILAPI ILboolean ILAPIENTRY ilCopyImage(ILuint Src); +ILAPI ILuint ILAPIENTRY ilCopyPixels(ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, void *Data); +ILAPI ILuint ILAPIENTRY ilCreateSubImage(ILenum Type, ILuint Num); +ILAPI ILboolean ILAPIENTRY ilDefaultImage(void); +ILAPI void ILAPIENTRY ilDeleteImage(const ILuint Num); +ILAPI void ILAPIENTRY ilDeleteImages(ILsizei Num, const ILuint *Images); +ILAPI ILenum ILAPIENTRY ilDetermineType(ILconst_string FileName); +ILAPI ILenum ILAPIENTRY ilDetermineTypeF(ILHANDLE File); +ILAPI ILenum ILAPIENTRY ilDetermineTypeL(const void *Lump, ILuint Size); +ILAPI ILboolean ILAPIENTRY ilDisable(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilDxtcDataToImage(void); +ILAPI ILboolean ILAPIENTRY ilDxtcDataToSurface(void); +ILAPI ILboolean ILAPIENTRY ilEnable(ILenum Mode); +ILAPI void ILAPIENTRY ilFlipSurfaceDxtcData(void); +ILAPI ILboolean ILAPIENTRY ilFormatFunc(ILenum Mode); +ILAPI void ILAPIENTRY ilGenImages(ILsizei Num, ILuint *Images); +ILAPI ILuint ILAPIENTRY ilGenImage(void); +ILAPI ILubyte* ILAPIENTRY ilGetAlpha(ILenum Type); +ILAPI ILboolean ILAPIENTRY ilGetBoolean(ILenum Mode); +ILAPI void ILAPIENTRY ilGetBooleanv(ILenum Mode, ILboolean *Param); +ILAPI ILubyte* ILAPIENTRY ilGetData(void); +ILAPI ILuint ILAPIENTRY ilGetDXTCData(void *Buffer, ILuint BufferSize, ILenum DXTCFormat); +ILAPI ILenum ILAPIENTRY ilGetError(void); +ILAPI ILint ILAPIENTRY ilGetInteger(ILenum Mode); +ILAPI void ILAPIENTRY ilGetIntegerv(ILenum Mode, ILint *Param); +ILAPI ILuint ILAPIENTRY ilGetLumpPos(void); +ILAPI ILubyte* ILAPIENTRY ilGetPalette(void); +ILAPI ILconst_string ILAPIENTRY ilGetString(ILenum StringName); +ILAPI void ILAPIENTRY ilHint(ILenum Target, ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilInvertSurfaceDxtcDataAlpha(void); +ILAPI void ILAPIENTRY ilInit(void); +ILAPI ILboolean ILAPIENTRY ilImageToDxtcData(ILenum Format); +ILAPI ILboolean ILAPIENTRY ilIsDisabled(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilIsEnabled(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilIsImage(ILuint Image); +ILAPI ILboolean ILAPIENTRY ilIsValid(ILenum Type, ILconst_string FileName); +ILAPI ILboolean ILAPIENTRY ilIsValidF(ILenum Type, ILHANDLE File); +ILAPI ILboolean ILAPIENTRY ilIsValidL(ILenum Type, void *Lump, ILuint Size); +ILAPI void ILAPIENTRY ilKeyColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha); +ILAPI ILboolean ILAPIENTRY ilLoad(ILenum Type, ILconst_string FileName); +ILAPI ILboolean ILAPIENTRY ilLoadF(ILenum Type, ILHANDLE File); +ILAPI ILboolean ILAPIENTRY ilLoadImage(ILconst_string FileName); +ILAPI ILboolean ILAPIENTRY ilLoadL(ILenum Type, const void *Lump, ILuint Size); +ILAPI ILboolean ILAPIENTRY ilLoadPal(ILconst_string FileName); +ILAPI void ILAPIENTRY ilModAlpha(ILdouble AlphaValue); +ILAPI ILboolean ILAPIENTRY ilOriginFunc(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilOverlayImage(ILuint Source, ILint XCoord, ILint YCoord, ILint ZCoord); +ILAPI void ILAPIENTRY ilPopAttrib(void); +ILAPI void ILAPIENTRY ilPushAttrib(ILuint Bits); +ILAPI void ILAPIENTRY ilRegisterFormat(ILenum Format); +ILAPI ILboolean ILAPIENTRY ilRegisterLoad(ILconst_string Ext, IL_LOADPROC Load); +ILAPI ILboolean ILAPIENTRY ilRegisterMipNum(ILuint Num); +ILAPI ILboolean ILAPIENTRY ilRegisterNumFaces(ILuint Num); +ILAPI ILboolean ILAPIENTRY ilRegisterNumImages(ILuint Num); +ILAPI void ILAPIENTRY ilRegisterOrigin(ILenum Origin); +ILAPI void ILAPIENTRY ilRegisterPal(void *Pal, ILuint Size, ILenum Type); +ILAPI ILboolean ILAPIENTRY ilRegisterSave(ILconst_string Ext, IL_SAVEPROC Save); +ILAPI void ILAPIENTRY ilRegisterType(ILenum Type); +ILAPI ILboolean ILAPIENTRY ilRemoveLoad(ILconst_string Ext); +ILAPI ILboolean ILAPIENTRY ilRemoveSave(ILconst_string Ext); +ILAPI void ILAPIENTRY ilResetMemory(void); // Deprecated +ILAPI void ILAPIENTRY ilResetRead(void); +ILAPI void ILAPIENTRY ilResetWrite(void); +ILAPI ILboolean ILAPIENTRY ilSave(ILenum Type, ILconst_string FileName); +ILAPI ILuint ILAPIENTRY ilSaveF(ILenum Type, ILHANDLE File); +ILAPI ILboolean ILAPIENTRY ilSaveImage(ILconst_string FileName); +ILAPI ILuint ILAPIENTRY ilSaveL(ILenum Type, void *Lump, ILuint Size); +ILAPI ILboolean ILAPIENTRY ilSavePal(ILconst_string FileName); +ILAPI ILboolean ILAPIENTRY ilSetAlpha(ILdouble AlphaValue); +ILAPI ILboolean ILAPIENTRY ilSetData(void *Data); +ILAPI ILboolean ILAPIENTRY ilSetDuration(ILuint Duration); +ILAPI void ILAPIENTRY ilSetInteger(ILenum Mode, ILint Param); +ILAPI void ILAPIENTRY ilSetMemory(mAlloc, mFree); +ILAPI void ILAPIENTRY ilSetPixels(ILint XOff, ILint YOff, ILint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, void *Data); +ILAPI void ILAPIENTRY ilSetRead(fOpenRProc, fCloseRProc, fEofProc, fGetcProc, fReadProc, fSeekRProc, fTellRProc); +ILAPI void ILAPIENTRY ilSetString(ILenum Mode, const char *String); +ILAPI void ILAPIENTRY ilSetWrite(fOpenWProc, fCloseWProc, fPutcProc, fSeekWProc, fTellWProc, fWriteProc); +ILAPI void ILAPIENTRY ilShutDown(void); +ILAPI ILboolean ILAPIENTRY ilSurfaceToDxtcData(ILenum Format); +ILAPI ILboolean ILAPIENTRY ilTexImage(ILuint Width, ILuint Height, ILuint Depth, ILubyte NumChannels, ILenum Format, ILenum Type, void *Data); +ILAPI ILboolean ILAPIENTRY ilTexImageDxtc(ILint w, ILint h, ILint d, ILenum DxtFormat, const ILubyte* data); +ILAPI ILenum ILAPIENTRY ilTypeFromExt(ILconst_string FileName); +ILAPI ILboolean ILAPIENTRY ilTypeFunc(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilLoadData(ILconst_string FileName, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp); +ILAPI ILboolean ILAPIENTRY ilLoadDataF(ILHANDLE File, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp); +ILAPI ILboolean ILAPIENTRY ilLoadDataL(void *Lump, ILuint Size, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp); +ILAPI ILboolean ILAPIENTRY ilSaveData(ILconst_string FileName); + +// For all those weirdos that spell "colour" without the 'u'. +#define ilClearColor ilClearColour +#define ilKeyColor ilKeyColour + +#define imemclear(x,y) memset(x,0,y); + +#ifdef __cplusplus +} +#endif + +#endif // __IL_H__ +#endif // __il_h__ diff --git a/code/external/devil/IL/il_wrap.h b/code/external/devil/IL/il_wrap.h new file mode 100644 index 0000000..5cf9b0e --- /dev/null +++ b/code/external/devil/IL/il_wrap.h @@ -0,0 +1,205 @@ +#ifndef WRAPPER_H +#define WRAPPER_H + +/*#include +#include */ +#include // Probably only have to #include this one + +#ifdef _MSC_VER + #ifndef _IL_WRAP_BUILD_LIB + #pragma comment(lib, "il_wrap.lib") + #endif +#endif + +class ilImage +{ +public: + ilImage(); + ilImage(char *); + ilImage(const ilImage &); + virtual ~ilImage(); + + ILboolean Load(char *); + ILboolean Load(char *, ILenum); + ILboolean Save(char *); + ILboolean Save(char *, ILenum); + + + // ImageLib functions + ILboolean ActiveImage(ILuint); + ILboolean ActiveLayer(ILuint); + ILboolean ActiveMipmap(ILuint); + ILboolean Clear(void); + ILvoid ClearColour(ILclampf, ILclampf, ILclampf, ILclampf); + ILboolean Convert(ILenum); + ILboolean Copy(ILuint); + ILboolean Default(void); + ILboolean Flip(void); + ILboolean SwapColours(void); + ILboolean Resize(ILuint, ILuint, ILuint); + ILboolean TexImage(ILuint, ILuint, ILuint, ILubyte, ILenum, ILenum, ILvoid*); + + + // Image handling + ILvoid Bind(void) const; + ILvoid Bind(ILuint); + ILvoid Close(void) { this->Delete(); } + ILvoid Delete(void); + ILvoid iGenBind(); + ILenum PaletteAlphaIndex(); + + // Image characteristics + ILuint Width(void); + ILuint Height(void); + ILuint Depth(void); + ILubyte Bpp(void); + ILubyte Bitpp(void); + ILenum PaletteType(void); + ILenum Format(void); + ILenum Type(void); + ILuint NumImages(void); + ILuint NumMipmaps(void); + ILuint GetId(void) const; + ILenum GetOrigin(void); + ILubyte *GetData(void); + ILubyte *GetPalette(void); + + + // Rendering + ILuint BindImage(void); + ILuint BindImage(ILenum); + + + // Operators + ilImage& operator = (ILuint); + ilImage& operator = (const ilImage &); + + +protected: + ILuint Id; + +private: + ILvoid iStartUp(); + + +}; + + +class ilFilters +{ +public: + static ILboolean Alienify(ilImage &); + static ILboolean BlurAvg(ilImage &, ILuint Iter); + static ILboolean BlurGaussian(ilImage &, ILuint Iter); + static ILboolean Contrast(ilImage &, ILfloat Contrast); + static ILboolean EdgeDetectE(ilImage &); + static ILboolean EdgeDetectP(ilImage &); + static ILboolean EdgeDetectS(ilImage &); + static ILboolean Emboss(ilImage &); + static ILboolean Gamma(ilImage &, ILfloat Gamma); + static ILboolean Negative(ilImage &); + static ILboolean Noisify(ilImage &, ILubyte Factor); + static ILboolean Pixelize(ilImage &, ILuint PixSize); + static ILboolean Saturate(ilImage &, ILfloat Saturation); + static ILboolean Saturate(ilImage &, ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation); + static ILboolean ScaleColours(ilImage &, ILfloat r, ILfloat g, ILfloat b); + static ILboolean Sharpen(ilImage &, ILfloat Factor, ILuint Iter); +}; + + +#ifdef ILUT_USE_OPENGL +class ilOgl +{ +public: + static ILvoid Init(void); + static GLuint BindTex(ilImage &); + static ILboolean Upload(ilImage &, ILuint); + static GLuint Mipmap(ilImage &); + static ILboolean Screen(void); + static ILboolean Screenie(void); +}; +#endif//ILUT_USE_OPENGL + + +#ifdef ILUT_USE_ALLEGRO +class ilAlleg +{ +public: + static ILvoid Init(void); + static BITMAP *Convert(ilImage &); +}; +#endif//ILUT_USE_ALLEGRO + + +#ifdef ILUT_USE_WIN32 +class ilWin32 +{ +public: + static ILvoid Init(void); + static HBITMAP Convert(ilImage &); + static ILboolean GetClipboard(ilImage &); + static ILvoid GetInfo(ilImage &, BITMAPINFO *Info); + static ILubyte *GetPadData(ilImage &); + static HPALETTE GetPal(ilImage &); + static ILboolean GetResource(ilImage &, HINSTANCE hInst, ILint ID, char *ResourceType); + static ILboolean GetResource(ilImage &, HINSTANCE hInst, ILint ID, char *ResourceType, ILenum Type); + static ILboolean SetClipboard(ilImage &); +}; +#endif//ILUT_USE_WIN32 + + +class ilValidate +{ +public: + static ILboolean Valid(ILenum, char *); + static ILboolean Valid(ILenum, FILE *); + static ILboolean Valid(ILenum, ILvoid *, ILuint); + +protected: + +private: + +}; + + +class ilState +{ +public: + static ILboolean Disable(ILenum); + static ILboolean Enable(ILenum); + static ILvoid Get(ILenum, ILboolean &); + static ILvoid Get(ILenum, ILint &); + static ILboolean GetBool(ILenum); + static ILint GetInt(ILenum); + static const char *GetString(ILenum); + static ILboolean IsDisabled(ILenum); + static ILboolean IsEnabled(ILenum); + static ILboolean Origin(ILenum); + static ILvoid Pop(void); + static ILvoid Push(ILuint); + + +protected: + +private: + +}; + + +class ilError +{ +public: + static ILvoid Check(ILvoid (*Callback)(const char*)); + static ILvoid Check(ILvoid (*Callback)(ILenum)); + static ILenum Get(void); + static const char *String(void); + static const char *String(ILenum); + +protected: + +private: + +}; + + +#endif//WRAPPER_H diff --git a/code/external/devil/IL/ilu.h b/code/external/devil/IL/ilu.h new file mode 100644 index 0000000..36a42a5 --- /dev/null +++ b/code/external/devil/IL/ilu.h @@ -0,0 +1,198 @@ +//----------------------------------------------------------------------------- +// +// ImageLib Utility Sources +// Copyright (C) 2000-2017 by Denton Woods +// Last modified: 03/07/2009 +// +// Filename: IL/ilu.h +// +// Description: The main include file for ILU +// +//----------------------------------------------------------------------------- + +// Doxygen comment +/*! \file ilu.h + The main include file for ILU +*/ + +#ifndef __ilu_h_ +#ifndef __ILU_H__ + +#define __ilu_h_ +#define __ILU_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _WIN32 + #if (defined(IL_USE_PRAGMA_LIBS)) && (!defined(_IL_BUILD_LIBRARY)) + #if defined(_MSC_VER) || defined(__BORLANDC__) + #pragma comment(lib, "ILU.lib") + #endif + #endif +#endif + + +#define ILU_VERSION_1_8_0 1 +#define ILU_VERSION 180 + + +#define ILU_FILTER 0x2600 +#define ILU_NEAREST 0x2601 +#define ILU_LINEAR 0x2602 +#define ILU_BILINEAR 0x2603 +#define ILU_SCALE_BOX 0x2604 +#define ILU_SCALE_TRIANGLE 0x2605 +#define ILU_SCALE_BELL 0x2606 +#define ILU_SCALE_BSPLINE 0x2607 +#define ILU_SCALE_LANCZOS3 0x2608 +#define ILU_SCALE_MITCHELL 0x2609 + + +// Error types +#define ILU_INVALID_ENUM 0x0501 +#define ILU_OUT_OF_MEMORY 0x0502 +#define ILU_INTERNAL_ERROR 0x0504 +#define ILU_INVALID_VALUE 0x0505 +#define ILU_ILLEGAL_OPERATION 0x0506 +#define ILU_INVALID_PARAM 0x0509 + + +// Values +#define ILU_PLACEMENT 0x0700 +#define ILU_LOWER_LEFT 0x0701 +#define ILU_LOWER_RIGHT 0x0702 +#define ILU_UPPER_LEFT 0x0703 +#define ILU_UPPER_RIGHT 0x0704 +#define ILU_CENTER 0x0705 +#define ILU_CONVOLUTION_MATRIX 0x0710 + +#define ILU_VERSION_NUM IL_VERSION_NUM +#define ILU_VENDOR IL_VENDOR + + +// Languages +#define ILU_ENGLISH 0x0800 +#define ILU_ARABIC 0x0801 +#define ILU_DUTCH 0x0802 +#define ILU_JAPANESE 0x0803 +#define ILU_SPANISH 0x0804 +#define ILU_GERMAN 0x0805 +#define ILU_FRENCH 0x0806 +#define ILU_ITALIAN 0x0807 + + +// Filters +/* +#define ILU_FILTER_BLUR 0x0803 +#define ILU_FILTER_GAUSSIAN_3x3 0x0804 +#define ILU_FILTER_GAUSSIAN_5X5 0x0805 +#define ILU_FILTER_EMBOSS1 0x0807 +#define ILU_FILTER_EMBOSS2 0x0808 +#define ILU_FILTER_LAPLACIAN1 0x080A +#define ILU_FILTER_LAPLACIAN2 0x080B +#define ILU_FILTER_LAPLACIAN3 0x080C +#define ILU_FILTER_LAPLACIAN4 0x080D +#define ILU_FILTER_SHARPEN1 0x080E +#define ILU_FILTER_SHARPEN2 0x080F +#define ILU_FILTER_SHARPEN3 0x0810 +*/ + + +typedef struct ILinfo +{ + ILuint Id; // the image's id + ILubyte *Data; // the image's data + ILuint Width; // the image's width + ILuint Height; // the image's height + ILuint Depth; // the image's depth + ILubyte Bpp; // bytes per pixel (not bits) of the image + ILuint SizeOfData; // the total size of the data (in bytes) + ILenum Format; // image format (in IL enum style) + ILenum Type; // image type (in IL enum style) + ILenum Origin; // origin of the image + ILubyte *Palette; // the image's palette + ILenum PalType; // palette type + ILuint PalSize; // palette size + ILenum CubeFlags; // flags for what cube map sides are present + ILuint NumNext; // number of images following + ILuint NumMips; // number of mipmaps + ILuint NumLayers; // number of layers +} ILinfo; + + +typedef struct ILpointf { + ILfloat x; + ILfloat y; +} ILpointf; + +typedef struct ILpointi { + ILint x; + ILint y; +} ILpointi; + +ILAPI ILboolean ILAPIENTRY iluAlienify(void); +ILAPI ILboolean ILAPIENTRY iluBlurAvg(ILuint Iter); +ILAPI ILboolean ILAPIENTRY iluBlurGaussian(ILuint Iter); +ILAPI ILboolean ILAPIENTRY iluBuildMipmaps(void); +ILAPI ILuint ILAPIENTRY iluColoursUsed(void); +ILAPI ILboolean ILAPIENTRY iluCompareImage(ILuint Comp); +ILAPI ILboolean ILAPIENTRY iluContrast(ILfloat Contrast); +ILAPI ILboolean ILAPIENTRY iluCrop(ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, ILuint Height, ILuint Depth); +ILAPI void ILAPIENTRY iluDeleteImage(ILuint Id); // Deprecated +ILAPI ILboolean ILAPIENTRY iluEdgeDetectE(void); +ILAPI ILboolean ILAPIENTRY iluEdgeDetectP(void); +ILAPI ILboolean ILAPIENTRY iluEdgeDetectS(void); +ILAPI ILboolean ILAPIENTRY iluEmboss(void); +ILAPI ILboolean ILAPIENTRY iluEnlargeCanvas(ILuint Width, ILuint Height, ILuint Depth); +ILAPI ILboolean ILAPIENTRY iluEnlargeImage(ILfloat XDim, ILfloat YDim, ILfloat ZDim); +ILAPI ILboolean ILAPIENTRY iluEqualize(void); +ILAPI ILboolean ILAPIENTRY iluEqualize2(void); +ILAPI ILconst_string ILAPIENTRY iluErrorString(ILenum Error); +ILAPI ILboolean ILAPIENTRY iluConvolution(ILint *matrix, ILint scale, ILint bias); +ILAPI ILboolean ILAPIENTRY iluFlipImage(void); +ILAPI ILboolean ILAPIENTRY iluGammaCorrect(ILfloat Gamma); +ILAPI ILuint ILAPIENTRY iluGenImage(void); // Deprecated +ILAPI void ILAPIENTRY iluGetImageInfo(ILinfo *Info); +ILAPI ILint ILAPIENTRY iluGetInteger(ILenum Mode); +ILAPI void ILAPIENTRY iluGetIntegerv(ILenum Mode, ILint *Param); +ILAPI ILstring ILAPIENTRY iluGetString(ILenum StringName); +ILAPI void ILAPIENTRY iluImageParameter(ILenum PName, ILenum Param); +ILAPI void ILAPIENTRY iluInit(void); +ILAPI ILboolean ILAPIENTRY iluInvertAlpha(void); +ILAPI ILuint ILAPIENTRY iluLoadImage(ILconst_string FileName); +ILAPI ILboolean ILAPIENTRY iluMirror(void); +ILAPI ILboolean ILAPIENTRY iluNegative(void); +ILAPI ILboolean ILAPIENTRY iluNoisify(ILclampf Tolerance); +ILAPI ILboolean ILAPIENTRY iluPixelize(ILuint PixSize); +ILAPI void ILAPIENTRY iluRegionfv(ILpointf *Points, ILuint n); +ILAPI void ILAPIENTRY iluRegioniv(ILpointi *Points, ILuint n); +ILAPI ILboolean ILAPIENTRY iluReplaceColour(ILubyte Red, ILubyte Green, ILubyte Blue, ILfloat Tolerance); +ILAPI ILboolean ILAPIENTRY iluRotate(ILfloat Angle); +ILAPI ILboolean ILAPIENTRY iluRotate3D(ILfloat x, ILfloat y, ILfloat z, ILfloat Angle); +ILAPI ILboolean ILAPIENTRY iluSaturate1f(ILfloat Saturation); +ILAPI ILboolean ILAPIENTRY iluSaturate4f(ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation); +ILAPI ILboolean ILAPIENTRY iluScale(ILuint Width, ILuint Height, ILuint Depth); +ILAPI ILboolean ILAPIENTRY iluScaleAlpha(ILfloat scale); +ILAPI ILboolean ILAPIENTRY iluScaleColours(ILfloat r, ILfloat g, ILfloat b); +ILAPI ILboolean ILAPIENTRY iluSepia(void); +ILAPI ILboolean ILAPIENTRY iluSetLanguage(ILenum Language); +ILAPI ILboolean ILAPIENTRY iluSharpen(ILfloat Factor, ILuint Iter); +ILAPI ILboolean ILAPIENTRY iluSwapColours(void); +ILAPI ILboolean ILAPIENTRY iluWave(ILfloat Angle); + +#define iluColorsUsed iluColoursUsed +#define iluSwapColors iluSwapColours +#define iluReplaceColor iluReplaceColour +#define iluScaleColor iluScaleColour + +#ifdef __cplusplus +} +#endif + +#endif // __ILU_H__ +#endif // __ilu_h_ diff --git a/code/external/devil/IL/ilu_region.h b/code/external/devil/IL/ilu_region.h new file mode 100644 index 0000000..b5b3adc --- /dev/null +++ b/code/external/devil/IL/ilu_region.h @@ -0,0 +1,25 @@ +//----------------------------------------------------------------------------- +// +// ImageLib Utility Sources +// Copyright (C) 2000-2002 by Denton Woods +// Last modified: 07/09/2002 <--Y2K Compliant! =] +// +// Filename: src-ILU/src/ilu_region.h +// +// Description: Creates an image region. +// +//----------------------------------------------------------------------------- + +#ifndef ILU_REGION_H +#define ILU_REGION_H + +typedef struct Edge +{ + ILint yUpper; + ILfloat xIntersect, dxPerScan; + struct Edge *next; +} Edge; + + +#endif//ILU_REGION_H + diff --git a/code/external/devil/IL/ilut.h b/code/external/devil/IL/ilut.h new file mode 100644 index 0000000..0b9c68b --- /dev/null +++ b/code/external/devil/IL/ilut.h @@ -0,0 +1,354 @@ +//----------------------------------------------------------------------------- +// +// ImageLib Utility Toolkit Sources +// Copyright (C) 2000-2017 by Denton Woods +// Last modified: 03/07/2009 +// +// Filename: IL/ilut.h +// +// Description: The main include file for ILUT +// +//----------------------------------------------------------------------------- + +// Doxygen comment +/*! \file ilut.h + The main include file for ILUT +*/ + +#ifndef __ilut_h_ +#ifndef __ILUT_H__ + +#define __ilut_h_ +#define __ILUT_H__ + +#include +#include + + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +#define ILUT_VERSION_1_8_0 1 +#define ILUT_VERSION 180 + + +// Attribute Bits +#define ILUT_OPENGL_BIT 0x00000001 +#define ILUT_D3D_BIT 0x00000002 +#define ILUT_ALL_ATTRIB_BITS 0x000FFFFF + + +// Error Types +#define ILUT_INVALID_ENUM 0x0501 +#define ILUT_OUT_OF_MEMORY 0x0502 +#define ILUT_INVALID_VALUE 0x0505 +#define ILUT_ILLEGAL_OPERATION 0x0506 +#define ILUT_INVALID_PARAM 0x0509 +#define ILUT_COULD_NOT_OPEN_FILE 0x050A +#define ILUT_STACK_OVERFLOW 0x050E +#define ILUT_STACK_UNDERFLOW 0x050F +#define ILUT_BAD_DIMENSIONS 0x0511 +#define ILUT_NOT_SUPPORTED 0x0550 + + +// State Definitions +#define ILUT_PALETTE_MODE 0x0600 +#define ILUT_OPENGL_CONV 0x0610 +#define ILUT_D3D_MIPLEVELS 0x0620 +#define ILUT_MAXTEX_WIDTH 0x0630 +#define ILUT_MAXTEX_HEIGHT 0x0631 +#define ILUT_MAXTEX_DEPTH 0x0632 +#define ILUT_GL_USE_S3TC 0x0634 +#define ILUT_D3D_USE_DXTC 0x0634 +#define ILUT_GL_GEN_S3TC 0x0635 +#define ILUT_D3D_GEN_DXTC 0x0635 +#define ILUT_S3TC_FORMAT 0x0705 +#define ILUT_DXTC_FORMAT 0x0705 +#define ILUT_D3D_POOL 0x0706 +#define ILUT_D3D_ALPHA_KEY_COLOR 0x0707 +#define ILUT_D3D_ALPHA_KEY_COLOUR 0x0707 +#define ILUT_FORCE_INTEGER_FORMAT 0x0636 + +//This new state does automatic texture target detection +//if enabled. Currently, only cubemap detection is supported. +//if the current image is no cubemap, the 2d texture is chosen. +#define ILUT_GL_AUTODETECT_TEXTURE_TARGET 0x0807 + + +// Values +#define ILUT_VERSION_NUM IL_VERSION_NUM +#define ILUT_VENDOR IL_VENDOR + +// The different rendering api's...more to be added later? +#define ILUT_OPENGL 0 +#define ILUT_ALLEGRO 1 +#define ILUT_WIN32 2 +#define ILUT_DIRECT3D8 3 +#define ILUT_DIRECT3D9 4 +#define ILUT_X11 5 +#define ILUT_DIRECT3D10 6 + + +#if (defined(_WIN32) || defined(_WIN64)) + #if (defined(IL_USE_PRAGMA_LIBS)) && (!defined(_IL_BUILD_LIBRARY)) + #if defined(_MSC_VER) || defined(__BORLANDC__) + #pragma comment(lib, "ILUT.lib") + #endif + #endif + + #include +#endif + + + + +////////////// +// OpenGL +////////////// + +#ifdef ILUT_USE_OPENGL + #if defined(_MSC_VER) || defined(_WIN32) + //#define WIN32_LEAN_AND_MEAN + #include + #endif//_MSC_VER + + #ifdef __APPLE__ + #include + #include + #else + #include + #include + #endif//__APPLE__ +#endif + + +#ifdef ILUT_USE_WIN32 + //#define WIN32_LEAN_AND_MEAN + #ifdef _DEBUG + #define _CRTDBG_MAP_ALLOC + #include + #ifndef _WIN32_WCE + #include + #endif + #endif + #include +#endif + + +// +// If we can avoid including these in all cases thing tend to break less +// and we can keep all of them defined as available +// +// Kriss +// + +// ImageLib Utility Toolkit's Allegro Functions +#ifdef ILUT_USE_ALLEGRO +// #include +#endif//ILUT_USE_ALLEGRO + +#ifdef ILUT_USE_SDL +// #include +#endif + +#ifdef ILUT_USE_DIRECTX8 + #include +#endif//ILUT_USE_DIRECTX9 + +#ifdef ILUT_USE_DIRECTX9 + #include +#endif//ILUT_USE_DIRECTX9 + +#ifdef ILUT_USE_DIRECTX10 + #pragma warning(push) + #pragma warning(disable : 4201) // Disables 'nonstandard extension used : nameless struct/union' warning + #include + #include + #include + #pragma warning(pop) +#endif//ILUT_USE_DIRECTX10 + +#ifdef ILUT_USE_X11 + #include + #include +#ifdef ILUT_USE_XSHM + #include + #include + #include +#endif//ILUT_USE_XSHM +#endif//ILUT_USE_X11 + + + +//----------------------------------------------------------------------------- +// Functions +//----------------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +// ImageLib Utility Toolkit Functions +ILAPI ILboolean ILAPIENTRY ilutDisable(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilutEnable(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilutGetBoolean(ILenum Mode); +ILAPI void ILAPIENTRY ilutGetBooleanv(ILenum Mode, ILboolean *Param); +ILAPI ILint ILAPIENTRY ilutGetInteger(ILenum Mode); +ILAPI void ILAPIENTRY ilutGetIntegerv(ILenum Mode, ILint *Param); +ILAPI ILstring ILAPIENTRY ilutGetString(ILenum StringName); +ILAPI void ILAPIENTRY ilutInit(void); +ILAPI ILboolean ILAPIENTRY ilutIsDisabled(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilutIsEnabled(ILenum Mode); +ILAPI void ILAPIENTRY ilutPopAttrib(void); +ILAPI void ILAPIENTRY ilutPushAttrib(ILuint Bits); +ILAPI void ILAPIENTRY ilutSetInteger(ILenum Mode, ILint Param); + +ILAPI ILboolean ILAPIENTRY ilutRenderer(ILenum Renderer); + + +// ImageLib Utility Toolkit's OpenGL Functions +#ifdef ILUT_USE_OPENGL + ILAPI GLuint ILAPIENTRY ilutGLBindTexImage(); + ILAPI GLuint ILAPIENTRY ilutGLBindMipmaps(void); + ILAPI ILboolean ILAPIENTRY ilutGLBuildMipmaps(void); + ILAPI GLuint ILAPIENTRY ilutGLLoadImage(ILstring FileName); + ILAPI ILboolean ILAPIENTRY ilutGLScreen(void); + ILAPI ILboolean ILAPIENTRY ilutGLScreenie(void); + ILAPI ILboolean ILAPIENTRY ilutGLSaveImage(ILstring FileName, GLuint TexID); + ILAPI ILboolean ILAPIENTRY ilutGLSubTex2D(GLuint TexID, ILuint XOff, ILuint YOff); + ILAPI ILboolean ILAPIENTRY ilutGLSubTex3D(GLuint TexID, ILuint XOff, ILuint YOff, ILuint ZOff); + ILAPI ILboolean ILAPIENTRY ilutGLSetTex2D(GLuint TexID); + ILAPI ILboolean ILAPIENTRY ilutGLSetTex3D(GLuint TexID); + ILAPI ILboolean ILAPIENTRY ilutGLTexImage(GLuint Level); + ILAPI ILboolean ILAPIENTRY ilutGLSubTex(GLuint TexID, ILuint XOff, ILuint YOff); + + ILAPI ILboolean ILAPIENTRY ilutGLSetTex(GLuint TexID); // Deprecated - use ilutGLSetTex2D. + ILAPI ILboolean ILAPIENTRY ilutGLSubTex(GLuint TexID, ILuint XOff, ILuint YOff); // Use ilutGLSubTex2D. +#endif//ILUT_USE_OPENGL + + +// ImageLib Utility Toolkit's Allegro Functions +#ifdef ILUT_USE_ALLEGRO + #ifdef __cplusplus + extern "C" { + #endif + #include + #ifdef __cplusplus + } + #endif + + ILAPI BITMAP* ILAPIENTRY ilutAllegLoadImage(ILstring FileName); + ILAPI BITMAP* ILAPIENTRY ilutConvertToAlleg(PALETTE Pal); +#endif//ILUT_USE_ALLEGRO + + +// ImageLib Utility Toolkit's SDL Functions +#ifdef ILUT_USE_SDL + ILAPI struct SDL_Surface* ILAPIENTRY ilutConvertToSDLSurface(unsigned int flags); + ILAPI struct SDL_Surface* ILAPIENTRY ilutSDLSurfaceLoadImage(ILstring FileName); + ILAPI ILboolean ILAPIENTRY ilutSDLSurfaceFromBitmap(struct SDL_Surface *Bitmap); +#endif//ILUT_USE_SDL + + +// ImageLib Utility Toolkit's BeOS Functions +#ifdef ILUT_USE_BEOS + ILAPI BBitmap ILAPIENTRY ilutConvertToBBitmap(void); +#endif//ILUT_USE_BEOS + + +// ImageLib Utility Toolkit's Win32 GDI Functions +#ifdef ILUT_USE_WIN32 + ILAPI HBITMAP ILAPIENTRY ilutConvertToHBitmap(HDC hDC); + ILAPI HBITMAP ILAPIENTRY ilutConvertSliceToHBitmap(HDC hDC, ILuint slice); + ILAPI void ILAPIENTRY ilutFreePaddedData(ILubyte *Data); + ILAPI void ILAPIENTRY ilutGetBmpInfo(BITMAPINFO *Info); + ILAPI HPALETTE ILAPIENTRY ilutGetHPal(void); + ILAPI ILubyte* ILAPIENTRY ilutGetPaddedData(void); + ILAPI ILboolean ILAPIENTRY ilutGetWinClipboard(void); + ILAPI ILboolean ILAPIENTRY ilutLoadResource(HINSTANCE hInst, ILint ID, ILstring ResourceType, ILenum Type); + ILAPI ILboolean ILAPIENTRY ilutSetHBitmap(HBITMAP Bitmap); + ILAPI ILboolean ILAPIENTRY ilutSetHPal(HPALETTE Pal); + ILAPI ILboolean ILAPIENTRY ilutSetWinClipboard(void); + ILAPI HBITMAP ILAPIENTRY ilutWinLoadImage(ILstring FileName, HDC hDC); + ILAPI ILboolean ILAPIENTRY ilutWinLoadUrl(ILstring Url); + ILAPI ILboolean ILAPIENTRY ilutWinPrint(ILuint XPos, ILuint YPos, ILuint Width, ILuint Height, HDC hDC); + ILAPI ILboolean ILAPIENTRY ilutWinSaveImage(ILstring FileName, HBITMAP Bitmap); +#endif//ILUT_USE_WIN32 + +// ImageLib Utility Toolkit's DirectX 8 Functions +#ifdef ILUT_USE_DIRECTX8 +// ILAPI void ILAPIENTRY ilutD3D8MipFunc(ILuint NumLevels); + ILAPI struct IDirect3DTexture8* ILAPIENTRY ilutD3D8Texture(struct IDirect3DDevice8 *Device); + ILAPI struct IDirect3DVolumeTexture8* ILAPIENTRY ilutD3D8VolumeTexture(struct IDirect3DDevice8 *Device); + ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromFile(struct IDirect3DDevice8 *Device, char *FileName, struct IDirect3DTexture8 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromFile(struct IDirect3DDevice8 *Device, char *FileName, struct IDirect3DVolumeTexture8 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromFileInMemory(struct IDirect3DDevice8 *Device, void *Lump, ILuint Size, struct IDirect3DTexture8 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromFileInMemory(struct IDirect3DDevice8 *Device, void *Lump, ILuint Size, struct IDirect3DVolumeTexture8 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromFileHandle(struct IDirect3DDevice8 *Device, ILHANDLE File, struct IDirect3DTexture8 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromFileHandle(struct IDirect3DDevice8 *Device, ILHANDLE File, struct IDirect3DVolumeTexture8 **Texture); + // These two are not tested yet. + ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromResource(struct IDirect3DDevice8 *Device, HMODULE SrcModule, char *SrcResource, struct IDirect3DTexture8 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromResource(struct IDirect3DDevice8 *Device, HMODULE SrcModule, char *SrcResource, struct IDirect3DVolumeTexture8 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D8LoadSurface(struct IDirect3DDevice8 *Device, struct IDirect3DSurface8 *Surface); +#endif//ILUT_USE_DIRECTX8 + +#ifdef ILUT_USE_DIRECTX9 + #pragma warning(push) + #pragma warning(disable : 4115) // Disables 'named type definition in parentheses' warning +// ILAPI void ILAPIENTRY ilutD3D9MipFunc(ILuint NumLevels); + ILAPI struct IDirect3DTexture9* ILAPIENTRY ilutD3D9Texture (struct IDirect3DDevice9* Device); + ILAPI struct IDirect3DVolumeTexture9* ILAPIENTRY ilutD3D9VolumeTexture (struct IDirect3DDevice9* Device); + ILAPI struct IDirect3DCubeTexture9* ILAPIENTRY ilutD3D9CubeTexture (struct IDirect3DDevice9* Device); + + ILAPI ILboolean ILAPIENTRY ilutD3D9CubeTexFromFile(struct IDirect3DDevice9 *Device, ILconst_string FileName, struct IDirect3DCubeTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9CubeTexFromFileInMemory(struct IDirect3DDevice9 *Device, void *Lump, ILuint Size, struct IDirect3DCubeTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9CubeTexFromFileHandle(struct IDirect3DDevice9 *Device, ILHANDLE File, struct IDirect3DCubeTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9CubeTexFromResource(struct IDirect3DDevice9 *Device, HMODULE SrcModule, ILconst_string SrcResource, struct IDirect3DCubeTexture9 **Texture); + + ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromFile(struct IDirect3DDevice9 *Device, ILconst_string FileName, struct IDirect3DTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromFile(struct IDirect3DDevice9 *Device, ILconst_string FileName, struct IDirect3DVolumeTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromFileInMemory(struct IDirect3DDevice9 *Device, void *Lump, ILuint Size, struct IDirect3DTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromFileInMemory(struct IDirect3DDevice9 *Device, void *Lump, ILuint Size, struct IDirect3DVolumeTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromFileHandle(struct IDirect3DDevice9 *Device, ILHANDLE File, struct IDirect3DTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromFileHandle(struct IDirect3DDevice9 *Device, ILHANDLE File, struct IDirect3DVolumeTexture9 **Texture); + + // These three are not tested yet. + ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromResource(struct IDirect3DDevice9 *Device, HMODULE SrcModule, ILconst_string SrcResource, struct IDirect3DTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromResource(struct IDirect3DDevice9 *Device, HMODULE SrcModule, ILconst_string SrcResource, struct IDirect3DVolumeTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9LoadSurface(struct IDirect3DDevice9 *Device, struct IDirect3DSurface9 *Surface); + #pragma warning(pop) +#endif//ILUT_USE_DIRECTX9 + +#ifdef ILUT_USE_DIRECTX10 + ILAPI ID3D10Texture2D* ILAPIENTRY ilutD3D10Texture(ID3D10Device *Device); + ILAPI ILboolean ILAPIENTRY ilutD3D10TexFromFile(ID3D10Device *Device, ILconst_string FileName, ID3D10Texture2D **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D10TexFromFileInMemory(ID3D10Device *Device, void *Lump, ILuint Size, ID3D10Texture2D **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D10TexFromResource(ID3D10Device *Device, HMODULE SrcModule, ILconst_string SrcResource, ID3D10Texture2D **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D10TexFromFileHandle(ID3D10Device *Device, ILHANDLE File, ID3D10Texture2D **Texture); +#endif//ILUT_USE_DIRECTX10 + + + +#ifdef ILUT_USE_X11 + ILAPI XImage * ILAPIENTRY ilutXCreateImage( Display* ); + ILAPI Pixmap ILAPIENTRY ilutXCreatePixmap( Display*,Drawable ); + ILAPI XImage * ILAPIENTRY ilutXLoadImage( Display*,char* ); + ILAPI Pixmap ILAPIENTRY ilutXLoadPixmap( Display*,Drawable,char* ); +#ifdef ILUT_USE_XSHM + ILAPI XImage * ILAPIENTRY ilutXShmCreateImage( Display*,XShmSegmentInfo* ); + ILAPI void ILAPIENTRY ilutXShmDestroyImage( Display*,XImage*,XShmSegmentInfo* ); + ILAPI Pixmap ILAPIENTRY ilutXShmCreatePixmap( Display*,Drawable,XShmSegmentInfo* ); + ILAPI void ILAPIENTRY ilutXShmFreePixmap( Display*,Pixmap,XShmSegmentInfo* ); + ILAPI XImage * ILAPIENTRY ilutXShmLoadImage( Display*,char*,XShmSegmentInfo* ); + ILAPI Pixmap ILAPIENTRY ilutXShmLoadPixmap( Display*,Drawable,char*,XShmSegmentInfo* ); +#endif//ILUT_USE_XSHM +#endif//ILUT_USE_X11 + + +#ifdef __cplusplus +} +#endif + +#endif // __ILUT_H__ +#endif // __ilut_h_ diff --git a/code/external/devil/IL/ilut_config.h b/code/external/devil/IL/ilut_config.h new file mode 100644 index 0000000..8b187a4 --- /dev/null +++ b/code/external/devil/IL/ilut_config.h @@ -0,0 +1,26 @@ +#ifndef __ILUT_CONFIG_H__ +#define __ILUT_CONFIG_H__ + +//#define IL_USE_PRAGMA_LIBS + +// Supported APIs (ILUT) + +// +// sorry just +// cant get this one to work under windows +// have disabled for the now +// +// will look at it some more later +// +// Kriss +// +#undef ILUT_USE_ALLEGRO + +#undef ILUT_USE_DIRECTX8 +//#define ILUT_USE_DIRECTX9 +//#define ILUT_USE_DIRECTX10 +#define ILUT_USE_OPENGL +//#define ILUT_USE_SDL +#define ILUT_USE_WIN32 + +#endif//__ILUT_CONFIG_H__ diff --git a/code/external/devil/IL/luadevil.c b/code/external/devil/IL/luadevil.c new file mode 100644 index 0000000..1094e1a --- /dev/null +++ b/code/external/devil/IL/luadevil.c @@ -0,0 +1,393 @@ +/* +** $Id: luadevil.c,v 1.1 2007-02-12 21:03:04 darkyojimbo Exp $ +** Lua stand-alone interpreter +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include + +#define lua_c + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +static lua_State *globalL = NULL; + +static const char *progname = LUA_PROGNAME; + + + +static void lstop (lua_State *L, lua_Debug *ar) { + (void)ar; /* unused arg. */ + lua_sethook(L, NULL, 0, 0); + luaL_error(L, "interrupted!"); +} + + +static void laction (int i) { + signal(i, SIG_DFL); /* if another SIGINT happens before lstop, + terminate process (default action) */ + lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); +} + + +static void print_usage (void) { + fprintf(stderr, + "usage: %s [options] [script [args]].\n" + "Available options are:\n" + " -e stat execute string " LUA_QL("stat") "\n" + " -l name require library " LUA_QL("name") "\n" + " -i enter interactive mode after executing " LUA_QL("script") "\n" + " -v show version information\n" + " -- stop handling options\n" + " - execute stdin and stop handling options\n" + , + progname); + fflush(stderr); +} + + +static void l_message (const char *pname, const char *msg) { + if (pname) fprintf(stderr, "%s: ", pname); + fprintf(stderr, "%s\n", msg); + fflush(stderr); +} + + +static int report (lua_State *L, int status) { + if (status && !lua_isnil(L, -1)) { + const char *msg = lua_tostring(L, -1); + if (msg == NULL) msg = "(error object is not a string)"; + l_message(progname, msg); + lua_pop(L, 1); + } + return status; +} + + +static int traceback (lua_State *L) { + lua_getfield(L, LUA_GLOBALSINDEX, "debug"); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + return 1; + } + lua_getfield(L, -1, "traceback"); + if (!lua_isfunction(L, -1)) { + lua_pop(L, 2); + return 1; + } + lua_pushvalue(L, 1); /* pass error message */ + lua_pushinteger(L, 2); /* skip this function and traceback */ + lua_call(L, 2, 1); /* call debug.traceback */ + return 1; +} + + +static int docall (lua_State *L, int narg, int clear) { + int status; + int base = lua_gettop(L) - narg; /* function index */ + lua_pushcfunction(L, traceback); /* push traceback function */ + lua_insert(L, base); /* put it under chunk and args */ + signal(SIGINT, laction); + status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base); + signal(SIGINT, SIG_DFL); + lua_remove(L, base); /* remove traceback function */ + /* force a complete garbage collection in case of errors */ + if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0); + return status; +} + + +static void print_version (void) { + l_message(NULL, LUA_RELEASE " " LUA_COPYRIGHT); +} + + +static int getargs (lua_State *L, char **argv, int n) { + int narg; + int i; + int argc = 0; + while (argv[argc]) argc++; /* count total number of arguments */ + narg = argc - (n + 1); /* number of arguments to the script */ + luaL_checkstack(L, narg + 3, "too many arguments to script"); + for (i=n+1; i < argc; i++) + lua_pushstring(L, argv[i]); + lua_createtable(L, narg, n + 1); + for (i=0; i < argc; i++) { + lua_pushstring(L, argv[i]); + lua_rawseti(L, -2, i - n); + } + return narg; +} + + +static int dofile (lua_State *L, const char *name) { + int status = luaL_loadfile(L, name) || docall(L, 0, 1); + return report(L, status); +} + + +static int dostring (lua_State *L, const char *s, const char *name) { + int status = luaL_loadbuffer(L, s, strlen(s), name) || docall(L, 0, 1); + return report(L, status); +} + + +static int dolibrary (lua_State *L, const char *name) { + lua_getglobal(L, "require"); + lua_pushstring(L, name); + return report(L, lua_pcall(L, 1, 0, 0)); +} + + +static const char *get_prompt (lua_State *L, int firstline) { + const char *p; + lua_getfield(L, LUA_GLOBALSINDEX, firstline ? "_PROMPT" : "_PROMPT2"); + p = lua_tostring(L, -1); + if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); + lua_pop(L, 1); /* remove global */ + return p; +} + + +static int incomplete (lua_State *L, int status) { + if (status == LUA_ERRSYNTAX) { + size_t lmsg; + const char *msg = lua_tolstring(L, -1, &lmsg); + const char *tp = msg + lmsg - (sizeof(LUA_QL("")) - 1); + if (strstr(msg, LUA_QL("")) == tp) { + lua_pop(L, 1); + return 1; + } + } + return 0; /* else... */ +} + + +static int pushline (lua_State *L, int firstline) { + char buffer[LUA_MAXINPUT]; + char *b = buffer; + size_t l; + const char *prmt = get_prompt(L, firstline); + if (lua_readline(L, b, prmt) == 0) + return 0; /* no input */ + l = strlen(b); + if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ + b[l-1] = '\0'; /* remove it */ + if (firstline && b[0] == '=') /* first line starts with `=' ? */ + lua_pushfstring(L, "return %s", b+1); /* change it to `return' */ + else + lua_pushstring(L, b); + lua_freeline(L, b); + return 1; +} + + +static int loadline (lua_State *L) { + int status; + lua_settop(L, 0); + if (!pushline(L, 1)) + return -1; /* no input */ + for (;;) { /* repeat until gets a complete line */ + status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin"); + if (!incomplete(L, status)) break; /* cannot try to add lines? */ + if (!pushline(L, 0)) /* no more input? */ + return -1; + lua_pushliteral(L, "\n"); /* add a new line... */ + lua_insert(L, -2); /* ...between the two lines */ + lua_concat(L, 3); /* join them */ + } + lua_saveline(L, 1); + lua_remove(L, 1); /* remove line */ + return status; +} + + +static void dotty (lua_State *L) { + int status; + const char *oldprogname = progname; + progname = NULL; + while ((status = loadline(L)) != -1) { + if (status == 0) status = docall(L, 0, 0); + report(L, status); + if (status == 0 && lua_gettop(L) > 0) { /* any result to print? */ + lua_getglobal(L, "print"); + lua_insert(L, 1); + if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0) + l_message(progname, lua_pushfstring(L, + "error calling " LUA_QL("print") " (%s)", + lua_tostring(L, -1))); + } + } + lua_settop(L, 0); /* clear stack */ + fputs("\n", stdout); + fflush(stdout); + progname = oldprogname; +} + + +static int handle_script (lua_State *L, char **argv, int n) { + int status; + const char *fname; + int narg = getargs(L, argv, n); /* collect arguments */ + lua_setglobal(L, "arg"); + fname = argv[n]; + if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) + fname = NULL; /* stdin */ + status = luaL_loadfile(L, fname); + lua_insert(L, -(narg+1)); + if (status == 0) + status = docall(L, narg, 0); + else + lua_pop(L, narg); + return report(L, status); +} + + +/* check that argument has no extra characters at the end */ +#define notail(x) {if ((x)[2] != '\0') return -1;} + + +static int collectargs (char **argv, int *pi, int *pv, int *pe) { + int i; + for (i = 1; argv[i] != NULL; i++) { + if (argv[i][0] != '-') /* not an option? */ + return i; + switch (argv[i][1]) { /* option */ + case '-': + notail(argv[i]); + return (argv[i+1] != NULL ? i+1 : 0); + case '\0': + return i; + case 'i': + notail(argv[i]); + *pi = 1; /* go through */ + case 'v': + notail(argv[i]); + *pv = 1; + break; + case 'e': + *pe = 1; /* go through */ + case 'l': + if (argv[i][2] == '\0') { + i++; + if (argv[i] == NULL) return -1; + } + break; + default: return -1; /* invalid option */ + } + } + return 0; +} + + +static int runargs (lua_State *L, char **argv, int n) { + int i; + for (i = 1; i < n; i++) { + if (argv[i] == NULL) continue; + lua_assert(argv[i][0] == '-'); + switch (argv[i][1]) { /* option */ + case 'e': { + const char *chunk = argv[i] + 2; + if (*chunk == '\0') chunk = argv[++i]; + lua_assert(chunk != NULL); + if (dostring(L, chunk, "=(command line)") != 0) + return 1; + break; + } + case 'l': { + const char *filename = argv[i] + 2; + if (*filename == '\0') filename = argv[++i]; + lua_assert(filename != NULL); + if (dolibrary(L, filename)) + return 1; /* stop if file fails */ + break; + } + default: break; + } + } + return 0; +} + + +static int handle_luainit (lua_State *L) { + const char *init = getenv(LUA_INIT); + if (init == NULL) return 0; /* status OK */ + else if (init[0] == '@') + return dofile(L, init+1); + else + return dostring(L, init, "=" LUA_INIT); +} + + +struct Smain { + int argc; + char **argv; + int status; +}; + + +static int pmain (lua_State *L) { + struct Smain *s = (struct Smain *)lua_touserdata(L, 1); + char **argv = s->argv; + int script; + int has_i = 0, has_v = 0, has_e = 0; + globalL = L; + if (argv[0] && argv[0][0]) progname = argv[0]; + lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */ + luaL_openlibs(L); /* open libraries */ + lua_gc(L, LUA_GCRESTART, 0); + s->status = handle_luainit(L); + if (s->status != 0) return 0; + script = collectargs(argv, &has_i, &has_v, &has_e); + if (script < 0) { /* invalid args? */ + print_usage(); + s->status = 1; + return 0; + } + if (has_v) print_version(); + s->status = runargs(L, argv, (script > 0) ? script : s->argc); + if (s->status != 0) return 0; + if (script) + s->status = handle_script(L, argv, script); + if (s->status != 0) return 0; + if (has_i) + dotty(L); + else if (script == 0 && !has_e && !has_v) { + if (lua_stdin_is_tty()) { + print_version(); + dotty(L); + } + else dofile(L, NULL); /* executes stdin as a file */ + } + return 0; +} + + +int main (int argc, char **argv) { + int status; + struct Smain s; + lua_State *L = lua_open(); /* create state */ + printf("DevIL embedded lua interpreter\n"); +//@TODO: Where the heck is this defined? + //Devil_Init(L); + if (L == NULL) { + l_message(argv[0], "cannot create state: not enough memory"); + return EXIT_FAILURE; + } + s.argc = argc; + s.argv = argv; + status = lua_cpcall(L, &pmain, &s); + report(L, status); + lua_close(L); + return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS; +} + diff --git a/code/external/devil/IL/stamp-h.in b/code/external/devil/IL/stamp-h.in new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/code/external/devil/IL/stamp-h.in @@ -0,0 +1 @@ +timestamp diff --git a/ui/mouse/mouse-00000.png b/ui/mouse/mouse-00000.png new file mode 100644 index 0000000..1a0a1dd Binary files /dev/null and b/ui/mouse/mouse-00000.png differ diff --git a/ui/mouse/mouse-00001.png b/ui/mouse/mouse-00001.png new file mode 100644 index 0000000..faad0a7 Binary files /dev/null and b/ui/mouse/mouse-00001.png differ diff --git a/ui/mouse/mouse-00002.png b/ui/mouse/mouse-00002.png new file mode 100644 index 0000000..fe60aa6 Binary files /dev/null and b/ui/mouse/mouse-00002.png differ diff --git a/ui/mouse/mouse-00003.png b/ui/mouse/mouse-00003.png new file mode 100644 index 0000000..b090705 Binary files /dev/null and b/ui/mouse/mouse-00003.png differ diff --git a/ui/mouse/mouse-00004.png b/ui/mouse/mouse-00004.png new file mode 100644 index 0000000..925e070 Binary files /dev/null and b/ui/mouse/mouse-00004.png differ diff --git a/ui/mouse/mouse-00005.png b/ui/mouse/mouse-00005.png new file mode 100644 index 0000000..399b3d7 Binary files /dev/null and b/ui/mouse/mouse-00005.png differ diff --git a/ui/mouse/mouse-00006.png b/ui/mouse/mouse-00006.png new file mode 100644 index 0000000..e080a6f Binary files /dev/null and b/ui/mouse/mouse-00006.png differ diff --git a/ui/mouse/mouse-00007.png b/ui/mouse/mouse-00007.png new file mode 100644 index 0000000..b5d4624 Binary files /dev/null and b/ui/mouse/mouse-00007.png differ diff --git a/ui/mouse/mouse-00008.png b/ui/mouse/mouse-00008.png new file mode 100644 index 0000000..31f488a Binary files /dev/null and b/ui/mouse/mouse-00008.png differ diff --git a/ui/mouse/mouse-00009.png b/ui/mouse/mouse-00009.png new file mode 100644 index 0000000..44c0332 Binary files /dev/null and b/ui/mouse/mouse-00009.png differ diff --git a/ui/mouse/mouse-00010.png b/ui/mouse/mouse-00010.png new file mode 100644 index 0000000..cdac9aa Binary files /dev/null and b/ui/mouse/mouse-00010.png differ diff --git a/ui/mouse/mouse-00011.png b/ui/mouse/mouse-00011.png new file mode 100644 index 0000000..268d744 Binary files /dev/null and b/ui/mouse/mouse-00011.png differ diff --git a/ui/mouse/mouse-00012.png b/ui/mouse/mouse-00012.png new file mode 100644 index 0000000..9649d77 Binary files /dev/null and b/ui/mouse/mouse-00012.png differ diff --git a/ui/mouse/mouse-00013.png b/ui/mouse/mouse-00013.png new file mode 100644 index 0000000..c045aa2 Binary files /dev/null and b/ui/mouse/mouse-00013.png differ diff --git a/ui/mouse/mouse-00014.png b/ui/mouse/mouse-00014.png new file mode 100644 index 0000000..1dd2ec6 Binary files /dev/null and b/ui/mouse/mouse-00014.png differ diff --git a/ui/mouse/mouse-00015.png b/ui/mouse/mouse-00015.png new file mode 100644 index 0000000..fdb2f90 Binary files /dev/null and b/ui/mouse/mouse-00015.png differ diff --git a/ui/mouse/mouse-00016.png b/ui/mouse/mouse-00016.png new file mode 100644 index 0000000..92504f8 Binary files /dev/null and b/ui/mouse/mouse-00016.png differ diff --git a/ui/mouse/mouse-00017.png b/ui/mouse/mouse-00017.png new file mode 100644 index 0000000..a5a566d Binary files /dev/null and b/ui/mouse/mouse-00017.png differ diff --git a/ui/mouse/mouse-00018.png b/ui/mouse/mouse-00018.png new file mode 100644 index 0000000..5659311 Binary files /dev/null and b/ui/mouse/mouse-00018.png differ diff --git a/ui/mouse/mouse-00019.png b/ui/mouse/mouse-00019.png new file mode 100644 index 0000000..9ddc288 Binary files /dev/null and b/ui/mouse/mouse-00019.png differ diff --git a/ui/mouse/mouse-00020.png b/ui/mouse/mouse-00020.png new file mode 100644 index 0000000..5f2bef4 Binary files /dev/null and b/ui/mouse/mouse-00020.png differ diff --git a/ui/mouse/mouse-00021.png b/ui/mouse/mouse-00021.png new file mode 100644 index 0000000..25680b6 Binary files /dev/null and b/ui/mouse/mouse-00021.png differ diff --git a/ui/mouse/mouse-00022.png b/ui/mouse/mouse-00022.png new file mode 100644 index 0000000..2948551 Binary files /dev/null and b/ui/mouse/mouse-00022.png differ diff --git a/ui/mouse/mouse-00023.png b/ui/mouse/mouse-00023.png new file mode 100644 index 0000000..8895d89 Binary files /dev/null and b/ui/mouse/mouse-00023.png differ diff --git a/ui/mouse/mouse-00024.png b/ui/mouse/mouse-00024.png new file mode 100644 index 0000000..718005b Binary files /dev/null and b/ui/mouse/mouse-00024.png differ diff --git a/ui/mouse/mouse-00025.png b/ui/mouse/mouse-00025.png new file mode 100644 index 0000000..006316a Binary files /dev/null and b/ui/mouse/mouse-00025.png differ diff --git a/ui/mouse/mouse-00026.png b/ui/mouse/mouse-00026.png new file mode 100644 index 0000000..277d9a1 Binary files /dev/null and b/ui/mouse/mouse-00026.png differ diff --git a/ui/mouse/mouse-00027.png b/ui/mouse/mouse-00027.png new file mode 100644 index 0000000..07a9812 Binary files /dev/null and b/ui/mouse/mouse-00027.png differ diff --git a/ui/mouse/mouse-00028.png b/ui/mouse/mouse-00028.png new file mode 100644 index 0000000..6b9a3cb Binary files /dev/null and b/ui/mouse/mouse-00028.png differ diff --git a/ui/mouse/mouse-00029.png b/ui/mouse/mouse-00029.png new file mode 100644 index 0000000..b8edee2 Binary files /dev/null and b/ui/mouse/mouse-00029.png differ diff --git a/ui/mouse/mouse-00030.png b/ui/mouse/mouse-00030.png new file mode 100644 index 0000000..a6d32b2 Binary files /dev/null and b/ui/mouse/mouse-00030.png differ diff --git a/ui/mouse/mouse-00031.png b/ui/mouse/mouse-00031.png new file mode 100644 index 0000000..e32d3ae Binary files /dev/null and b/ui/mouse/mouse-00031.png differ diff --git a/ui/mouse/mouse-00032.png b/ui/mouse/mouse-00032.png new file mode 100644 index 0000000..0ae502d Binary files /dev/null and b/ui/mouse/mouse-00032.png differ diff --git a/ui/mouse/mouse-00033.png b/ui/mouse/mouse-00033.png new file mode 100644 index 0000000..c5b36ea Binary files /dev/null and b/ui/mouse/mouse-00033.png differ diff --git a/ui/mouse/mouse-00034.png b/ui/mouse/mouse-00034.png new file mode 100644 index 0000000..459ff0e Binary files /dev/null and b/ui/mouse/mouse-00034.png differ diff --git a/ui/mouse/mouse-00035.png b/ui/mouse/mouse-00035.png new file mode 100644 index 0000000..b26034f Binary files /dev/null and b/ui/mouse/mouse-00035.png differ diff --git a/ui/mouse/mouse-00036.png b/ui/mouse/mouse-00036.png new file mode 100644 index 0000000..e79377d Binary files /dev/null and b/ui/mouse/mouse-00036.png differ diff --git a/ui/mouse/mouse-00037.png b/ui/mouse/mouse-00037.png new file mode 100644 index 0000000..3b1aa13 Binary files /dev/null and b/ui/mouse/mouse-00037.png differ diff --git a/ui/mouse/mouse-00038.png b/ui/mouse/mouse-00038.png new file mode 100644 index 0000000..0e7bbc7 Binary files /dev/null and b/ui/mouse/mouse-00038.png differ diff --git a/ui/mouse/mouse-00039.png b/ui/mouse/mouse-00039.png new file mode 100644 index 0000000..b25e882 Binary files /dev/null and b/ui/mouse/mouse-00039.png differ diff --git a/ui/mouse/mouse-00040.png b/ui/mouse/mouse-00040.png new file mode 100644 index 0000000..2cce8d9 Binary files /dev/null and b/ui/mouse/mouse-00040.png differ diff --git a/ui/mouse/mouse-00041.png b/ui/mouse/mouse-00041.png new file mode 100644 index 0000000..0acc56d Binary files /dev/null and b/ui/mouse/mouse-00041.png differ diff --git a/ui/mouse/mouse-00042.png b/ui/mouse/mouse-00042.png new file mode 100644 index 0000000..d9129e8 Binary files /dev/null and b/ui/mouse/mouse-00042.png differ diff --git a/ui/mouse/mouse-00043.png b/ui/mouse/mouse-00043.png new file mode 100644 index 0000000..c1ef249 Binary files /dev/null and b/ui/mouse/mouse-00043.png differ diff --git a/ui/mouse/mouse-00044.png b/ui/mouse/mouse-00044.png new file mode 100644 index 0000000..5a61c9f Binary files /dev/null and b/ui/mouse/mouse-00044.png differ diff --git a/ui/mouse/mouse-00045.png b/ui/mouse/mouse-00045.png new file mode 100644 index 0000000..1350ade Binary files /dev/null and b/ui/mouse/mouse-00045.png differ diff --git a/ui/mouse/mouse-00046.png b/ui/mouse/mouse-00046.png new file mode 100644 index 0000000..b5e0c1d Binary files /dev/null and b/ui/mouse/mouse-00046.png differ diff --git a/ui/mouse/mouse-00047.png b/ui/mouse/mouse-00047.png new file mode 100644 index 0000000..8d02314 Binary files /dev/null and b/ui/mouse/mouse-00047.png differ diff --git a/ui/mouse/mouse-00048.png b/ui/mouse/mouse-00048.png new file mode 100644 index 0000000..4459124 Binary files /dev/null and b/ui/mouse/mouse-00048.png differ diff --git a/ui/mouse/mouse-00049.png b/ui/mouse/mouse-00049.png new file mode 100644 index 0000000..3c7d58e Binary files /dev/null and b/ui/mouse/mouse-00049.png differ diff --git a/ui/mouse/mouse-00050.png b/ui/mouse/mouse-00050.png new file mode 100644 index 0000000..92c96b1 Binary files /dev/null and b/ui/mouse/mouse-00050.png differ diff --git a/ui/mouse/mouse-00051.png b/ui/mouse/mouse-00051.png new file mode 100644 index 0000000..24ab030 Binary files /dev/null and b/ui/mouse/mouse-00051.png differ diff --git a/ui/mouse/mouse-00052.png b/ui/mouse/mouse-00052.png new file mode 100644 index 0000000..a76ed16 Binary files /dev/null and b/ui/mouse/mouse-00052.png differ diff --git a/ui/mouse/mouse-00053.png b/ui/mouse/mouse-00053.png new file mode 100644 index 0000000..17de2be Binary files /dev/null and b/ui/mouse/mouse-00053.png differ diff --git a/ui/mouse/mouse-00054.png b/ui/mouse/mouse-00054.png new file mode 100644 index 0000000..753c1fd Binary files /dev/null and b/ui/mouse/mouse-00054.png differ diff --git a/ui/mouse/mouse-00055.png b/ui/mouse/mouse-00055.png new file mode 100644 index 0000000..3254975 Binary files /dev/null and b/ui/mouse/mouse-00055.png differ diff --git a/ui/mouse/mouse-00056.png b/ui/mouse/mouse-00056.png new file mode 100644 index 0000000..b6ad3ac Binary files /dev/null and b/ui/mouse/mouse-00056.png differ diff --git a/ui/mouse/mouse-00057.png b/ui/mouse/mouse-00057.png new file mode 100644 index 0000000..79615c4 Binary files /dev/null and b/ui/mouse/mouse-00057.png differ diff --git a/ui/mouse/mouse-00058.png b/ui/mouse/mouse-00058.png new file mode 100644 index 0000000..9fb1f3a Binary files /dev/null and b/ui/mouse/mouse-00058.png differ diff --git a/ui/mouse/mouse-00059.png b/ui/mouse/mouse-00059.png new file mode 100644 index 0000000..feb62e8 Binary files /dev/null and b/ui/mouse/mouse-00059.png differ diff --git a/ui/mouse/mouse-00060.png b/ui/mouse/mouse-00060.png new file mode 100644 index 0000000..8f4ce72 Binary files /dev/null and b/ui/mouse/mouse-00060.png differ diff --git a/ui/mouse/mouse-00061.png b/ui/mouse/mouse-00061.png new file mode 100644 index 0000000..0d202ba Binary files /dev/null and b/ui/mouse/mouse-00061.png differ diff --git a/ui/mouse/mouse-00062.png b/ui/mouse/mouse-00062.png new file mode 100644 index 0000000..f1a4593 Binary files /dev/null and b/ui/mouse/mouse-00062.png differ diff --git a/ui/mouse/mouse-00063.png b/ui/mouse/mouse-00063.png new file mode 100644 index 0000000..6efb962 Binary files /dev/null and b/ui/mouse/mouse-00063.png differ diff --git a/ui/mouse/mouse-00064.png b/ui/mouse/mouse-00064.png new file mode 100644 index 0000000..04083fd Binary files /dev/null and b/ui/mouse/mouse-00064.png differ diff --git a/ui/mouse/mouse-00065.png b/ui/mouse/mouse-00065.png new file mode 100644 index 0000000..4c7e9dd Binary files /dev/null and b/ui/mouse/mouse-00065.png differ diff --git a/ui/mouse/mouse-00066.png b/ui/mouse/mouse-00066.png new file mode 100644 index 0000000..6a02de5 Binary files /dev/null and b/ui/mouse/mouse-00066.png differ diff --git a/ui/mouse/mouse-00067.png b/ui/mouse/mouse-00067.png new file mode 100644 index 0000000..4863ff9 Binary files /dev/null and b/ui/mouse/mouse-00067.png differ diff --git a/ui/mouse/mouse-00068.png b/ui/mouse/mouse-00068.png new file mode 100644 index 0000000..e4a4d3e Binary files /dev/null and b/ui/mouse/mouse-00068.png differ diff --git a/ui/mouse/mouse-00069.png b/ui/mouse/mouse-00069.png new file mode 100644 index 0000000..6e53962 Binary files /dev/null and b/ui/mouse/mouse-00069.png differ diff --git a/ui/mouse/mouse-00070.png b/ui/mouse/mouse-00070.png new file mode 100644 index 0000000..1ef4adb Binary files /dev/null and b/ui/mouse/mouse-00070.png differ diff --git a/ui/mouse/mouse-00071.png b/ui/mouse/mouse-00071.png new file mode 100644 index 0000000..bd1615f Binary files /dev/null and b/ui/mouse/mouse-00071.png differ diff --git a/ui/mouse/mouse-00072.png b/ui/mouse/mouse-00072.png new file mode 100644 index 0000000..1d3dc2a Binary files /dev/null and b/ui/mouse/mouse-00072.png differ diff --git a/ui/mouse/mouse-00073.png b/ui/mouse/mouse-00073.png new file mode 100644 index 0000000..26923d1 Binary files /dev/null and b/ui/mouse/mouse-00073.png differ diff --git a/ui/mouse/mouse-00074.png b/ui/mouse/mouse-00074.png new file mode 100644 index 0000000..1038a9a Binary files /dev/null and b/ui/mouse/mouse-00074.png differ diff --git a/ui/mouse/mouse-00075.png b/ui/mouse/mouse-00075.png new file mode 100644 index 0000000..a9026db Binary files /dev/null and b/ui/mouse/mouse-00075.png differ diff --git a/ui/mouse/mouse-00076.png b/ui/mouse/mouse-00076.png new file mode 100644 index 0000000..0dbced4 Binary files /dev/null and b/ui/mouse/mouse-00076.png differ diff --git a/ui/mouse/mouse-00077.png b/ui/mouse/mouse-00077.png new file mode 100644 index 0000000..f1418f0 Binary files /dev/null and b/ui/mouse/mouse-00077.png differ diff --git a/ui/mouse/mouse-00078.png b/ui/mouse/mouse-00078.png new file mode 100644 index 0000000..76f72fd Binary files /dev/null and b/ui/mouse/mouse-00078.png differ diff --git a/ui/mouse/mouse-00079.png b/ui/mouse/mouse-00079.png new file mode 100644 index 0000000..2ffdf52 Binary files /dev/null and b/ui/mouse/mouse-00079.png differ diff --git a/ui/mouse/mouse-00080.png b/ui/mouse/mouse-00080.png new file mode 100644 index 0000000..c1cf3f3 Binary files /dev/null and b/ui/mouse/mouse-00080.png differ diff --git a/ui/mouse/mouse-00081.png b/ui/mouse/mouse-00081.png new file mode 100644 index 0000000..a8c98a8 Binary files /dev/null and b/ui/mouse/mouse-00081.png differ diff --git a/ui/mouse/mouse-00082.png b/ui/mouse/mouse-00082.png new file mode 100644 index 0000000..d534683 Binary files /dev/null and b/ui/mouse/mouse-00082.png differ diff --git a/ui/mouse/mouse-00083.png b/ui/mouse/mouse-00083.png new file mode 100644 index 0000000..c273f81 Binary files /dev/null and b/ui/mouse/mouse-00083.png differ diff --git a/ui/mouse/mouse-00084.png b/ui/mouse/mouse-00084.png new file mode 100644 index 0000000..7a4908e Binary files /dev/null and b/ui/mouse/mouse-00084.png differ diff --git a/ui/mouse/mouse-00085.png b/ui/mouse/mouse-00085.png new file mode 100644 index 0000000..2cf674f Binary files /dev/null and b/ui/mouse/mouse-00085.png differ diff --git a/ui/mouse/mouse-00086.png b/ui/mouse/mouse-00086.png new file mode 100644 index 0000000..ef407ed Binary files /dev/null and b/ui/mouse/mouse-00086.png differ diff --git a/ui/mouse/mouse-00087.png b/ui/mouse/mouse-00087.png new file mode 100644 index 0000000..d6ed5d0 Binary files /dev/null and b/ui/mouse/mouse-00087.png differ diff --git a/ui/mouse/mouse-00088.png b/ui/mouse/mouse-00088.png new file mode 100644 index 0000000..77efb17 Binary files /dev/null and b/ui/mouse/mouse-00088.png differ diff --git a/ui/mouse/mouse-00089.png b/ui/mouse/mouse-00089.png new file mode 100644 index 0000000..2405026 Binary files /dev/null and b/ui/mouse/mouse-00089.png differ diff --git a/ui/mouse/mouse-00090.png b/ui/mouse/mouse-00090.png new file mode 100644 index 0000000..196b64a Binary files /dev/null and b/ui/mouse/mouse-00090.png differ diff --git a/ui/mouse/mouse-00091.png b/ui/mouse/mouse-00091.png new file mode 100644 index 0000000..fc3e2ca Binary files /dev/null and b/ui/mouse/mouse-00091.png differ diff --git a/ui/mouse/mouse-00092.png b/ui/mouse/mouse-00092.png new file mode 100644 index 0000000..cb9ee5e Binary files /dev/null and b/ui/mouse/mouse-00092.png differ diff --git a/ui/mouse/mouse-00093.png b/ui/mouse/mouse-00093.png new file mode 100644 index 0000000..87c5bca Binary files /dev/null and b/ui/mouse/mouse-00093.png differ diff --git a/ui/mouse/mouse-00094.png b/ui/mouse/mouse-00094.png new file mode 100644 index 0000000..0d6126d Binary files /dev/null and b/ui/mouse/mouse-00094.png differ diff --git a/ui/mouse/mouse-00095.png b/ui/mouse/mouse-00095.png new file mode 100644 index 0000000..42b492b Binary files /dev/null and b/ui/mouse/mouse-00095.png differ diff --git a/ui/mouse/mouse-00096.png b/ui/mouse/mouse-00096.png new file mode 100644 index 0000000..7ef01a4 Binary files /dev/null and b/ui/mouse/mouse-00096.png differ diff --git a/ui/mouse/mouse-00097.png b/ui/mouse/mouse-00097.png new file mode 100644 index 0000000..18e2785 Binary files /dev/null and b/ui/mouse/mouse-00097.png differ diff --git a/ui/mouse/mouse-00098.png b/ui/mouse/mouse-00098.png new file mode 100644 index 0000000..7375de9 Binary files /dev/null and b/ui/mouse/mouse-00098.png differ diff --git a/ui/mouse/mouse-00099.png b/ui/mouse/mouse-00099.png new file mode 100644 index 0000000..6892f07 Binary files /dev/null and b/ui/mouse/mouse-00099.png differ diff --git a/ui/mouse/mouse-00100.png b/ui/mouse/mouse-00100.png new file mode 100644 index 0000000..121218b Binary files /dev/null and b/ui/mouse/mouse-00100.png differ diff --git a/ui/mouse/mouse-00101.png b/ui/mouse/mouse-00101.png new file mode 100644 index 0000000..c908e32 Binary files /dev/null and b/ui/mouse/mouse-00101.png differ diff --git a/ui/mouse/mouse-00102.png b/ui/mouse/mouse-00102.png new file mode 100644 index 0000000..8d092a5 Binary files /dev/null and b/ui/mouse/mouse-00102.png differ diff --git a/ui/mouse/mouse-00103.png b/ui/mouse/mouse-00103.png new file mode 100644 index 0000000..2000ad9 Binary files /dev/null and b/ui/mouse/mouse-00103.png differ diff --git a/ui/mouse/mouse-00104.png b/ui/mouse/mouse-00104.png new file mode 100644 index 0000000..ed3a20f Binary files /dev/null and b/ui/mouse/mouse-00104.png differ diff --git a/ui/mouse/mouse-00105.png b/ui/mouse/mouse-00105.png new file mode 100644 index 0000000..10b27a9 Binary files /dev/null and b/ui/mouse/mouse-00105.png differ diff --git a/ui/mouse/mouse-00106.png b/ui/mouse/mouse-00106.png new file mode 100644 index 0000000..3eb45d8 Binary files /dev/null and b/ui/mouse/mouse-00106.png differ diff --git a/ui/mouse/mouse-00107.png b/ui/mouse/mouse-00107.png new file mode 100644 index 0000000..532337d Binary files /dev/null and b/ui/mouse/mouse-00107.png differ diff --git a/ui/mouse/mouse-00108.png b/ui/mouse/mouse-00108.png new file mode 100644 index 0000000..15a8ee4 Binary files /dev/null and b/ui/mouse/mouse-00108.png differ diff --git a/ui/mouse/mouse-00109.png b/ui/mouse/mouse-00109.png new file mode 100644 index 0000000..9286224 Binary files /dev/null and b/ui/mouse/mouse-00109.png differ diff --git a/ui/mouse/mouse-00110.png b/ui/mouse/mouse-00110.png new file mode 100644 index 0000000..50e5930 Binary files /dev/null and b/ui/mouse/mouse-00110.png differ diff --git a/ui/mouse/mouse-00111.png b/ui/mouse/mouse-00111.png new file mode 100644 index 0000000..2902d28 Binary files /dev/null and b/ui/mouse/mouse-00111.png differ diff --git a/ui/mouse/mouse-00112.png b/ui/mouse/mouse-00112.png new file mode 100644 index 0000000..1b3fbcf Binary files /dev/null and b/ui/mouse/mouse-00112.png differ diff --git a/ui/mouse/mouse-00113.png b/ui/mouse/mouse-00113.png new file mode 100644 index 0000000..050a2e2 Binary files /dev/null and b/ui/mouse/mouse-00113.png differ diff --git a/ui/mouse/mouse-00114.png b/ui/mouse/mouse-00114.png new file mode 100644 index 0000000..beab4fc Binary files /dev/null and b/ui/mouse/mouse-00114.png differ diff --git a/ui/mouse/mouse-00115.png b/ui/mouse/mouse-00115.png new file mode 100644 index 0000000..15b518d Binary files /dev/null and b/ui/mouse/mouse-00115.png differ diff --git a/ui/mouse/mouse-00116.png b/ui/mouse/mouse-00116.png new file mode 100644 index 0000000..0a3824a Binary files /dev/null and b/ui/mouse/mouse-00116.png differ diff --git a/ui/mouse/mouse-00117.png b/ui/mouse/mouse-00117.png new file mode 100644 index 0000000..5c4b3d0 Binary files /dev/null and b/ui/mouse/mouse-00117.png differ diff --git a/ui/mouse/mouse-00118.png b/ui/mouse/mouse-00118.png new file mode 100644 index 0000000..e0d4134 Binary files /dev/null and b/ui/mouse/mouse-00118.png differ diff --git a/ui/mouse/mouse-00119.png b/ui/mouse/mouse-00119.png new file mode 100644 index 0000000..4bb5b6f Binary files /dev/null and b/ui/mouse/mouse-00119.png differ diff --git a/ui/mouse/mouse-00120.png b/ui/mouse/mouse-00120.png new file mode 100644 index 0000000..53d7f9f Binary files /dev/null and b/ui/mouse/mouse-00120.png differ diff --git a/ui/mouse/mouse-00121.png b/ui/mouse/mouse-00121.png new file mode 100644 index 0000000..bc6b204 Binary files /dev/null and b/ui/mouse/mouse-00121.png differ diff --git a/ui/mouse/mouse-00122.png b/ui/mouse/mouse-00122.png new file mode 100644 index 0000000..81facd4 Binary files /dev/null and b/ui/mouse/mouse-00122.png differ diff --git a/ui/mouse/mouse-00123.png b/ui/mouse/mouse-00123.png new file mode 100644 index 0000000..7967acb Binary files /dev/null and b/ui/mouse/mouse-00123.png differ diff --git a/ui/mouse/mouse-00124.png b/ui/mouse/mouse-00124.png new file mode 100644 index 0000000..76cefb8 Binary files /dev/null and b/ui/mouse/mouse-00124.png differ diff --git a/ui/mouse/mouse-00125.png b/ui/mouse/mouse-00125.png new file mode 100644 index 0000000..438cb5c Binary files /dev/null and b/ui/mouse/mouse-00125.png differ diff --git a/ui/mouse/mouse-00126.png b/ui/mouse/mouse-00126.png new file mode 100644 index 0000000..9f4d9ea Binary files /dev/null and b/ui/mouse/mouse-00126.png differ diff --git a/ui/mouse/mouse-00127.png b/ui/mouse/mouse-00127.png new file mode 100644 index 0000000..dd27507 Binary files /dev/null and b/ui/mouse/mouse-00127.png differ diff --git a/ui/mouse/mouse-00128.png b/ui/mouse/mouse-00128.png new file mode 100644 index 0000000..9150ed0 Binary files /dev/null and b/ui/mouse/mouse-00128.png differ diff --git a/ui/mouse/mouse-00129.png b/ui/mouse/mouse-00129.png new file mode 100644 index 0000000..682578f Binary files /dev/null and b/ui/mouse/mouse-00129.png differ diff --git a/ui/mouse/mouse-00130.png b/ui/mouse/mouse-00130.png new file mode 100644 index 0000000..ea395fa Binary files /dev/null and b/ui/mouse/mouse-00130.png differ diff --git a/ui/mouse/mouse-00131.png b/ui/mouse/mouse-00131.png new file mode 100644 index 0000000..0b9529f Binary files /dev/null and b/ui/mouse/mouse-00131.png differ diff --git a/ui/mouse/mouse-00132.png b/ui/mouse/mouse-00132.png new file mode 100644 index 0000000..7b8d60a Binary files /dev/null and b/ui/mouse/mouse-00132.png differ diff --git a/ui/mouse/mouse-00133.png b/ui/mouse/mouse-00133.png new file mode 100644 index 0000000..84395fb Binary files /dev/null and b/ui/mouse/mouse-00133.png differ diff --git a/ui/mouse/mouse-00134.png b/ui/mouse/mouse-00134.png new file mode 100644 index 0000000..7e4d401 Binary files /dev/null and b/ui/mouse/mouse-00134.png differ diff --git a/ui/mouse/mouse-00135.png b/ui/mouse/mouse-00135.png new file mode 100644 index 0000000..44771eb Binary files /dev/null and b/ui/mouse/mouse-00135.png differ diff --git a/ui/mouse/mouse-00136.png b/ui/mouse/mouse-00136.png new file mode 100644 index 0000000..553c233 Binary files /dev/null and b/ui/mouse/mouse-00136.png differ diff --git a/ui/mouse/mouse-00137.png b/ui/mouse/mouse-00137.png new file mode 100644 index 0000000..f2067f6 Binary files /dev/null and b/ui/mouse/mouse-00137.png differ diff --git a/ui/mouse/mouse-00138.png b/ui/mouse/mouse-00138.png new file mode 100644 index 0000000..c72e110 Binary files /dev/null and b/ui/mouse/mouse-00138.png differ diff --git a/ui/mouse/mouse-00139.png b/ui/mouse/mouse-00139.png new file mode 100644 index 0000000..163d652 Binary files /dev/null and b/ui/mouse/mouse-00139.png differ diff --git a/ui/mouse/mouse-00140.png b/ui/mouse/mouse-00140.png new file mode 100644 index 0000000..23253e0 Binary files /dev/null and b/ui/mouse/mouse-00140.png differ diff --git a/ui/mouse/mouse-00141.png b/ui/mouse/mouse-00141.png new file mode 100644 index 0000000..672d404 Binary files /dev/null and b/ui/mouse/mouse-00141.png differ diff --git a/ui/mouse/mouse-00142.png b/ui/mouse/mouse-00142.png new file mode 100644 index 0000000..e57e922 Binary files /dev/null and b/ui/mouse/mouse-00142.png differ diff --git a/ui/mouse/mouse-00143.png b/ui/mouse/mouse-00143.png new file mode 100644 index 0000000..e8551a0 Binary files /dev/null and b/ui/mouse/mouse-00143.png differ diff --git a/ui/mouse/mouse-00144.png b/ui/mouse/mouse-00144.png new file mode 100644 index 0000000..1d7c6e9 Binary files /dev/null and b/ui/mouse/mouse-00144.png differ diff --git a/ui/mouse/mouse-00145.png b/ui/mouse/mouse-00145.png new file mode 100644 index 0000000..c9eba87 Binary files /dev/null and b/ui/mouse/mouse-00145.png differ diff --git a/ui/mouse/mouse-00146.png b/ui/mouse/mouse-00146.png new file mode 100644 index 0000000..b49f9c9 Binary files /dev/null and b/ui/mouse/mouse-00146.png differ diff --git a/ui/mouse/mouse-00147.png b/ui/mouse/mouse-00147.png new file mode 100644 index 0000000..ce6e263 Binary files /dev/null and b/ui/mouse/mouse-00147.png differ diff --git a/ui/mouse/mouse-00148.png b/ui/mouse/mouse-00148.png new file mode 100644 index 0000000..a3071b0 Binary files /dev/null and b/ui/mouse/mouse-00148.png differ diff --git a/ui/mouse/mouse-00149.png b/ui/mouse/mouse-00149.png new file mode 100644 index 0000000..e3a4b1f Binary files /dev/null and b/ui/mouse/mouse-00149.png differ diff --git a/ui/mouse/mouse-00150.png b/ui/mouse/mouse-00150.png new file mode 100644 index 0000000..fc03ecd Binary files /dev/null and b/ui/mouse/mouse-00150.png differ diff --git a/ui/mouse/mouse-00151.png b/ui/mouse/mouse-00151.png new file mode 100644 index 0000000..7e2f889 Binary files /dev/null and b/ui/mouse/mouse-00151.png differ diff --git a/ui/mouse/mouse-00152.png b/ui/mouse/mouse-00152.png new file mode 100644 index 0000000..62985b0 Binary files /dev/null and b/ui/mouse/mouse-00152.png differ diff --git a/ui/mouse/mouse-00153.png b/ui/mouse/mouse-00153.png new file mode 100644 index 0000000..b63d4e6 Binary files /dev/null and b/ui/mouse/mouse-00153.png differ diff --git a/ui/mouse/mouse-00154.png b/ui/mouse/mouse-00154.png new file mode 100644 index 0000000..e9ac73e Binary files /dev/null and b/ui/mouse/mouse-00154.png differ diff --git a/ui/mouse/mouse-00155.png b/ui/mouse/mouse-00155.png new file mode 100644 index 0000000..1942db4 Binary files /dev/null and b/ui/mouse/mouse-00155.png differ diff --git a/ui/mouse/mouse-00156.png b/ui/mouse/mouse-00156.png new file mode 100644 index 0000000..0e0dc82 Binary files /dev/null and b/ui/mouse/mouse-00156.png differ diff --git a/ui/mouse/mouse-00157.png b/ui/mouse/mouse-00157.png new file mode 100644 index 0000000..e6b28a9 Binary files /dev/null and b/ui/mouse/mouse-00157.png differ diff --git a/ui/mouse/mouse-00158.png b/ui/mouse/mouse-00158.png new file mode 100644 index 0000000..65ce402 Binary files /dev/null and b/ui/mouse/mouse-00158.png differ diff --git a/ui/mouse/mouse-00159.png b/ui/mouse/mouse-00159.png new file mode 100644 index 0000000..275f1a4 Binary files /dev/null and b/ui/mouse/mouse-00159.png differ diff --git a/ui/mouse/mouse-00160.png b/ui/mouse/mouse-00160.png new file mode 100644 index 0000000..768407e Binary files /dev/null and b/ui/mouse/mouse-00160.png differ diff --git a/ui/mouse/mouse-00161.png b/ui/mouse/mouse-00161.png new file mode 100644 index 0000000..0ee103e Binary files /dev/null and b/ui/mouse/mouse-00161.png differ diff --git a/ui/mouse/mouse-00162.png b/ui/mouse/mouse-00162.png new file mode 100644 index 0000000..b413b15 Binary files /dev/null and b/ui/mouse/mouse-00162.png differ diff --git a/ui/mouse/mouse-00163.png b/ui/mouse/mouse-00163.png new file mode 100644 index 0000000..5f0ded5 Binary files /dev/null and b/ui/mouse/mouse-00163.png differ diff --git a/ui/mouse/mouse-00164.png b/ui/mouse/mouse-00164.png new file mode 100644 index 0000000..40d3b5d Binary files /dev/null and b/ui/mouse/mouse-00164.png differ diff --git a/ui/mouse/mouse-00165.png b/ui/mouse/mouse-00165.png new file mode 100644 index 0000000..7efca22 Binary files /dev/null and b/ui/mouse/mouse-00165.png differ diff --git a/ui/mouse/mouse-00166.png b/ui/mouse/mouse-00166.png new file mode 100644 index 0000000..cefbab7 Binary files /dev/null and b/ui/mouse/mouse-00166.png differ diff --git a/ui/mouse/mouse-00167.png b/ui/mouse/mouse-00167.png new file mode 100644 index 0000000..a9a2b71 Binary files /dev/null and b/ui/mouse/mouse-00167.png differ diff --git a/ui/mouse/mouse-00168.png b/ui/mouse/mouse-00168.png new file mode 100644 index 0000000..3a3734a Binary files /dev/null and b/ui/mouse/mouse-00168.png differ diff --git a/ui/mouse/mouse-00169.png b/ui/mouse/mouse-00169.png new file mode 100644 index 0000000..524eb46 Binary files /dev/null and b/ui/mouse/mouse-00169.png differ diff --git a/ui/mouse/mouse-00170.png b/ui/mouse/mouse-00170.png new file mode 100644 index 0000000..798c24d Binary files /dev/null and b/ui/mouse/mouse-00170.png differ diff --git a/ui/mouse/mouse-00171.png b/ui/mouse/mouse-00171.png new file mode 100644 index 0000000..6094095 Binary files /dev/null and b/ui/mouse/mouse-00171.png differ diff --git a/ui/mouse/mouse-00172.png b/ui/mouse/mouse-00172.png new file mode 100644 index 0000000..caaaab1 Binary files /dev/null and b/ui/mouse/mouse-00172.png differ diff --git a/ui/mouse/mouse-00173.png b/ui/mouse/mouse-00173.png new file mode 100644 index 0000000..67f3a54 Binary files /dev/null and b/ui/mouse/mouse-00173.png differ diff --git a/ui/mouse/mouse-00174.png b/ui/mouse/mouse-00174.png new file mode 100644 index 0000000..86915e9 Binary files /dev/null and b/ui/mouse/mouse-00174.png differ diff --git a/ui/mouse/mouse-00175.png b/ui/mouse/mouse-00175.png new file mode 100644 index 0000000..47eeaee Binary files /dev/null and b/ui/mouse/mouse-00175.png differ diff --git a/ui/mouse/mouse-00176.png b/ui/mouse/mouse-00176.png new file mode 100644 index 0000000..29aa292 Binary files /dev/null and b/ui/mouse/mouse-00176.png differ diff --git a/ui/mouse/mouse-00177.png b/ui/mouse/mouse-00177.png new file mode 100644 index 0000000..b5ae87f Binary files /dev/null and b/ui/mouse/mouse-00177.png differ diff --git a/ui/mouse/mouse-00178.png b/ui/mouse/mouse-00178.png new file mode 100644 index 0000000..5e9d6bf Binary files /dev/null and b/ui/mouse/mouse-00178.png differ diff --git a/ui/mouse/mouse-00179.png b/ui/mouse/mouse-00179.png new file mode 100644 index 0000000..547f94c Binary files /dev/null and b/ui/mouse/mouse-00179.png differ diff --git a/ui/mouse/mouse-00180.png b/ui/mouse/mouse-00180.png new file mode 100644 index 0000000..2d4da30 Binary files /dev/null and b/ui/mouse/mouse-00180.png differ diff --git a/ui/mouse/mouse-00181.png b/ui/mouse/mouse-00181.png new file mode 100644 index 0000000..aa21be8 Binary files /dev/null and b/ui/mouse/mouse-00181.png differ diff --git a/ui/mouse/mouse-00182.png b/ui/mouse/mouse-00182.png new file mode 100644 index 0000000..22f8c95 Binary files /dev/null and b/ui/mouse/mouse-00182.png differ diff --git a/ui/mouse/mouse-00183.png b/ui/mouse/mouse-00183.png new file mode 100644 index 0000000..300fb45 Binary files /dev/null and b/ui/mouse/mouse-00183.png differ diff --git a/ui/mouse/mouse-00184.png b/ui/mouse/mouse-00184.png new file mode 100644 index 0000000..9c135fe Binary files /dev/null and b/ui/mouse/mouse-00184.png differ diff --git a/ui/mouse/mouse-00185.png b/ui/mouse/mouse-00185.png new file mode 100644 index 0000000..78d74ec Binary files /dev/null and b/ui/mouse/mouse-00185.png differ diff --git a/ui/mouse/mouse-00186.png b/ui/mouse/mouse-00186.png new file mode 100644 index 0000000..106a189 Binary files /dev/null and b/ui/mouse/mouse-00186.png differ diff --git a/ui/mouse/mouse-00187.png b/ui/mouse/mouse-00187.png new file mode 100644 index 0000000..6e97290 Binary files /dev/null and b/ui/mouse/mouse-00187.png differ diff --git a/ui/mouse/mouse-00188.png b/ui/mouse/mouse-00188.png new file mode 100644 index 0000000..f95ea94 Binary files /dev/null and b/ui/mouse/mouse-00188.png differ diff --git a/ui/mouse/mouse-00189.png b/ui/mouse/mouse-00189.png new file mode 100644 index 0000000..5f9db43 Binary files /dev/null and b/ui/mouse/mouse-00189.png differ diff --git a/ui/mouse/mouse-00190.png b/ui/mouse/mouse-00190.png new file mode 100644 index 0000000..dde54a7 Binary files /dev/null and b/ui/mouse/mouse-00190.png differ diff --git a/ui/mouse/mouse-00191.png b/ui/mouse/mouse-00191.png new file mode 100644 index 0000000..ea7bfe3 Binary files /dev/null and b/ui/mouse/mouse-00191.png differ diff --git a/ui/mouse/mouse-00192.png b/ui/mouse/mouse-00192.png new file mode 100644 index 0000000..106f3fe Binary files /dev/null and b/ui/mouse/mouse-00192.png differ diff --git a/ui/mouse/mouse-00193.png b/ui/mouse/mouse-00193.png new file mode 100644 index 0000000..191601d Binary files /dev/null and b/ui/mouse/mouse-00193.png differ diff --git a/ui/mouse/mouse-00194.png b/ui/mouse/mouse-00194.png new file mode 100644 index 0000000..911e19f Binary files /dev/null and b/ui/mouse/mouse-00194.png differ diff --git a/ui/mouse/mouse-00195.png b/ui/mouse/mouse-00195.png new file mode 100644 index 0000000..788e885 Binary files /dev/null and b/ui/mouse/mouse-00195.png differ diff --git a/ui/mouse/mouse-00196.png b/ui/mouse/mouse-00196.png new file mode 100644 index 0000000..6280616 Binary files /dev/null and b/ui/mouse/mouse-00196.png differ diff --git a/ui/mouse/mouse-00197.png b/ui/mouse/mouse-00197.png new file mode 100644 index 0000000..bcf150a Binary files /dev/null and b/ui/mouse/mouse-00197.png differ diff --git a/ui/mouse/mouse-00198.png b/ui/mouse/mouse-00198.png new file mode 100644 index 0000000..18826b1 Binary files /dev/null and b/ui/mouse/mouse-00198.png differ diff --git a/ui/mouse/mouse-00199.png b/ui/mouse/mouse-00199.png new file mode 100644 index 0000000..96ad600 Binary files /dev/null and b/ui/mouse/mouse-00199.png differ diff --git a/ui/mouse/mouse-00200.png b/ui/mouse/mouse-00200.png new file mode 100644 index 0000000..e67c232 Binary files /dev/null and b/ui/mouse/mouse-00200.png differ diff --git a/ui/mouse/mouse-00201.png b/ui/mouse/mouse-00201.png new file mode 100644 index 0000000..e7de6e5 Binary files /dev/null and b/ui/mouse/mouse-00201.png differ diff --git a/ui/mouse/mouse-00202.png b/ui/mouse/mouse-00202.png new file mode 100644 index 0000000..29529eb Binary files /dev/null and b/ui/mouse/mouse-00202.png differ diff --git a/ui/mouse/mouse-00203.png b/ui/mouse/mouse-00203.png new file mode 100644 index 0000000..7b509c5 Binary files /dev/null and b/ui/mouse/mouse-00203.png differ diff --git a/ui/mouse/mouse-00204.png b/ui/mouse/mouse-00204.png new file mode 100644 index 0000000..cdaafd6 Binary files /dev/null and b/ui/mouse/mouse-00204.png differ diff --git a/ui/mouse/mouse-00205.png b/ui/mouse/mouse-00205.png new file mode 100644 index 0000000..7d6cd18 Binary files /dev/null and b/ui/mouse/mouse-00205.png differ diff --git a/ui/mouse/mouse-00206.png b/ui/mouse/mouse-00206.png new file mode 100644 index 0000000..164153e Binary files /dev/null and b/ui/mouse/mouse-00206.png differ diff --git a/ui/mouse/mouse-00207.png b/ui/mouse/mouse-00207.png new file mode 100644 index 0000000..0b83719 Binary files /dev/null and b/ui/mouse/mouse-00207.png differ diff --git a/ui/mouse/mouse-00208.png b/ui/mouse/mouse-00208.png new file mode 100644 index 0000000..bade3aa Binary files /dev/null and b/ui/mouse/mouse-00208.png differ diff --git a/ui/mouse/mouse-00209.png b/ui/mouse/mouse-00209.png new file mode 100644 index 0000000..c6e95c9 Binary files /dev/null and b/ui/mouse/mouse-00209.png differ diff --git a/ui/mouse/mouse-00210.png b/ui/mouse/mouse-00210.png new file mode 100644 index 0000000..34b0ec8 Binary files /dev/null and b/ui/mouse/mouse-00210.png differ diff --git a/ui/mouse/mouse-00211.png b/ui/mouse/mouse-00211.png new file mode 100644 index 0000000..ca92476 Binary files /dev/null and b/ui/mouse/mouse-00211.png differ diff --git a/ui/mouse/mouse-00212.png b/ui/mouse/mouse-00212.png new file mode 100644 index 0000000..04efc76 Binary files /dev/null and b/ui/mouse/mouse-00212.png differ diff --git a/ui/mouse/mouse-00213.png b/ui/mouse/mouse-00213.png new file mode 100644 index 0000000..2f98256 Binary files /dev/null and b/ui/mouse/mouse-00213.png differ diff --git a/ui/mouse/mouse-00214.png b/ui/mouse/mouse-00214.png new file mode 100644 index 0000000..3ae65a5 Binary files /dev/null and b/ui/mouse/mouse-00214.png differ diff --git a/ui/mouse/mouse-00215.png b/ui/mouse/mouse-00215.png new file mode 100644 index 0000000..40e1827 Binary files /dev/null and b/ui/mouse/mouse-00215.png differ diff --git a/ui/mouse/mouse-00216.png b/ui/mouse/mouse-00216.png new file mode 100644 index 0000000..fab0b12 Binary files /dev/null and b/ui/mouse/mouse-00216.png differ diff --git a/ui/mouse/mouse-00217.png b/ui/mouse/mouse-00217.png new file mode 100644 index 0000000..53ba77d Binary files /dev/null and b/ui/mouse/mouse-00217.png differ diff --git a/ui/mouse/mouse-00218.png b/ui/mouse/mouse-00218.png new file mode 100644 index 0000000..686a302 Binary files /dev/null and b/ui/mouse/mouse-00218.png differ diff --git a/ui/mouse/mouse-00219.png b/ui/mouse/mouse-00219.png new file mode 100644 index 0000000..94a1b26 Binary files /dev/null and b/ui/mouse/mouse-00219.png differ diff --git a/ui/mouse/mouse-00220.png b/ui/mouse/mouse-00220.png new file mode 100644 index 0000000..fb6181c Binary files /dev/null and b/ui/mouse/mouse-00220.png differ diff --git a/ui/mouse/mouse-00221.png b/ui/mouse/mouse-00221.png new file mode 100644 index 0000000..2d663a5 Binary files /dev/null and b/ui/mouse/mouse-00221.png differ diff --git a/ui/title.tga b/ui/title.tga new file mode 100644 index 0000000..ab58f6f Binary files /dev/null and b/ui/title.tga differ