diff --git a/AgentSvc/AgentSvc.cpp b/AgentSvc/AgentSvc.cpp index 966c6c6..d3bf2d1 100644 --- a/AgentSvc/AgentSvc.cpp +++ b/AgentSvc/AgentSvc.cpp @@ -13,7 +13,8 @@ #include /* _beginthread, _endthread */ #include -#include "AgentSvc_i.c" +//#include "AgentSvc_i.c" + #include diff --git a/AgentSvc/AgentSvc.h b/AgentSvc/AgentSvc.h old mode 100755 new mode 100644 diff --git a/AgentSvc/AgentSvc.vcxproj b/AgentSvc/AgentSvc.vcxproj index bb0e466..1fbc3cd 100644 --- a/AgentSvc/AgentSvc.vcxproj +++ b/AgentSvc/AgentSvc.vcxproj @@ -17,27 +17,27 @@ {D6AF1D9D-D4B3-4FEC-8EC3-166406A83AE4} MFCProj - 8.1 + 10.0 Application Static Unicode - v140_xp + v142 Application false Static NotSet - v140_xp + v142 Application Static MultiByte - v140_xp + v142 diff --git a/AgentSvr/AgentSvr.vcxproj b/AgentSvr/AgentSvr.vcxproj index c21caed..cf766a9 100644 --- a/AgentSvr/AgentSvr.vcxproj +++ b/AgentSvr/AgentSvr.vcxproj @@ -20,30 +20,30 @@ {E1FF5388-2AF5-4789-B5C2-DB40C41916CA} - 8.1 + 10.0 Application false Unicode - v140_xp + v142 Application false - v140_xp + v142 Application false - v140_xp + v142 MultiByte Application false - v140_xp + v142 diff --git a/MessageMaker/LmItemDefs.cpp b/MessageMaker/LmItemDefs.cpp index 2745f6f..b68a05a 100644 --- a/MessageMaker/LmItemDefs.cpp +++ b/MessageMaker/LmItemDefs.cpp @@ -674,58 +674,61 @@ void convert_hton(T x, void* ptr) { void FASTCALL LyraItem::ConvertStateToNetwork(void* ssptr) { + + //initializing before switch + lyra_item_ward_t ward{}; + lyra_item_missile_t missile{}; + lyra_item_amulet_t amulet{}; + lyra_item_area_effect_t area_effect{}; + lyra_item_support_t support{}; + lyra_item_essence_t essence{}; + lyra_item_meta_essence_t meta_essence{}; + lyra_item_scroll_t scroll{}; + lyra_item_teleporter_t teleporter{}; + lyra_item_train_support_t train_support{}; + lyra_item_gratitude_t gratitude{}; + lyra_item_meta_essence_nexus_t nexus{}; + lyra_item_portkey_t portkey{}; + // switch on function, convert if necessary switch (StateFunction(ssptr)) { - case WARD_FUNCTION: - lyra_item_ward_t ward; - convert_hton(ward, ssptr); - break; - case MISSILE_FUNCTION: - lyra_item_missile_t missile; + case WARD_FUNCTION: + convert_hton(ward, ssptr); + break; + case MISSILE_FUNCTION: convert_hton(missile, ssptr); break; - case AMULET_FUNCTION: - lyra_item_amulet_t amulet; + case AMULET_FUNCTION: convert_hton(amulet, ssptr); break; - case AREA_EFFECT_FUNCTION: - lyra_item_area_effect_t area_effect; + case AREA_EFFECT_FUNCTION: convert_hton(area_effect, ssptr); break; case ESSENCE_FUNCTION: - lyra_item_essence_t essence; convert_hton(essence, ssptr); break; case SUPPORT_FUNCTION: - lyra_item_support_t support; convert_hton(support, ssptr); break; case META_ESSENCE_FUNCTION: - lyra_item_meta_essence_t meta_essence; convert_hton(meta_essence, ssptr); break; - case SCROLL_FUNCTION: - lyra_item_scroll_t scroll; + case SCROLL_FUNCTION: convert_hton(scroll, ssptr); break; - case TELEPORTER_FUNCTION: - lyra_item_teleporter_t teleporter; + case TELEPORTER_FUNCTION: convert_hton(teleporter, ssptr); break; - case SUPPORT_TRAIN_FUNCTION: - lyra_item_train_support_t train_support; + case SUPPORT_TRAIN_FUNCTION: convert_hton(train_support, ssptr); break; case GRATITUDE_FUNCTION: - lyra_item_gratitude_t gratitude; convert_hton(gratitude, ssptr); break; case META_ESSENCE_NEXUS_FUNCTION: - lyra_item_meta_essence_nexus_t nexus; convert_hton(nexus, ssptr); break; case PORTKEY_FUNCTION: - lyra_item_portkey_t portkey; convert_hton(portkey, ssptr); break; case NO_FUNCTION: // should be an error diff --git a/MessageMaker/MessageMaker.vcxproj b/MessageMaker/MessageMaker.vcxproj index 2efb035..777296a 100644 --- a/MessageMaker/MessageMaker.vcxproj +++ b/MessageMaker/MessageMaker.vcxproj @@ -20,29 +20,31 @@ {B67BDCBE-DDF6-4BD2-882D-7C0D4BAB1560} - 8.1 + + 10.0 StaticLibrary false - v140_xp + v142 StaticLibrary false - v140_xp + v142 StaticLibrary false Unicode - v140_xp + v142 StaticLibrary false - v140_xp + + v142 @@ -159,6 +161,9 @@ Sync false true + + stdcpp17 + stdc17 0x0409 diff --git a/MessageMaker/MessageMaker.vcxproj.filters b/MessageMaker/MessageMaker.vcxproj.filters index cca5100..04681f8 100644 --- a/MessageMaker/MessageMaker.vcxproj.filters +++ b/MessageMaker/MessageMaker.vcxproj.filters @@ -372,6 +372,7 @@ Header Files + Header Files diff --git a/Underlight/.json b/Underlight/.json new file mode 100644 index 0000000..22bfdf4 --- /dev/null +++ b/Underlight/.json @@ -0,0 +1,39 @@ +{ + "welcome_ai": 0, + "sound": 1, + "extra_scroll": 1, + "resolution": 1024, + "sound_active": 1, + "music_active": 1, + "reverse": 0, + "autoreject": 0, + "autorejoin": 1, + "nametags": 1, + "multiline": 0, + "footsteps": 1, + "art_prompts": 1, + "mouselook": 0, + "invertmouse": 0, + "log_chat": 1, + "effects_volume": 10, + "turnrate": 13, + "music_volume": 10, + "speech_color": 3, + "whisper_color": 3, + "message_color": 2, + "bg_color": 0, + "fullscreen": 0, + "classic_chat": 0, + "autorun": 1, + "adult_filter": 1, + "name": "", + "password": "", + "avatar": "AAAAAAAAAAA=", + "num_bungholes": 0, + "ignore_list": [], + "number_keys_mapped": 57, + "key_mappings": "MQAAAEMAAABgAAAAMgAAACkAAAD/////SQAAAAMAAAD/////RAAAABsAAAD/////RQAAAAUAAAD/////RwAAAAYAAAD/////TAAAAEMAAAAzAAAATQAAAAgAAAD/////TgAAACQAAAD/////LAAAACUAAAD/////LgAAACYAAAD/////UgAAAAkAAAD/////PQAAAAoAAAD/////VAAAAAsAAAD/////3gAAAAcAAAD/////JgAAAAwAAAD/////QwAAAA0AAAD/////WAAAAA4AAAD/////JAAAABAAAAD/////IwAAAA8AAAD/////VwAAABEAAAD/////UwAAABIAAAD/////JQAAABMAAAD/////JwAAABQAAAD/////EQAAABcAAAD/////IAAAABgAAAD/////EgAAABYAAAD/////EAAAABUAAAD/////AQAAABcAAAD/////BAAAABwAAAD/////AgAAABYAAAD/////3AAAABwAAAD/////QQAAABoAAAD/////SwAAACcAAAD/////IQAAAB0AAAD/////IgAAAB4AAAD/////bwAAAB8AAAD/////agAAACAAAAD/////bQAAACEAAAD/////awAAACIAAAD/////RgAAAAAAAAD/////TwAAACoAAAD/////UAAAAEMAAAAAAAAAUQAAAEMAAAAFAAAAWQAAAEMAAAAGAAAAVQAAAEMAAAAlAAAAVgAAAEMAAABAAAAAQgAAAAEAAAD/////vwAAAEMAAAAOAAAAWgAAACwAAAD/////wAAAAC0AAAD/////LQAAAC4AAAD/////WwAAAC8AAAD/////XQAAADIAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "num_buddies": 0, + "buddies": [], + "macros": [null, null, null, null, null, null, null, null, null, null] +} \ No newline at end of file diff --git a/Underlight/Keyboard.cpp b/Underlight/Keyboard.cpp index f7a14f2..75559dd 100644 --- a/Underlight/Keyboard.cpp +++ b/Underlight/Keyboard.cpp @@ -5,6 +5,7 @@ #define STRICT #include "Central.h" +#include #include #include #include "cDDraw.h" @@ -1288,7 +1289,18 @@ void Realm_OnKey(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UINT flags) case LyraKeyboard::STRAFE: keyboard[Keystates::STRAFE] = 1; break; case LyraKeyboard::SIDESTEP_LEFT: keyboard[Keystates::SIDESTEP_LEFT] = 1; break; case LyraKeyboard::SIDESTEP_RIGHT: keyboard[Keystates::SIDESTEP_RIGHT] = 1; break; - case LyraKeyboard::MOUSE_LOOK: mouselooking = !options.mouselook; break; + + case LyraKeyboard::MOUSE_LOOK: + { + //flip the mouse looking sign if false to true , if true to false. + mouse_look.looking = !mouse_look.looking; + //if mouselook is on, display msg + if (mouse_look.looking) { display->DisplayMessage("Mouse Look Enabled.", false); } + //if mouselooks is off tell user via dsp msg + else { display->DisplayMessage("Mouse look Disabled.", false); } + break; + } + case LyraKeyboard::WAVE: player->SetWaving(true); break; } @@ -1735,7 +1747,8 @@ void Realm_OnKey(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UINT flags) cp->SetUsing(false); break; case LyraKeyboard::MOUSE_LOOK: - mouselooking = options.mouselook; + + mouselooking = !mouselooking; SaveInGameRegistryOptionValues(); break; case LyraKeyboard::SHOW_RANKS: diff --git a/Underlight/Keyboard.h b/Underlight/Keyboard.h index e9ee32f..91e6277 100644 --- a/Underlight/Keyboard.h +++ b/Underlight/Keyboard.h @@ -34,7 +34,6 @@ const int num_keystates = 15; void __cdecl InitKeyboard(void); void __cdecl DeInitKeyboard(void); - ////////////////////////////////////////////////////////////////// // Keyboard message handlers diff --git a/Underlight/Main.cpp b/Underlight/Main.cpp index 9f69efc..906c11f 100644 --- a/Underlight/Main.cpp +++ b/Underlight/Main.cpp @@ -22,6 +22,10 @@ #include "cPostQuest.h" #include "cReportGoal.h" #include "Interface.h" +#include +#include +#include "Mouse/MouseClass.h" + //#include "RogerWilco.h" ///////////////////////////////////////////////// @@ -47,6 +51,43 @@ extern bool IsLyraColors; extern bool show_splash; const int MIN_FRAME_TIMER = WM_USER + 9234; extern unsigned int show_splash_end_time; +//initialise base mouseclass +static MouseClass mouse; + +// function for finding mouse:) +bool WindowContainer() +{ + //generic bool for if mouse is found + static bool raw_input_initialized = false; + //if it hasn't been found yet. + if (!raw_input_initialized) + { + // make default raw input device + RAWINPUTDEVICE rid; + + //assign basic info to device info + rid.usUsagePage = 0x01; //typical usage group for input + rid.usUsage = 0x02; // mouse + rid.dwFlags = 0; //default + rid.hwndTarget = NULL; // default + + //register device with windows, see if it finds it. + if (RegisterRawInputDevices(&rid, 1, sizeof(rid)) == FALSE) + { + DebugOut("Failed to register raw input devices"); + exit(-1); + //registration failled. call GetLastError for cause of error + } + else + { + //otherwise we found it! yay + raw_input_initialized = true; + DebugOut("Mouse should be initiatilzed"); + } + //return the mouse + return raw_input_initialized; + } +} ///////////////////////////////////////////////// // Functions @@ -80,6 +121,9 @@ int PASCAL WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, show_splash = true; show_splash_end_time = LyraTime() + 4600; + //go get the mouse ready + WindowContainer(); + for (;;) { // process messages until they're gone @@ -100,6 +144,27 @@ int PASCAL WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, case WM_MOUSEMOVE: last_keystroke = LyraTime(); break; + case WM_INPUT: //rawmouse mesg worker + { + //check all msgs + while (!mouse.EventBufferIsEmpty()) + { + //make a mosue event from mouseclass raw input + MouseEvent me = mouse.ReadEvent(); + if (me.GetType() == MouseEvent::EventType::RAW_MOVE) //if msg is actually a raw movement + { + //set our helper to this mouse event for use later + MeHelper::SetME(me); + // rest of this is to spam the debug chat window in visualstudio the relative cords. + std::string outmsg = "x: " + std::to_string(me.GetPosX()); + outmsg += ", Y: " + std::to_string(me.GetPosY()); + outmsg += "\n"; + OutputDebugStringA(outmsg.c_str()); + + } + } + break; + } } if (!IsLyraDialogMessage(&msg) && @@ -110,6 +175,7 @@ int PASCAL WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, TranslateMessage(&msg); DispatchMessage(&msg); } + } else // no messages, or frame timer CreateFrame(); @@ -118,6 +184,7 @@ int PASCAL WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, LRESULT WINAPI WindowProc ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { + static HCURSOR hCursor = LoadCursor(NULL,IDC_ARROW); // for cursor reset if (exiting) // ignore game messages while exiting @@ -154,6 +221,29 @@ LRESULT WINAPI WindowProc ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara CreateFrame(); break; + + case WM_INPUT: + { + UINT dataSize = 0; + + GetRawInputData(reinterpret_cast(lParam), RID_INPUT, NULL, &dataSize, sizeof(RAWINPUTHEADER)); + + if (dataSize > 0) + { + std::unique_ptr rawdata = std::make_unique(dataSize); + if (GetRawInputData(reinterpret_cast(lParam), RID_INPUT, rawdata.get(), &dataSize, sizeof(RAWINPUTHEADER)) == dataSize) + { + RAWINPUT* raw = reinterpret_cast(rawdata.get()); + if (raw->header.dwType == RIM_TYPEMOUSE) + { + mouse.OnMouseMoveRaw(raw->data.mouse.lLastX, raw->data.mouse.lLastY); + } + } + } + + return DefWindowProc(hWnd, message, wParam, lParam); + break; + } #ifndef AGENT case WM_QUERYOPEN: if (!IsLyraColors) diff --git a/Underlight/Main.h b/Underlight/Main.h index 3bbe25b..171cf86 100644 --- a/Underlight/Main.h +++ b/Underlight/Main.h @@ -7,6 +7,9 @@ #include "Central.h" +#include "MeHelper.h" //mouse event helper, to swipe ME from proc + + ////////////////////////////////////////////////////////////////// // Constants @@ -19,5 +22,6 @@ LRESULT WINAPI WindowProc ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara LRESULT WINAPI AgentWindowProc ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); static void ExitCallback (void* value); +bool WindowContainer(); #endif diff --git a/Underlight/MeHelper.cpp b/Underlight/MeHelper.cpp new file mode 100644 index 0000000..ec2911d --- /dev/null +++ b/Underlight/MeHelper.cpp @@ -0,0 +1,27 @@ +#include "MeHelper.h" + +// returns the mouse event saved here. + MouseEvent MeHelper::GetME() { + return me; + } + + //sets mouseevent + void MeHelper::SetME(MouseEvent MEIN) + { + //check for movements above or equal 3 + if (MEIN.GetPosX() >= 3 || MEIN.GetPosX() <= 3 || MEIN.GetPosY() >= 3 || MEIN.GetPosY() <= 3) + { + //yay passed, so save it. + me = MEIN; + } + else + { + //reset to zero + me.SetPosX(0); + me.SetPosY(0); + } + + } + + + diff --git a/Underlight/MeHelper.h b/Underlight/MeHelper.h new file mode 100644 index 0000000..e40a4fa --- /dev/null +++ b/Underlight/MeHelper.h @@ -0,0 +1,11 @@ +#pragma once +#include ".\Mouse\MouseClass.h" + +//mouse event helper +class MeHelper { +public: + static MouseEvent GetME(); //returns the event currently held + static void SetME(MouseEvent MEIN); //sets event +private: + static inline MouseEvent me; // holds event static, and inline:) +}; \ No newline at end of file diff --git a/Underlight/Mouse.cpp b/Underlight/Mouse.cpp index b30a8a0..bebadd6 100644 --- a/Underlight/Mouse.cpp +++ b/Underlight/Mouse.cpp @@ -25,6 +25,8 @@ #include "cLevel.h" #include "Move.h" +#include +#include ///////////////////////////////////////////////// // External Global Variables @@ -300,8 +302,12 @@ void Realm_OnRButtonUp( HWND hWnd,WORD x, WORD y, WORD fwKeys ) } +static MouseClass mouse; void Realm_OnMouseMove(HWND hWnd, WORD x, WORD y, WORD fwKeys) { + + //mouse.OnMouseMove(x, y); + if (mouselooking) { StopMouseLook(); @@ -329,6 +335,7 @@ void Realm_OnMouseMove(HWND hWnd, WORD x, WORD y, WORD fwKeys) static void StartMouseMove(int x, int y) { mouse_move.moving = true; + if (x >= cDD->ViewX() || y >= cDD->ViewY()) return; @@ -374,27 +381,30 @@ void StopMouseLook(void) mouse_look.right = mouse_look.shift = mouse_look.looking = false; mouse_look.xratio = 1.0f; mouse_look.yratio = 1.0f; + + mouse_look.looking = false; } static void StartMouseLook(int x, int y) { mouse_look.looking = true; - - if (x >= cDD->ViewX() || y >= cDD->ViewY()) - return; - + + + /* using rawinput relative cords, via mouseclass/mouseevent. mouse_look.yratio = 1.0f; - int y_ratio = (y*11)/cDD->ViewY(); + int y_ratio = (mouse.GetPosY()*11)/cDD->ViewY(); switch (y_ratio) { - case 0: mouse_look.up = true; break; + case 0: mouse_look.up = true; break; case 1: mouse_look.up = true; mouse_look.yratio = 0.5f; break; case 2: mouse_look.up = true; mouse_look.yratio = 0.2f; break; case 8: mouse_look.down = true; mouse_look.yratio = 0.2f; break; case 9: mouse_look.down = true; mouse_look.yratio = 0.5f; break; case 10: mouse_look.down = true; break; - } + + } + if ((mouse_look.up || mouse_look.down) && options.invertmouse) { mouse_look.up = !mouse_look.up; @@ -402,7 +412,8 @@ static void StartMouseLook(int x, int y) } mouse_look.xratio = 1.0f; - int x_ratio = (x*17)/cDD->ViewX(); + int x_ratio = (mouse.GetPosX()*17)/cDD->ViewX(); + switch (x_ratio) { case 0: mouse_look.left = mouse_look.shift = true; break; @@ -415,14 +426,9 @@ static void StartMouseLook(int x, int y) case 11: mouse_look.right = true; mouse_look.xratio = 0.1f; break; case 12: mouse_look.right = true; mouse_look.xratio = 0.25f; break; case 13: mouse_look.right = true; mouse_look.xratio = 0.4f; break; - case 14: mouse_look.right = true; mouse_look.xratio = 0.65f; break; + case 15: mouse_look.right = true; break; case 16: mouse_look.right = mouse_look.shift = true; break; - } + }*/ return; } - - - - - diff --git a/Underlight/Mouse.h b/Underlight/Mouse.h index df1e5ae..9f66cd4 100644 --- a/Underlight/Mouse.h +++ b/Underlight/Mouse.h @@ -6,7 +6,6 @@ #define MOUSE_H #include "Central.h" - ////////////////////////////////////////////////////////////////// // New Window Messages diff --git a/Underlight/Mouse/MouseClass.cpp b/Underlight/Mouse/MouseClass.cpp new file mode 100644 index 0000000..83ee363 --- /dev/null +++ b/Underlight/Mouse/MouseClass.cpp @@ -0,0 +1,144 @@ +#include "MouseClass.h" + + +//mouseclass and mouse event class was found at +// https://www.youtube.com/watch?v=r0t2yMyGJME&list=PLcacUGyBsOIBlGyQQWzp6D1Xn6ZENx9Y2&index=6 +// https://www.youtube.com/watch?v=M61AjhVDFS8&list=PLcacUGyBsOIBlGyQQWzp6D1Xn6ZENx9Y2&index=7 +// C++ DirectX 11 Engine Tutorial 6 - Mouse Input by jpres +// C++ DirectX 11 Engine Tutorial 7 - Raw Mouse Input by jpres +//implimented by christy wear on 7/8/2021 to improve mouselook + +//these functions will be called for window proc + +//left click +void MouseClass::OnLeftPressed(int x, int y) +{ + this->leftIsDown = true; //sets private class variable bool leftIsDown to true + MouseEvent me(MouseEvent::EventType::LPress, x, y); //creates a new MouseEvent called me, to LPress, and passes x y pos of mouse + this->eventBuffer.push(me); // pushes me MouseEvent onto the eventbuffer queue +} + +//left click let go +void MouseClass::OnLeftReleased(int x, int y) +{ + this->leftIsDown = false; // sets private class variable bool leftIsDown to false + this->eventBuffer.push(MouseEvent(MouseEvent::EventType::LRelease, x, y)); //push a MouseEvent onto the eventbuffer saying left mouse released +} + +//right click +void MouseClass::OnRightPressed(int x, int y) +{ + this->rightIsDown = true; // sets private class variable rightIsDown to true + this->eventBuffer.push(MouseEvent(MouseEvent::EventType::RPress, x, y)); //push event to buffer, Right click, x, y pos +} + +//right click let go +void MouseClass::OnRightReleased(int x, int y) +{ + this->rightIsDown = false; // sets private class variable rightIsDown to false + this->eventBuffer.push(MouseEvent(MouseEvent::EventType::RRelease, x, y)); // adds event to buffer, right mouse button released + xy pos +} + +//middle click +void MouseClass::OnMiddlePressed(int x, int y) +{ + this->mbuttonDown = true; // sets private class variable mbuttonDown to true + this->eventBuffer.push(MouseEvent(MouseEvent::EventType::MPress, x, y)); //sends event that middle mouse button pressed at x y +} + +//middle click let go +void MouseClass::OnMiddleReleased(int x, int y) +{ + this->mbuttonDown = false; //sets private class variable mbuttonDown to false + this->eventBuffer.push(MouseEvent(MouseEvent::EventType::MRelease, x, y)); //sends event that middle m button released at x and y +} + +//mouse scroll wheel up +void MouseClass::OnWheelUp(int x, int y) +{ + this->eventBuffer.push(MouseEvent(MouseEvent::EventType::WheelUp, x, y)); // sends event mouse wheel moved up at x y +} + +//mouse scroll wheel down +void MouseClass::OnWheelDown(int x, int y) +{ + this->eventBuffer.push(MouseEvent(MouseEvent::EventType::WheelDown, x, y)); // event mouse wheel moved down at x y +} + +// general mouse movement that returns coords +void MouseClass::OnMouseMove(int x, int y) +{ + this->x = x; // sets private variable x, to incoming x value + this->y = y; // sets private variable y, to incoming y value + this->eventBuffer.push(MouseEvent(MouseEvent::EventType::Move, x, y)); // event mouse moved, at x y +} + +//raw direct mouse shows how much which dir was moved. //pushes event onto queue to save x y +void MouseClass::OnMouseMoveRaw(int x, int y) +{ + this->eventBuffer.push(MouseEvent(MouseEvent::EventType::RAW_MOVE, x, y)); +} + +//can call these anytime +//checks if condition is true + +//is left mouse button clicked? +bool MouseClass::IsLeftDown() +{ + return this->leftIsDown; // returns copy of private bool variable leftIsDown +} + +// is middle mouse button clicked? +bool MouseClass::IsMiddleDown() +{ + return this->mbuttonDown; // returns copy of private bool variable mbuttonDown +} + +// is right mouse button clicked? +bool MouseClass::IsRightDown() +{ + return this->rightIsDown; // returns copy private bool variable rightIsDown +} + +// what is the mouses X pos? +int MouseClass::GetPosX() +{ + return this->x; //returns copy private variable int x pos of mouse +} + +// what is the mouses y pos? +int MouseClass::GetPosY() +{ + return this->y; // returns copy private variable int y pos of mouse +} + +// what is the mouse point containing both x and y? +MousePoint MouseClass::GetPos() +{ + MousePoint a; + a.x = GetPosX(); + a.y = GetPosY(); + return a; + // returns point struct using copy of private variables x and y +} + +// is our event buffer empty no events? +bool MouseClass::EventBufferIsEmpty() +{ + return this->eventBuffer.empty(); // uses function of queue to tell if it's empty no events. +} + +// read the events please +MouseEvent MouseClass::ReadEvent() +{ + if (this->eventBuffer.empty()) // if queue is empty + { + return MouseEvent(); // return event. We are done here + } + else + { + MouseEvent e = this->eventBuffer.front(); // get first even from buffer + this->eventBuffer.pop(); //remove first event from buffer + return e; // returns this event. + } +} diff --git a/Underlight/Mouse/MouseClass.h b/Underlight/Mouse/MouseClass.h new file mode 100644 index 0000000..1304027 --- /dev/null +++ b/Underlight/Mouse/MouseClass.h @@ -0,0 +1,49 @@ +#pragma once +//mouseclass and mouse event class was found at +// https://www.youtube.com/watch?v=r0t2yMyGJME&list=PLcacUGyBsOIBlGyQQWzp6D1Xn6ZENx9Y2&index=6 +// https://www.youtube.com/watch?v=M61AjhVDFS8&list=PLcacUGyBsOIBlGyQQWzp6D1Xn6ZENx9Y2&index=7 +// C++ DirectX 11 Engine Tutorial 6 - Mouse Input by jpres +// C++ DirectX 11 Engine Tutorial 7 - Raw Mouse Input by jpres +//implimented by christy wear on 7/8/2021 to improve mouselook + +#include "MouseEvent.h" // included to use mouse events + +#include // for mouse event queue + +class MouseClass +{ +public: + //functions will be called for window proc + void OnLeftPressed(int x, int y); //left click + void OnLeftReleased(int x, int y); //left click let go + void OnRightPressed(int x, int y); //right click + void OnRightReleased(int x, int y); //right click let go + void OnMiddlePressed(int x, int y); //middle click + void OnMiddleReleased(int x, int y); //middle click let go + void OnWheelUp(int x, int y); //mouse scroll wheel up + void OnWheelDown(int x, int y); //mouse scroll wheel down + void OnMouseMove(int x, int y); // general mouse movement that returns coords + void OnMouseMoveRaw(int x, int y); //raw direct mouse shows how much which dir was moved. + + //can call these anytime + //checks if condition is true + bool IsLeftDown(); //is left mouse button clicked? + bool IsMiddleDown(); // is middle mouse button clicked? + bool IsRightDown(); // is right mouse button clicked? + + //can call these anytime + int GetPosX(); // what is the mouses X pos? + int GetPosY(); // what is the mouses y pos? + MousePoint GetPos(); // what is the mouse point containing both x and y? + + bool EventBufferIsEmpty(); // is our event buffer empty no events? + MouseEvent ReadEvent(); // read the events please + +private: + std::queue eventBuffer; //our que of events + bool leftIsDown = false; //not in use atm + bool rightIsDown = false; // not in use atm + bool mbuttonDown = false; // not in use atm + static inline int x; // our static var + static inline int y; // our static var +}; \ No newline at end of file diff --git a/Underlight/Mouse/MouseEvent.cpp b/Underlight/Mouse/MouseEvent.cpp new file mode 100644 index 0000000..e34b5a4 --- /dev/null +++ b/Underlight/Mouse/MouseEvent.cpp @@ -0,0 +1,98 @@ +#include "MouseEvent.h" + + +//mouseclass and mouse event class was found at +// https://www.youtube.com/watch?v=r0t2yMyGJME&list=PLcacUGyBsOIBlGyQQWzp6D1Xn6ZENx9Y2&index=6 +// https://www.youtube.com/watch?v=M61AjhVDFS8&list=PLcacUGyBsOIBlGyQQWzp6D1Xn6ZENx9Y2&index=7 +// C++ DirectX 11 Engine Tutorial 6 - Mouse Input by jpres +// C++ DirectX 11 Engine Tutorial 7 - Raw Mouse Input by jpres +//implimented by christy wear on 7/8/2021 to improve mouselook + + + + //default constructor invalid event type +MouseEvent::MouseEvent():type(MouseEvent::EventType::Invalid) +{ + //event is invalid, setting cords to zero. + SetPosX(0); + SetPosY(0); +} + + //constructor takes EventType, x,y then sets them in private variables +MouseEvent::MouseEvent(EventType type, int x, int y):type(type) +{ + //valid cords, assigning them. + SetPosX(x); + SetPosY(y); +} + + //returns bool if it's not invalid + bool MouseEvent::IsValid() + { + return this->type != EventType::Invalid; + } + + // returns the Type of event + MouseEvent::EventType MouseEvent::GetType() + { + return this->type; + } + + //returns the mouses x and y in a point + MousePoint MouseEvent::GetPos() + { + //make an actual mousepoint so c++ doesnt complain + MousePoint a; + //assign each cord of mousepoint + a.x = GetPosX(); + a.y = GetPosY(); + //return it. + return a; + } + + //specifically returns only int value for x + int MouseEvent::GetPosX() + { + return this->x; + } + + void MouseEvent::SetPosX(int x) + { + this->x = x; + } + + //specifically returns only int value for y + int MouseEvent::GetPosY() + { + return this->y; + } + + //allows safely(hah hah) setting local var y + void MouseEvent::SetPosY(int y) + { + this->y = y; + } + + // detects if cords are above or equal to 3 for mouse look + bool MouseEvent::MouseXorYOverThree() + { + // is cords equal,above or below 3? + if (GetPosX() >= 3 || GetPosX() <= 3 || GetPosY() >= 3 || GetPosY() <= 3) + { + //yep , set bool to true + XorYReady = true; + } + else + //nope set bool to false + XorYReady = false; + //throw it back + return XorYReady; + } + + //allow manual reset since for whatever reason mouse relative doesnt reset to zero on no input. + void MouseEvent::MouseXorYBoolSet(bool val) + { + XorYReady = val; + } + + diff --git a/Underlight/Mouse/MouseEvent.h b/Underlight/Mouse/MouseEvent.h new file mode 100644 index 0000000..77a07a7 --- /dev/null +++ b/Underlight/Mouse/MouseEvent.h @@ -0,0 +1,52 @@ +#pragma once + +//mouseclass and mouse event class was found at +// https://www.youtube.com/watch?v=r0t2yMyGJME&list=PLcacUGyBsOIBlGyQQWzp6D1Xn6ZENx9Y2&index=6 +// https://www.youtube.com/watch?v=M61AjhVDFS8&list=PLcacUGyBsOIBlGyQQWzp6D1Xn6ZENx9Y2&index=7 +// C++ DirectX 11 Engine Tutorial 6 - Mouse Input by jpres +// C++ DirectX 11 Engine Tutorial 7 - Raw Mouse Input by jpres +//implimented by christy wear on 7/8/2021 to improve mouselook + + +struct MousePoint //combined cords to make mousepoint +{ + int x; + int y; +}; + +class MouseEvent +{ + public: + enum class EventType //our event class for mouse + { + LPress =0, + LRelease =1, + RPress =2, + RRelease = 3, + MPress = 4, + MRelease = 5, + WheelUp = 6, + WheelDown = 7, + Move = 8, + RAW_MOVE = 9, + Invalid = 10 + }; +private: + EventType type; + static inline int x; //static so available anywhere, even store near you // inline so its useful + static inline int y;//static so available anywhere, even store near you // inline so its useful + static inline bool XorYReady;//static so available anywhere, even store near you // inline so its useful +public: + + MouseEvent(); // default constructor + MouseEvent(const EventType type, const int x, const int y); //constructor + bool IsValid(); // check if event is valid + EventType GetType(); // gets event type + MousePoint GetPos(); // gets pos struct that contains x and y + void SetPosX(int x); // sets x + void SetPosY(int y); // setx y + int GetPosX(); // gets x + int GetPosY(); //gets y + bool MouseXorYOverThree(); //checks for equal or greater/lesser than 3 then returns answer + void MouseXorYBoolSet(bool val); // manually resets bool +}; \ No newline at end of file diff --git a/Underlight/Options.cpp b/Underlight/Options.cpp index b260829..aefeefe 100644 --- a/Underlight/Options.cpp +++ b/Underlight/Options.cpp @@ -37,6 +37,10 @@ #include "cEffects.h" #include "LoginOptions.h" #include "base64.h" +#include + +using namespace std; + ///////////////////////////////////////////////// // External Global Variables @@ -541,7 +545,7 @@ void LoadJSONOptionValues(char* charName) cJSON* nameNode = cJSON_GetObjectItem(jsonFiles[i], "name"); if (!nameNode) continue; - if (stricmp(nameNode->valuestring, charName) == 0) { + if (_stricmp(nameNode->valuestring, charName) == 0) { local = jsonFiles[i]; break; } @@ -624,7 +628,7 @@ void LoadParsedJSONOptions(cJSON* json) { char* lastVal = cJSON_GetStringValue(last); for (int i = 0; i < MAX_STORED_ACCOUNTS; i++) { - if (stricmp(options.username[i], lastVal) == 0) { + if (_stricmp(options.username[i], lastVal) == 0) { options.account_index = i; break; } @@ -695,7 +699,7 @@ void LoadParsedJSONOptions(cJSON* json) size_t out; unsigned char* kmbytes = base64_decode((const unsigned char*)cJSON_GetStringValue(km), strlen(cJSON_GetStringValue(km)), &out); if (kmbytes) - memcpy(map, kmbytes, out); + std::memcpy(map, kmbytes, out); keymap->Init(numKeys->valueint, map); } } diff --git a/Underlight/Options.h b/Underlight/Options.h index 96253b2..3413777 100644 --- a/Underlight/Options.h +++ b/Underlight/Options.h @@ -105,7 +105,9 @@ struct options_t { BOOL autorejoin; // always rejoin last party leader BOOL footsteps; // play footstep sounds BOOL art_prompts; // show art prompts - BOOL mouselook; // mouse movements turn player by default + + static inline BOOL mouselook; // mouse movements turn player by default + BOOL invertmouse; // inverts y-axis of movement during mouselook BOOL log_chat; // write out player chat to a log BOOL invulnerable; // gm only! diff --git a/Underlight/RenderActor.h b/Underlight/RenderActor.h index 3fef04e..4576b4c 100644 --- a/Underlight/RenderActor.h +++ b/Underlight/RenderActor.h @@ -3,6 +3,9 @@ // Note : Used internally by the Graphics Engine. + +#include + #ifndef ACTOR_RENDERER_H #define ACTOR_RENDERER_H @@ -56,7 +59,9 @@ extern cColumnClipper column_clipper; void InitRenderActor(void); void DeInitRenderActor(void); -void StartRenderActor(UCHAR *viewBuffer, int pitch, cPlayer *player); + +void StartRenderActor(unsigned char *viewBuffer, int pitch, cPlayer *player); + void EndRenderActor(void); bool render_actor(cActor *actor); diff --git a/Underlight/SharedConstants.h b/Underlight/SharedConstants.h index 85b1fb7..517a6cf 100644 --- a/Underlight/SharedConstants.h +++ b/Underlight/SharedConstants.h @@ -1,6 +1,7 @@ #ifndef SHAREDCONSTANTS_H #define SHAREDCONSTANTS_H + // *** REALLY IMPORTANT NOTE -- READ THIS OR DIE *** // IF YOU CHANGE *ANYTHING* IN THIS FILE, NOTIFY BRENT, // OR REAL BAD THINGS CAN HAPPEN! THIS IS NOT AN IDLE WARNING. diff --git a/Underlight/Underlight.vcxproj b/Underlight/Underlight.vcxproj index be326d6..463be88 100644 --- a/Underlight/Underlight.vcxproj +++ b/Underlight/Underlight.vcxproj @@ -52,69 +52,92 @@ {F427253E-F158-4722-B7E1-27761AE6C921} - 8.1 + + 10.0 + Application false - v140_xp + + v142 + MultiByte + Application false - v140_xp + + v142 + MultiByte + Application false - v140_xp + + v142 + MultiByte + Application false - v140_xp + + v142 + MultiByte + Application false - v140_xp + + v142 + MultiByte + Application false - v140_xp + v142 + MultiByte Application false - v140_xp + v142 + MultiByte Application false - Unicode - v140_xp + MultiByte + v142 Application false - v140_xp + v142 + MultiByte Application false - v140_xp + v142 + MultiByte Application false - v140_xp + v142 + MultiByte Application false - v140_xp + v142 + MultiByte @@ -245,6 +268,9 @@ $(IncludePath) $(IncludePath) + + Release + _DEBUG;%(PreprocessorDefinitions) @@ -259,7 +285,7 @@ MinSpace OnlyExplicitInline ..\OggVorbis\include;..\MessageMaker;..\AgentMessages;..\AgentSvr;..\Underlight;..\DXSDK\SDK\inc;..\RWSDK\inc;%(AdditionalIncludeDirectories) - PMARE;UL_DEV;GAME_CLI;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + PMARE;UL_DEV;GAME_CLI;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T true MultiThreaded true @@ -275,6 +301,8 @@ false true true + stdcpp17 + stdc17 _DEBUG;PMARE;%(PreprocessorDefinitions) @@ -316,7 +344,8 @@ MinSpace OnlyExplicitInline ..\OggVorbis\include;..\MessageMaker;..\AgentMessages;..\AgentSvr;..\Underlight;..\DXSDK\SDK\inc;..\RWSDK\inc;%(AdditionalIncludeDirectories) - UL_DEBUG;GAMEMASTER_FULL;GAMEMASTER;UL_DEV;GAME_LYR;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + UL_DEBUG;GAMEMASTER_FULL;GAMEMASTER;UL_DEV;GAME_LYR;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T + true MultiThreadedDebug true @@ -334,6 +363,9 @@ false true true + stdcpp17 + stdc17 + _DEBUG;%(PreprocessorDefinitions) @@ -375,7 +407,7 @@ MinSpace OnlyExplicitInline ..\OggVorbis\include;..\MessageMaker;..\AgentMessages;..\AgentSvr;..\Underlight;..\DXSDK\SDK\inc;..\RWSDK\inc;%(AdditionalIncludeDirectories) - NDEBUG;PMARE;GAME_CLI;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + NDEBUG;PMARE;GAME_CLI;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T true MultiThreaded true @@ -391,6 +423,8 @@ false true true + stdcpp17 + stdc17 NDEBUG;PMARE;%(PreprocessorDefinitions) @@ -432,7 +466,7 @@ MinSpace OnlyExplicitInline ..\OggVorbis\include;..\MessageMaker;..\AgentMessages;..\AgentSvr;..\Underlight;..\DXSDK\SDK\inc;..\RWSDK\inc;%(AdditionalIncludeDirectories) - NDEBUG;QA;PMARE;GAME_CLI;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + NDEBUG;QA;PMARE;GAME_CLI;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T true MultiThreaded true @@ -448,6 +482,8 @@ false true true + stdcpp17 + stdc17 NDEBUG;QA;PMARE;%(PreprocessorDefinitions) @@ -488,7 +524,7 @@ Disabled ..\OggVorbis\include;..\MessageMaker;..\AgentMessages;..\AgentSvr;..\Underlight;..\DXSDK\SDK\inc;..\RWSDK\inc;%(AdditionalIncludeDirectories) - UL_DEBUG;GAMEMASTER_FULL;GAMEMASTER;UL_DEBUG_MASTER;_DEBUG;GAME_LYR;UNICODE;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + UL_DEBUG;GAMEMASTER_FULL;GAMEMASTER;UL_DEBUG_MASTER;_DEBUG;GAME_LYR;UNICODE;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;USE_32BIT_TIME_T;_USE_32BIT_TIME_T false MultiThreaded .\Unicode/Underlight.pch @@ -505,6 +541,8 @@ false true true + stdcpp17 + stdc17 _DEBUG;%(PreprocessorDefinitions) @@ -546,7 +584,7 @@ MinSpace OnlyExplicitInline ..\OggVorbis\include;..\MessageMaker;..\AgentMessages;..\AgentSvr;..\Underlight;..\DXSDK\SDK\inc;..\RWSDK\inc;%(AdditionalIncludeDirectories) - NDEBUG;UL_MASTER;UL_PLAYER_DEV;UL_DEV;GAME_CLI;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + NDEBUG;UL_MASTER;UL_PLAYER_DEV;UL_DEV;GAME_CLI;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T true MultiThreaded true @@ -564,6 +602,8 @@ false true true + stdcpp17 + stdc17 NDEBUG;%(PreprocessorDefinitions) @@ -605,7 +645,7 @@ MinSpace OnlyExplicitInline ..\OggVorbis\include;..\MessageMaker;..\AgentMessages;..\AgentSvr;..\Underlight;..\DXSDK\SDK\inc;..\RWSDK\inc;%(AdditionalIncludeDirectories) - NDEBUG;GAMEMASTER_FULL;GAMEMASTER;GAME_LYR;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + NDEBUG;GAMEMASTER_FULL;GAMEMASTER;GAME_LYR;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T true MultiThreaded true @@ -621,6 +661,8 @@ false true true + stdcpp17 + stdc17 NDEBUG;%(PreprocessorDefinitions) @@ -660,7 +702,8 @@ MinSpace OnlyExplicitInline ..\OggVorbis\include;..\MessageMaker;..\AgentMessages;..\AgentSvr;..\Underlight;..\DXSDK\SDK\inc;..\RWSDK\inc;%(AdditionalIncludeDirectories) - NDEBUG;QA;GAMEMASTER_FULL;GAMEMASTER;GAME_LYR;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + NDEBUG;QA;GAMEMASTER_FULL;GAMEMASTER;GAME_LYR;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T + true MultiThreaded true @@ -676,6 +719,8 @@ false true true + stdcpp17 + stdc17 NDEBUG;QA;%(PreprocessorDefinitions) @@ -714,7 +759,7 @@ Disabled ..\OggVorbis\include;..\MessageMaker;..\AgentMessages;..\AgentSvr;..\Underlight;..\DXSDK\SDK\inc;..\RWSDK\inc;%(AdditionalIncludeDirectories) - GAME_CLI;_DEBUG;UL_DEBUG;GAMEMASTER_FULL;GAMEMASTER;UL_DEBUG_MASTER;UL_DEV;GAME_LYR;WIN32;_WINDOWS;USE_INLINE;ENGLISH;VORBIS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + GAME_CLI;_DEBUG;UL_DEBUG;GAMEMASTER_FULL;GAMEMASTER;UL_DEBUG_MASTER;UL_DEV;GAME_LYR;WIN32;_WINDOWS;USE_INLINE;ENGLISH;VORBIS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T false MultiThreadedDebug .\Debug/Underlight.pch @@ -731,6 +776,8 @@ false true true + stdcpp17 + stdc17 _DEBUG;%(PreprocessorDefinitions) @@ -771,7 +818,7 @@ Disabled ..\OggVorbis\include;..\MessageMaker;..\AgentMessages;..\AgentSvr;..\Underlight;..\DXSDK\SDK\inc;..\RWSDK\inc;%(AdditionalIncludeDirectories) - _DEBUG;UL_DEBUG;LIVE_DEBUG;GAMEMASTER_FULL;GAMEMASTER;UL_DEBUG_MASTER;UL_DEV;GAME_LYR;WIN32;_WINDOWS;USE_INLINE;ENGLISH;VORBIS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + _DEBUG;UL_DEBUG;LIVE_DEBUG;GAMEMASTER_FULL;GAMEMASTER;UL_DEBUG_MASTER;UL_DEV;GAME_LYR;WIN32;_WINDOWS;USE_INLINE;ENGLISH;VORBIS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T false MultiThreadedDebug .\Debug/Underlight.pch @@ -788,6 +835,8 @@ false true true + stdcpp17 + stdc17 _DEBUG;%(PreprocessorDefinitions) @@ -829,7 +878,7 @@ MinSpace OnlyExplicitInline ..\OggVorbis\include;..\MessageMaker;..\AgentMessages;..\AgentSvr;..\Underlight;..\DXSDK\SDK\inc;..\RWSDK\inc;%(AdditionalIncludeDirectories) - NDEBUG;UL_MASTER;GAME_CLI;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + NDEBUG;UL_MASTER;GAME_CLI;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T true MultiThreaded true @@ -847,6 +896,8 @@ false true true + stdcpp17 + stdc17 NDEBUG;%(PreprocessorDefinitions) @@ -888,7 +939,7 @@ MinSpace OnlyExplicitInline ..\OggVorbis\include;..\MessageMaker;..\AgentMessages;..\AgentSvr;..\Underlight;..\DXSDK\SDK\inc;..\RWSDK\inc;%(AdditionalIncludeDirectories) - NDEBUG;QA;UL_MASTER;GAME_CLI;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + NDEBUG;QA;UL_MASTER;GAME_CLI;WIN32;_WINDOWS;USE_INLINE;ENGLISH;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T true MultiThreaded true @@ -906,6 +957,8 @@ false true true + stdcpp17 + stdc17 NDEBUG;QA;%(PreprocessorDefinitions) @@ -1195,6 +1248,7 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) @@ -2261,6 +2315,7 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) @@ -2287,6 +2342,8 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + + %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) @@ -2574,7 +2631,10 @@ + + + diff --git a/Underlight/Underlight.vcxproj.filters b/Underlight/Underlight.vcxproj.filters index 502df2b..a6c5a81 100644 --- a/Underlight/Underlight.vcxproj.filters +++ b/Underlight/Underlight.vcxproj.filters @@ -17,6 +17,14 @@ {c8f65b2d-1a06-411a-934e-5441e2b8b2a3} lib + + + {acc7e40a-b2da-411c-aa94-4559177b381d} + + + {c136f9de-5e82-47ad-a8a3-600d3423db30} + + @@ -202,6 +210,18 @@ Header Files + + Source Files\Mouse + + + Source Files\Mouse + + + Source Files + + + Source Files\Mouse + @@ -414,6 +434,17 @@ Header Files + + + Header Files\Mouse + + + Header Files\Mouse + + + Header Files\Mouse + + diff --git a/Underlight/cChat.cpp b/Underlight/cChat.cpp index 48dfc59..d8f79e4 100644 --- a/Underlight/cChat.cpp +++ b/Underlight/cChat.cpp @@ -449,7 +449,9 @@ bool cChat::HandleReturn(TCHAR* sentence) for (int i = 0; i < NUM_SLASH_COMMANDS; i++) { slash_command_t sc = slash_commands[i]; - if (strnicmp(sc.command, sentence, strlen(sc.command)) == 0) + + if (_strnicmp(sc.command, sentence, strlen(sc.command)) == 0) + { speech_callback_t callback = sc.handler; sentence += strlen(sc.command); @@ -944,7 +946,9 @@ void cChat::OnTabKeypress() if (prevBreak != 0) prevBreak++; strncpy(textToComplete, sentence + prevBreak, (nextBreak - prevBreak) + 1); - if (prevPrevBreak == 0 && strnicmp("/whisper", sentence, 8) == 0) + + if (prevPrevBreak == 0 && _strnicmp("/whisper", sentence, 8) == 0) + autocompleteNeedsQuoting = true; cNeighbor* n; @@ -952,7 +956,9 @@ void cChat::OnTabKeypress() { if ((n->Avatar().Hidden()) && (player->ID() != n->ID())) continue; - if (strnicmp(textToComplete, n->Name(), strlen(textToComplete)) == 0) + + if (_strnicmp(textToComplete, n->Name(), strlen(textToComplete)) == 0) + { if (autocompleteNeedsQuoting && strchr(n->Name(), ' ')) sprintf(names[autocompleteChoices], "\"%s\"", n->Name()); diff --git a/Underlight/cClient.cpp b/Underlight/cClient.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Underlight/cClient.h b/Underlight/cClient.h index 86738ca..03fd9c3 100644 --- a/Underlight/cClient.h +++ b/Underlight/cClient.h @@ -4,7 +4,8 @@ // Copyright Lyra LLC, 1997. All rights reserved. #include -#include "shared/amsg.h" +#include "Amsg.h" + ////////////////////////////////////////////////////////////////// // Constants @@ -40,10 +41,12 @@ class cClient BOOL logged_in; TCHAR username[Lyra::PLAYERNAME_MAX]; TCHAR password[Lyra::PASSWORD_MAX]; - void (*msg_callback)(amsg_t &amsg); + + void (*msg_callback)(AMsg &amsg); public: - cClient(HWND hWindow, void (*amsg_callback)(amsg_t &amsg)); + cClient(HWND hWindow, void (*amsg_callback)(AMsg &amsg)); + ~cClient(void); void Connect(char *server, TCHAR *agent_username, TCHAR *agent_password); BOOL Login(void); diff --git a/Underlight/cDDraw.cpp b/Underlight/cDDraw.cpp index 5f5846e..2a634ed 100644 --- a/Underlight/cDDraw.cpp +++ b/Underlight/cDDraw.cpp @@ -348,8 +348,10 @@ bool cDDraw::EraseSurface(int id) { DDBLTFX ddbltfx; LPDIRECTDRAWSURFACE7 lpDDSSurface; + RECT rect; POINT wndpt; + int xoff=0,yoff=0; // offsets for running in a window if (id == PRIMARY) diff --git a/Underlight/cKeymap.h b/Underlight/cKeymap.h index 03afcc2..27beb8b 100644 --- a/Underlight/cKeymap.h +++ b/Underlight/cKeymap.h @@ -191,16 +191,19 @@ const keymap_t default_keymap[default_num_keys] = {',', LyraKeyboard::SHOW_NEXT, Arts::NONE}, {'.', LyraKeyboard::SHOW_PREV, Arts::NONE}, {'R', LyraKeyboard::RESET_EYELEVEL, Arts::NONE}, - {'A', LyraKeyboard::TOGGLE_SOUND, Arts::NONE}, + + {'=', LyraKeyboard::TOGGLE_SOUND, Arts::NONE}, {'T', LyraKeyboard::TALK, Arts::NONE}, {222, LyraKeyboard::LEAVE_PARTY, Arts::NONE}, // (apostrophe) - {'W', LyraKeyboard::WHO_NEARBY, Arts::NONE}, + {VK_UP, LyraKeyboard::WHO_NEARBY, Arts::NONE}, + {'C', LyraKeyboard::ACTIVE_EFFECTS, Arts::NONE}, {'X', LyraKeyboard::SHOW_XP, Arts::NONE}, {VK_HOME, LyraKeyboard::LOOK_DOWN, Arts::NONE}, {VK_END, LyraKeyboard::LOOK_UP, Arts::NONE}, - {VK_UP, LyraKeyboard::MOVE_FORWARD, Arts::NONE}, - {VK_DOWN, LyraKeyboard::MOVE_BACKWARD, Arts::NONE}, + {'W', LyraKeyboard::MOVE_FORWARD, Arts::NONE}, + {'S', LyraKeyboard::MOVE_BACKWARD, Arts::NONE}, + {VK_LEFT, LyraKeyboard::TURN_LEFT, Arts::NONE}, {VK_RIGHT, LyraKeyboard::TURN_RIGHT, Arts::NONE}, {VK_CONTROL, LyraKeyboard::USE, Arts::NONE}, @@ -211,7 +214,9 @@ const keymap_t default_keymap[default_num_keys] = {VK_MBUTTON, LyraKeyboard::MOUSE_LOOK, Arts::NONE}, {VK_RBUTTON, LyraKeyboard::JUMP, Arts::NONE}, {0xdc, LyraKeyboard::MOUSE_LOOK, Arts::NONE}, // (backslash) - {'S', LyraKeyboard::SIDESTEP_LEFT, Arts::NONE}, + + {'A', LyraKeyboard::SIDESTEP_LEFT, Arts::NONE}, + {'K', LyraKeyboard::SHOW_RANKS, Arts::NONE}, {VK_PRIOR, LyraKeyboard::SCROLL_UP, Arts::NONE}, {VK_NEXT, LyraKeyboard::SCROLL_DOWN, Arts::NONE}, diff --git a/Underlight/cLevel.cpp b/Underlight/cLevel.cpp index 35c1bed..7f2e57e 100644 --- a/Underlight/cLevel.cpp +++ b/Underlight/cLevel.cpp @@ -8,6 +8,7 @@ #include "Central.h" #include #include +#include #include "cDDraw.h" #include "cPlayer.h" #include "cEffects.h" @@ -1661,15 +1662,21 @@ int cLevel::BreakupSectors(file_vertex* verts, int num_sectors, int num_verts, i int old_num_hulls = num_hulls; int dupvert = -1; - for (s=0; s 3) { dupvert = dupverts[s]; break; } + + + if (s == num_dupverts) + continue; } - if (s == num_dupverts) - continue; + + num_hulls = this->SplitHull(dupvert, hull_num, num_hulls, num_dupverts); if (old_num_hulls == num_hulls) @@ -1844,7 +1851,9 @@ int cLevel::CombineHulls(int num_hulls, file_vertex* verts, int sector_num, int bbox.maxy = verts[v1].y; } - for (j=0; j< hull_count; j++) + + for (int j=0; j< hull_count; j++) + { if (j == i) continue; @@ -2072,7 +2081,9 @@ int cLevel::FixBaseLines(int num_hulls, file_vertex* verts, int sector_num, bool float ydiff = y1-y0; bool noy = false; float baseangle; - if ((abs(y1 - y0)) < 0.001f) { + + if ((std::abs((y1 - y0))) < 0.001f) { + noy = true; baseangle = 999999999.0f; } else @@ -2220,6 +2231,11 @@ int cLevel::FixBaseLines(int num_hulls, file_vertex* verts, int sector_num, bool return 0; } +void cLevel::CreateEdgeSet(int v0_start, int v1_start, int v1_end, int hull_index, hull_t& new_hull, bool first_from, bool first_to, int sec1, int sec2, int new_sec) +{ +} + + @@ -2260,9 +2276,11 @@ int cLevel::SplitHull(int shared_vert, int hull_num, int num_hulls, int num_dupv // to where we started. we compare the # of lines in each winding, and pick the one // with the fewest. - for (t=0; t<4; t++) { + + for (int t=0; t<4; t++) { // loop through and try each line as a starting line - for (s=0; s<4; s++) { + for (int s=0; s<4; s++) { + if (s == t) continue; if (verbose) { @@ -2276,7 +2294,9 @@ int cLevel::SplitHull(int shared_vert, int hull_num, int num_hulls, int num_dupv int best_hull = -1; int min_distance = 99999999.0f; - for (s=0; s<16; s++) { + + for (int s=0; s<16; s++) { + if ((test_hulls[s].num_lines > 1000) || (test_hulls[s].num_lines < 3)) { @@ -2302,7 +2322,9 @@ int cLevel::SplitHull(int shared_vert, int hull_num, int num_hulls, int num_dupv // we have now picked the best hull of the bunch; split it out from the rest memcpy(&hulls[num_hulls], &test_hulls[best_hull], sizeof(hull_t)); // remove every line in the new hull from the original - for (s=0; s #include "Central.h" diff --git a/Underlight/cPlayer.cpp b/Underlight/cPlayer.cpp index 259d0fd..e6337bc 100644 --- a/Underlight/cPlayer.cpp +++ b/Underlight/cPlayer.cpp @@ -36,6 +36,8 @@ #include "cAgentBox.h" #include "LmStats.h" #include "LmXPTable.h" +#include "./MeHelper.h" //added helper class for MouseEvent + extern xp_entry lyra_xp_table[]; @@ -94,6 +96,7 @@ extern cAgentBox *agentbox; extern HWND hwnd_acceptreject; extern unsigned long last_mumble_message; extern ppoint_t pp; // personality points use tracker + const int guild_levels[NUM_GUILDS] = { 17,18,21,22,23,24,25,26 }; @@ -115,6 +118,7 @@ cPlayer::cPlayer(short viewport_height) : collapse_time = 0; checksum_incorrect = attempting_teleport = false; + for (int i = 0; i < COLLAPSES_TRACKED; i++) { collapses[i].collapser_id = Lyra::ID_UNKNOWN; @@ -297,7 +301,8 @@ bool cPlayer::Update(void) const float brightness_rate = 0.005f; shader->SetGlobalBrightness(brightness); - brightness += timing->nmsecs * brightness_rate; + brightness += timing->nmsecs * brightness_rate; + if (brightness > 1.1) { shader->SetGlobalBrightness(1.0); @@ -337,7 +342,9 @@ bool cPlayer::Update(void) if (!options.network || ((options.welcome_ai || (gs && gs->LoggedIntoGame())) && + ((gs && gs->LoggedIntoLevel()) || (level->ID() == START_LEVEL_ID)))) + move = true; if ((flags & ACTOR_PARALYZED))// || (cp->DragItem() != NO_ITEM)) @@ -425,29 +432,34 @@ bool cPlayer::Update(void) step_frame = avatar_poses[WALKING].start_frame; } + //declare and initialize mouse for raw input from our helper + MouseEvent mouse = MeHelper::GetME(); + if (move) { if (!spin && keyboard[Keystates::STRAFE]) // disregard keyboard[Keystates::STRAFE] = 0; - if ((keyboard[Keystates::STRAFE] || forced_move.strafe) && - (keyboard[Keystates::TURN_RIGHT] || mouse_move.right || keyboard[Keystates::TURN_LEFT] - || mouse_move.left || forced_move.right || forced_move.left)) // strafing? + if ((keyboard[Keystates::STRAFE] || forced_move.strafe) &&(keyboard[Keystates::TURN_RIGHT] || keyboard[Keystates::TURN_LEFT] + || forced_move.right || forced_move.left || mouse.MouseXorYOverThree())) // strafing? { - if (keyboard[Keystates::TURN_RIGHT] || mouse_move.right || forced_move.right) + if (keyboard[Keystates::TURN_RIGHT] /* || mouse_move.right*/ || forced_move.right) { // handle angles for combined strafe / forwards / backwards move - if (keyboard[Keystates::MOVE_FORWARD] || mouse_move.forward || forced_move.forward) + if (keyboard[Keystates::MOVE_FORWARD] /* || mouse_move.forward */ || forced_move.forward) moveangle = FixAngle(angle + Angle_45); - else if (keyboard[Keystates::MOVE_BACKWARD] || mouse_move.backward || forced_move.backward) + else if (keyboard[Keystates::MOVE_BACKWARD] /* || mouse_move.backward*/ || forced_move.backward) + moveangle = FixAngle(angle - Angle_45); else moveangle = FixAngle(angle + Angle_90); strafe = STRAFE_RIGHT; } - if (keyboard[Keystates::TURN_LEFT] || mouse_move.left || forced_move.left) + + if (keyboard[Keystates::TURN_LEFT] /* || mouse_move.left*/ || forced_move.left) { // handle angles for combined strafe / forwards / backwards move - if (keyboard[Keystates::MOVE_FORWARD] || mouse_move.forward || forced_move.forward) + if (keyboard[Keystates::MOVE_FORWARD] /* || mouse_move.forward*/ || forced_move.forward) moveangle = FixAngle(angle - Angle_45); - else if (keyboard[Keystates::MOVE_BACKWARD] || mouse_move.backward || forced_move.backward) + else if (keyboard[Keystates::MOVE_BACKWARD] /* || mouse_move.backward*/ || forced_move.backward) + moveangle = FixAngle(angle + Angle_45); else moveangle = FixAngle(angle - Angle_90); strafe = STRAFE_LEFT; @@ -455,39 +467,44 @@ bool cPlayer::Update(void) } else if (keyboard[Keystates::SIDESTEP_LEFT] || keyboard[Keystates::SIDESTEP_RIGHT]) // sidestep keys { + + // INFO("SSL"); // allow turns in combination with sidesteps - if (keyboard[Keystates::TURN_RIGHT] || mouse_move.right || mouse_look.right || forced_move.right) + //resorted so it makes a little more sense ~christy 7/11/21 + if (keyboard[Keystates::TURN_RIGHT]) { - if (mouse_look.looking) - turnrate += (timing->nticks*speed*options.turnrate*mouse_look.xratio); - else if (mouse_move.moving) - turnrate += (timing->nticks*speed*options.turnrate*mouse_move.xratio); - else - turnrate += (timing->nticks*speed*options.turnrate); + turnrate += (timing->nticks * speed * options.turnrate); } - else if (keyboard[Keystates::TURN_LEFT] || mouse_move.left || mouse_look.left || forced_move.left) + else if (keyboard[Keystates::TURN_LEFT] ) { - if (mouse_look.looking) - turnrate -= (timing->nticks*speed*options.turnrate*mouse_look.xratio); - else if (mouse_move.moving) - turnrate -= (timing->nticks*speed*options.turnrate*mouse_move.xratio); - else - turnrate -= (timing->nticks*speed*options.turnrate); + turnrate -= (timing->nticks * speed * options.turnrate); } + else if (mouse_look.looking) //if key for mouselook is pressed + { + if (mouse.MouseXorYOverThree()) // and house relative cords are equal or over 3 + { + turnrate -= (timing->nticks * speed * options.turnrate/2 * -mouse.GetPosX()); //get turn rate + mouse.MouseXorYBoolSet(false); //manually set bool for mouse check to false; + mouse.SetPosX(0); // set cord back to zero + } + } + + if (turnrate > (options.turnrate * speed)) + turnrate = options.turnrate * speed; + else if (turnrate < -(options.turnrate * speed)) + turnrate = -options.turnrate * speed; - if (turnrate > (options.turnrate*speed)) - turnrate = options.turnrate*speed; - else if (turnrate < -(options.turnrate*speed)) - turnrate = -options.turnrate*speed; angle = FixAngle(angle + (int)(turnrate)); moveangle = angle; if (keyboard[Keystates::SIDESTEP_RIGHT]) { // handle angles for combined strafe / forwards / backwards move - if (keyboard[Keystates::MOVE_FORWARD] || mouse_move.forward || forced_move.forward) + + if (keyboard[Keystates::MOVE_FORWARD] /* || mouse_move.forward */ || forced_move.forward) moveangle = FixAngle(angle + Angle_45); - else if (keyboard[Keystates::MOVE_BACKWARD] || mouse_move.backward || forced_move.backward) + else if (keyboard[Keystates::MOVE_BACKWARD] /* || mouse_move.backward*/ || forced_move.backward) + moveangle = FixAngle(moveangle - Angle_45); else moveangle = FixAngle(moveangle + Angle_90); strafe = STRAFE_RIGHT; @@ -495,9 +512,11 @@ bool cPlayer::Update(void) if (keyboard[Keystates::SIDESTEP_LEFT]) { // handle angles for combined strafe / forwards / backwards move - if (keyboard[Keystates::MOVE_FORWARD] || mouse_move.forward || forced_move.forward) + + if (keyboard[Keystates::MOVE_FORWARD] /* || mouse_move.forward */ || forced_move.forward) moveangle = FixAngle(angle - Angle_45); - else if (keyboard[Keystates::MOVE_BACKWARD] || mouse_move.backward || forced_move.backward) + else if (keyboard[Keystates::MOVE_BACKWARD] /* || mouse_move.backward */ || forced_move.backward) + moveangle = FixAngle(moveangle + Angle_45); else moveangle = FixAngle(moveangle - Angle_90); strafe = STRAFE_LEFT; @@ -509,46 +528,52 @@ bool cPlayer::Update(void) if (!spin) keyboard[Keystates::TURN_RIGHT] = 0; - if (keyboard[Keystates::TURN_RIGHT] || mouse_move.right || mouse_look.right || forced_move.right) + + //check if mousekey is pressed, and equal or over 3 relative cords + if (mouse_look.looking && mouse.MouseXorYOverThree())/* || mouse_move.right || mouse_look.right*/ { - if (mouse_look.looking) - turnrate += (timing->nticks*speed*options.turnrate*mouse_look.xratio); - else if (mouse_move.moving) - turnrate += (timing->nticks*speed*options.turnrate*mouse_move.xratio); - else - turnrate += (timing->nticks*speed*options.turnrate); + //calc turn rate + turnrate += (timing->nticks * speed * options.turnrate/2 * mouse.GetPosX()); + //clean up mouse bool=false cord = 0; + mouse.MouseXorYBoolSet(false); + mouse.SetPosX(0); } - - else if (keyboard[Keystates::TURN_LEFT] || mouse_move.left || mouse_look.left || forced_move.left) + else if (keyboard[Keystates::TURN_RIGHT] || forced_move.right) { - if (mouse_look.looking) - turnrate -= (timing->nticks*speed*options.turnrate*mouse_look.xratio); - else if (mouse_move.moving) - turnrate -= (timing->nticks*speed*options.turnrate*mouse_move.xratio); - else - turnrate -= (timing->nticks*speed*options.turnrate); + turnrate += (timing->nticks * speed * options.turnrate); + } + else if (keyboard[Keystates::TURN_LEFT] || forced_move.left) /* || mouse_move.left || mouse_look.left */ + { + turnrate -= (timing->nticks * speed * options.turnrate); } + else + { + turnrate = 0; + } + + if (turnrate > (options.turnrate * speed)) + turnrate = options.turnrate * speed; + else if (turnrate < -(options.turnrate * speed)) + turnrate = -options.turnrate * speed; - if (turnrate > (options.turnrate*speed)) - turnrate = options.turnrate*speed; - else if (turnrate < -(options.turnrate*speed)) - turnrate = -options.turnrate*speed; angle = FixAngle(angle + (int)(turnrate)); moveangle = angle; } } - if (move && (keyboard[Keystates::MOVE_FORWARD] || mouse_move.forward || forced_move.forward)) + + if (move && (keyboard[Keystates::MOVE_FORWARD] /* || mouse_move.forward */ || forced_move.forward)) velocity = MAXWALK; - else if (move && (keyboard[Keystates::MOVE_BACKWARD] || mouse_move.backward || forced_move.backward)) + else if (move && (keyboard[Keystates::MOVE_BACKWARD] /* || mouse_move.backward */ || forced_move.backward)) velocity = -MAXWALK; else if (move && ((keyboard[Keystates::SIDESTEP_RIGHT] || keyboard[Keystates::SIDESTEP_LEFT]) || ((keyboard[Keystates::STRAFE] || forced_move.strafe) && - (keyboard[Keystates::TURN_RIGHT] || mouse_move.right || forced_move.right - || keyboard[Keystates::TURN_LEFT] || mouse_move.left || forced_move.left)))) + (keyboard[Keystates::TURN_RIGHT] /* || mouse_move.right*/ || forced_move.right + || keyboard[Keystates::TURN_LEFT] /*|| mouse_move.left */ || forced_move.left)))) velocity = MAXSTRAFE; - else if ((z > xheight - (0.1*physht)) && (z < xheight + (0.1*physht))) + else if ((z > xheight - (0.1 * physht)) && (z < xheight + (0.1 * physht))) + { if (velocity > 0) { @@ -570,11 +595,13 @@ bool cPlayer::Update(void) move_result_t res; if (strafe != NO_STRAFE) { // make sure deceleration doesn't drag player forward after a strafe + MoveActor(this, moveangle, velocity*timing->nticks*speed, MOVE_NORMAL, &res); velocity = 0.0f; } else MoveActor(this, moveangle, velocity*timing->nticks*speed, MOVE_NORMAL, &res); + if (flags & ACTOR_FLY) { if (res.hit == HIT_FLOOR || res.hit == HIT_WALL || res.hit == HIT_CEILING || res.hit == HIT_ACTOR) @@ -630,7 +657,9 @@ bool cPlayer::Update(void) gs->SendPositionUpdate(TRIGGER_MOVE); if (!was_in_water && this->InWater() && !(flags & ACTOR_SOULSPHERE) && - ((z > xheight - (.1*physht)) && (z < xheight + (.1*physht)))) + + ((z > xheight - (.1 * physht)) && (z < xheight + (.1 * physht)))) + cDS->PlaySound(LyraSound::ENTER_WATER, x, y, false); if (keyboard[Keystates::TRIP] && move) @@ -651,31 +680,37 @@ bool cPlayer::Update(void) vertical_tilt_float = (float)(vertical_tilt_origin); } } - else if (move && (keyboard[Keystates::LOOK_DOWN] || mouse_look.down)) // look down - { - if (mouse_look.down && mouse_look.looking) - vertical_tilt_float -= timing->nticks*(float)UPDOWNVEL*mouse_look.yratio; - else - vertical_tilt_float -= timing->nticks*(float)UPDOWNVEL; - if (vertical_tilt_float < -physht) - { - vertical_tilt_float = (-physht); - } + else if (move && (keyboard[Keystates::LOOK_DOWN]))// look down //simplified ~christy 7/11/21 + { + vertical_tilt_float -= timing->nticks * (float)UPDOWNVEL; } - else if (move && (keyboard[Keystates::LOOK_UP] || mouse_look.up)) // || (reset_speed == -1)) // look up + else if (move && (keyboard[Keystates::LOOK_UP])) { - if (mouse_look.up && mouse_look.looking) - vertical_tilt_float += timing->nticks*(float)UPDOWNVEL*mouse_look.yratio; - else - vertical_tilt_float += timing->nticks*(float)UPDOWNVEL; + vertical_tilt_float += timing->nticks * (float)UPDOWNVEL; + } - if (vertical_tilt_float > max_vertical_tilt + physht) + else if (move && mouse_look.looking) //if movement is possible and mosuelook key is still true + { + if (mouse.MouseXorYOverThree()) //check mouse relative cords { - vertical_tilt_float = max_vertical_tilt + physht; // ???? - reset_speed = 0.0f; + //set tilt to up or down based on ticks value for updown, and mosue pos y + vertical_tilt_float -= timing->nticks * (float)UPDOWNVEL * mouse.GetPosY(); + mouse.SetPosY(0); // reset pos 0 + mouse.MouseXorYBoolSet(false); // reset bool for mouse over/under 2 } } + + if (vertical_tilt_float < -physht) + { + vertical_tilt_float = (-physht); + } + else if (vertical_tilt_float > max_vertical_tilt + physht) + { + vertical_tilt_float = max_vertical_tilt + physht; // ???? + reset_speed = 0.0f; + } + vertical_tilt = (long)vertical_tilt_float; if ((z > xheight - (.1*physht)) && ((z < xheight + (.1*physht)) || (flags & ACTOR_FLY)) && diff --git a/Underlight/cPlayer.h b/Underlight/cPlayer.h index 48adb39..e66792b 100644 --- a/Underlight/cPlayer.h +++ b/Underlight/cPlayer.h @@ -98,6 +98,7 @@ class cPlayer : public cActor enum { INVALID_PLAYERID = -1 }; + protected: lyra_id_t playerID; TCHAR upper_name[Lyra::PLAYERNAME_MAX]; diff --git a/Underlight/globals.json b/Underlight/globals.json new file mode 100644 index 0000000..2d1519b --- /dev/null +++ b/Underlight/globals.json @@ -0,0 +1,10 @@ +{ + "account_index": 0, + "bind_local_tcp": 0, + "bind_local_udp": 9599, + "dev_server": 1, + "custom_ip": "127.0.0.1", + "debug": 0, + "network": 0, + "last_username": "" +} \ No newline at end of file diff --git a/assets/agents.txt b/assets/agents.txt index d96b4b1..4af2c51 100644 --- a/assets/agents.txt +++ b/assets/agents.txt @@ -10,4 +10,4 @@ Bogrom_58 358 test 7175 7500 3 29 3 Bogrom_59 359 test 7176 7500 3 29 1 Shamblix_6 536 test 7264 7500 5 29 2 Shamblix_7 537 test 7265 7500 5 29 0 -Shamblix_8 538 test 7266 7500 5 29 3 +Shamblix_8 538 test 7266 7500 5 29 3 \ No newline at end of file