diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 3a67b96..3f575b2 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -11,6 +11,8 @@ set(CMAKE_VERBOSE_MAKEFILE ON) set(src_io ./redalert/io/userinput.cpp ./redalert/io/userinput.h + ./redalert/io/eventqueue.h + ./redalert/io/eventqueue.cpp ) set(src_win32lib diff --git a/code/redalert/display.h b/code/redalert/display.h index f47315a..ddd2cb0 100644 --- a/code/redalert/display.h +++ b/code/redalert/display.h @@ -275,7 +275,7 @@ class DisplayClass: public MapClass */ class TacticalClass : public GadgetClass { public: - TacticalClass(void) : GadgetClass(0,0,0,0,LEFTPRESS|LEFTRELEASE|LEFTHELD|LEFTUP|RIGHTPRESS,true) {}; + TacticalClass(void) : GadgetClass(0,0,0,0,KEYBOARD|LEFTPRESS|LEFTRELEASE|LEFTHELD|LEFTUP|RIGHTPRESS,true) {}; int Selection_At_Mouse(unsigned flags, KeyNumType & key); int Command_Object(unsigned flags, KeyNumType & key); diff --git a/code/redalert/edit.cpp b/code/redalert/edit.cpp index 45783a9..1684c36 100644 --- a/code/redalert/edit.cpp +++ b/code/redalert/edit.cpp @@ -253,39 +253,8 @@ int EditClass::Action(unsigned flags, KeyNumType & key) } else { #ifdef WIN32 - KeyASCIIType ascii = (KeyASCIIType)(Keyboard->To_ASCII(key) & 0xff); - - /* - ** Allow numeric keypad presses to map to ascii numbers - */ - if ((key & WWKEY_VK_BIT) && ascii >='0' && ascii <= '9') { - - key = (KeyNumType)(key & ~WWKEY_VK_BIT); - if ( (!(flags & LEFTRELEASE)) && (!(flags & RIGHTRELEASE))) { - if (Handle_Key (ascii) ) { - flags &= ~KEYBOARD; - key = KN_NONE; - } - } - } else { - /* - ** Filter out all special keys except return and backspace - */ if ((!(key & WWKEY_VK_BIT) && ascii >= ' ' && ascii <= 255) - || key == KN_RETURN || key == KN_BACKSPACE) { - - - - if ((!(flags & LEFTRELEASE)) && (!(flags & RIGHTRELEASE))) { - if (Handle_Key(Keyboard->To_ASCII(key))) { - flags &= ~KEYBOARD; - key = KN_NONE; - } - } - } else { - flags &= ~KEYBOARD; - key = KN_NONE; - } - } + //KeyASCIIType ascii = (KeyASCIIType)(Keyboard->To_ASCII(key) & 0xff); + Handle_Key(key, flags); } #else //WIN32 @@ -374,11 +343,12 @@ void EditClass::Draw_Text(char const * text) * HISTORY: * * 01/21/1995 JLB : Created. * *=============================================================================================*/ -bool EditClass::Handle_Key(KeyASCIIType ascii) +bool EditClass::Handle_Key(KeyNumType key, unsigned flags) { - unsigned char testAscii = (unsigned char)ascii; + unsigned char testAscii = UserInput.KeyB.ASCII; + //if (key & KN_SHIFT_BIT || key & KN_CAPSLOCK_BIT) testAscii = toupper(testAscii); - switch (ascii) { + switch (key & 0xff) { /* ** Handle the special case of a non-keyboard event. It is possible that this ** key code might be passed to this routine if this routine has been overridden @@ -394,14 +364,14 @@ bool EditClass::Handle_Key(KeyASCIIType ascii) ** so that the controlling program will know that the text can be ** processed. */ - case KA_RETURN: + case KN_RETURN: Clear_Focus(); return(false); /* ** When the BACKSPACE key is pressed, remove the last character in the edit string. */ - case KA_BACKSPACE: + case KN_BACKSPACE: if (Length) { Length--; String[Length] = '\0'; @@ -457,6 +427,7 @@ bool EditClass::Handle_Key(KeyASCIIType ascii) */ String[Length++] = testAscii; String[Length] = '\0'; + Flag_To_Redraw(); break; } diff --git a/code/redalert/edit.h b/code/redalert/edit.h index 92168d9..5d861ad 100644 --- a/code/redalert/edit.h +++ b/code/redalert/edit.h @@ -91,7 +91,7 @@ class EditClass : public ControlClass virtual int Action (unsigned flags, KeyNumType &key); virtual void Draw_Background(void); virtual void Draw_Text(char const * text); - virtual bool Handle_Key(KeyASCIIType ascii); + virtual bool Handle_Key(KeyNumType ascii, unsigned flags); private: int IsReadOnly; diff --git a/code/redalert/io/eventqueue.cpp b/code/redalert/io/eventqueue.cpp new file mode 100644 index 0000000..eef7a05 --- /dev/null +++ b/code/redalert/io/eventqueue.cpp @@ -0,0 +1,157 @@ +#include "../FUNCTION.H" +#include "EventQueue.h" + +/* + Clears the event queue and frees memory +*/ +void EventQueueClass::Clear() +{ + while (this->eventQueue.size() > 0) { + this->eventQueue.pop(); + } +} + +/* + Inserts a new event message event into the FIFO buffer. +*/ +void EventQueueClass::Put(EventMessage input) +{ + if ( Is_Buffer_Full() ) return; + this->eventQueue.push( input ); +} + +/* + Check if the buffer contains an element +*/ +bool EventQueueClass::Check() const +{ + return !this->Is_Buffer_Empty(); +} + +/* + Get the first (unprocessed) element in the event queue +*/ +EventMessage EventQueueClass::Get() +{ + // wait for buffer + while( !this->Check() ) { } + + EventMessage returnVal = this->eventQueue.front(); + this->eventQueue.pop(); + + return returnVal; +} + +/* + Returns ASCII value of the key in the buffer +*/ +char EventQueueClass::Get_ASCII() +{ + // get the last key from the buffer + EventMessage eventMessage = this->Get(); + return eventMessage.Keyboard.ASCII; +} + +EventMessage::EventMessage(KeyNumType key, char ascii, bool shift, bool alt, bool control, bool capsLock) { + this->Clear(); + + this->Valid = true; + this->EventType = EventMessageType::EVENT_KEYBOARD; + + this->Keyboard.Key = key; + this->Keyboard.Shift = shift; + this->Keyboard.Alt = alt; + this->Keyboard.Control = control; + this->Keyboard.CapsLock = capsLock; + this->Keyboard.ASCII = ascii; +} + +EventMessage::EventMessage(int x, int y, unsigned short button, MouseButtonState buttonState) +{ + this->Clear(); + + this->Valid = true; + this->EventType = EventMessageType::EVENT_MOUSE; + + this->Mouse.x = x; + this->Mouse.y = y; + this->Mouse.Button = button; + this->Mouse.ButtonState = buttonState; + + this->Flags = 0; + + if (buttonState == MouseButtonState::MOUSE_BUTTON_UP) { + this->Flags = (button == KN_LMOUSE) ? GadgetClass::LEFTUP : GadgetClass::RIGHTUP; + } + + if (buttonState == MouseButtonState::MOUSE_BUTTON_DOWN) { + this->Flags = (button == KN_LMOUSE) ? GadgetClass::LEFTPRESS : GadgetClass::RIGHTPRESS; + } + + if (buttonState == MouseButtonState::MOUSE_BUTTON_HOLD) { + this->Flags = (button == KN_LMOUSE) ? GadgetClass::LEFTHELD : GadgetClass::RIGHTHELD; + } + + if (buttonState == MouseButtonState::MOUSE_BUTTON_RELEASE) { + this->Flags = (button == KN_LMOUSE) ? GadgetClass::LEFTRELEASE : GadgetClass::RIGHTRELEASE; + } +} + + +void EventMessage::Key_Flags(KeyNumType& key, int& flags) +{ + if (this->EventType == EventMessageType::EVENT_KEYBOARD) + { + flags = this->Flags; + flags |= GadgetClass::KEYBOARD; + + unsigned short outputKey = this->Keyboard.Key; + + if (this->Keyboard.Shift) outputKey |= KN_SHIFT_BIT; + if (this->Keyboard.Alt) outputKey |= KN_ALT_BIT; + if (this->Keyboard.Control) outputKey |= KN_CTRL_BIT; + + key = (KeyNumType)outputKey; + } + + if (this->EventType == EventMessageType::EVENT_MOUSE) + { + key = (KeyNumType)this->Mouse.Button; + + if (key == KN_LMOUSE) { + switch (this->Mouse.ButtonState) + { + case MouseButtonState::MOUSE_BUTTON_UP: + flags = GadgetClass::LEFTUP; + break; + case MouseButtonState::MOUSE_BUTTON_DOWN: + flags = GadgetClass::LEFTPRESS; + break; + case MouseButtonState::MOUSE_BUTTON_RELEASE: + flags = GadgetClass::LEFTRELEASE; + break; + case MouseButtonState::MOUSE_BUTTON_HOLD: + flags = GadgetClass::LEFTHELD; + break; + } + } + + if (key == KN_RMOUSE) { + switch (this->Mouse.ButtonState) + { + case MouseButtonState::MOUSE_BUTTON_UP: + flags = GadgetClass::LEFTUP; + break; + case MouseButtonState::MOUSE_BUTTON_DOWN: + flags = GadgetClass::RIGHTPRESS; + break; + case MouseButtonState::MOUSE_BUTTON_RELEASE: + flags = GadgetClass::RIGHTRELEASE; + break; + case MouseButtonState::MOUSE_BUTTON_HOLD: + flags = GadgetClass::RIGHTHELD; + break; + } + } + } +} \ No newline at end of file diff --git a/code/redalert/io/eventqueue.h b/code/redalert/io/eventqueue.h new file mode 100644 index 0000000..be92699 --- /dev/null +++ b/code/redalert/io/eventqueue.h @@ -0,0 +1,121 @@ +#pragma once +#include + +/* +* WWKeyboardClass::Buff_Get -- Lowlevel function to get a key from key buffer* +* WWKeyboardClass::Check -- Checks to see if a key is in the buffer* +* WWKeyboardClass::Down -- Checks to see if the specified key is being held down.* +* WWKeyboardClass::Fetch_Element -- Extract the next element in the keyboard buffer.* +* WWKeyboardClass::Get -- Logic to get a metakey from the buffer* +* WWKeyboardClass::Message_Handler -- Process a windows message as it relates to the keyboar* +* WWKeyboardClass::Peek_Element -- Fetches the next element in the keyboard buffer.* +* WWKeyboardClass::To_ASCII -- Convert the key value into an ASCII representation.* +* WWKeyboardClass::Available_Buffer_Room -- Fetch the quantity of free elements in the keybo* +* ----------------------------------------------*/ + +/** +* EVENT QUEUE class +* Supports pumping of event messages using a FIFO buffer. +*/ + +extern UserInputClass UserInput; + +/* + Event type definitions +*/ +typedef enum EventMessageType { + EVENT_NONE, + EVENT_KEYBOARD, + EVENT_MOUSE +}; + +/* + Event types +*/ +class EventMessage { + public: + EventMessageType EventType; + bool Valid; + + EventMessage() { + this->EventType == EVENT_NONE; + + this->Keyboard.Key = KN_NONE; + this->Keyboard.Shift = false; + this->Keyboard.Alt = false; + this->Keyboard.Control = false; + this->Keyboard.CapsLock = false; + + this->Mouse.x = -1; + this->Mouse.y = -1; + this->Mouse.Button = 0; + this->Mouse.ButtonState = MouseButtonState::MOUSE_BUTTON_UP; + + this->Flags = 0; + + this->Valid = false; + } + + // for keyboard + struct { + KeyNumType Key; + char ASCII; + bool Shift; + bool Alt; + bool Control; + bool CapsLock; + } Keyboard; + + // for mouse + struct { + int x; + int y; + unsigned short Button; + MouseButtonState ButtonState; + } Mouse; + + // for cascading functions + unsigned short Flags; + + EventMessage( KeyNumType key, char asciis, bool shift, bool alt, bool control, bool capsLock ); + EventMessage( int x, int y, unsigned short button = KN_LMOUSE, MouseButtonState buttonState = MouseButtonState::MOUSE_BUTTON_DOWN ); + + void Key_Flags(KeyNumType& key, int& flags); + private: + void Clear() { + this->Keyboard.Key = KN_NONE; + this->Keyboard.Shift = false; + this->Keyboard.Alt = false; + this->Keyboard.Control = false; + this->Keyboard.CapsLock = false; + + this->Mouse.x = -1; + this->Mouse.y = -1; + this->Mouse.Button = 0; + this->Mouse.ButtonState = MouseButtonState::MOUSE_BUTTON_UP; + + this->Flags = 0; + + this->Valid = false; + } +}; + +class EventQueueClass { + public: + int Get_Mouse_X() const { return UserInput.Mouse.X; } + int Get_Mouse_Y() const { return UserInput.Mouse.Y; } + + void Clear(); + void Put(EventMessage input); + bool Check() const; + EventMessage Get(); + char EventQueueClass::Get_ASCII(); + + private: + const int MaxCapacity = 100; + + std::queue< EventMessage > eventQueue; + + bool Is_Buffer_Full() const { return this->eventQueue.size() == MaxCapacity; } + bool Is_Buffer_Empty() const { return this->eventQueue.size() == 0; } +}; diff --git a/code/redalert/io/userinput.h b/code/redalert/io/userinput.h index 2ef72f3..d6cc690 100644 --- a/code/redalert/io/userinput.h +++ b/code/redalert/io/userinput.h @@ -1,9 +1,9 @@ -#ifndef USERINPUT_H -#define USERINPUT_H +#pragma once #include #include #include +#include #include "examples/imgui_impl_sdl.h" @@ -86,42 +86,58 @@ std::map const sdl_keyMapping = { { SDLK_DOWN, KN_DOWN }, { SDLK_LEFT, KN_LEFT }, { SDLK_RIGHT, KN_RIGHT }, + + { SDLK_LALT, KN_LALT }, + { SDLK_RALT, KN_RALT }, + { SDLK_LCTRL, KN_LCTRL }, + { SDLK_RCTRL, KN_RCTRL }, + { SDLK_LSHIFT, KN_LSHIFT }, + { SDLK_RSHIFT, KN_RSHIFT }, }; +extern std::map sdl_keyMapping_reverse; + +const int USERINPUT_SHIFT_BIT = 0x100; +const int USERINPUT_CTRL_BIT = 0x200; +const int USERINPUT_ALT_BIT = 0x400; + +typedef enum { + MOUSE_BUTTON_UP, + MOUSE_BUTTON_DOWN, + MOUSE_BUTTON_HOLD, + MOUSE_BUTTON_RELEASE, +} MouseButtonState; + +typedef enum { + INPUT_ACTION_NONE, + INPUT_ACTION_KEYBOARD, + INPUT_ACTION_MOUSE, +} InputAction; class UserInputClass { public: - typedef enum { - MOUSE_BUTTON_UP, - MOUSE_BUTTON_DOWN, - MOUSE_BUTTON_HOLD, - MOUSE_BUTTON_RELEASE, - } MouseButtonState; - - typedef enum { - INPUT_ACTION_NONE, - INPUT_ACTION_KEYBOARD, - INPUT_ACTION_MOUSE, - } InputAction; - - void UserInputClass::Process_Input(KeyNumType& key = g_globalKeyNumType, int& flags = g_globalKeyFlags); + UserInputClass(); + void UserInputClass::Process_Input( KeyNumType& key = g_globalKeyNumType, int& flags = g_globalKeyFlags ); InputAction LastAction; class KeyboardState { - public: - SDL_KeyCode LastKey; - char ASCII; + public: + SDL_KeyCode LastKey; + char ASCII; - bool Shift; - bool Control; - bool Alt; + bool Shift; + bool Control; + bool Alt; + bool CapsLock; - void ResetState() { - this->Shift = false; - this->Control = false; - this->Alt = false; - } + bool Key_Down(KeyNumType key) const; + + void ResetState() { + this->Shift = false; + this->Control = false; + this->Alt = false; + } }; KeyboardState KeyB; @@ -135,6 +151,8 @@ class UserInputClass MouseButtonState Button_Middle; MouseButtonState Button_Right; + bool UserInputClass::MouseState::Mouse_Down(KeyNumType key) const; + void ResetState() { this->Button_Left = MouseButtonState::MOUSE_BUTTON_UP; this->Button_Middle = MouseButtonState::MOUSE_BUTTON_UP; @@ -145,6 +163,4 @@ class UserInputClass MouseState Mouse; private: int numFramesLMouse = 0; -}; - -#endif \ No newline at end of file +}; \ No newline at end of file diff --git a/code/redalert/key.h b/code/redalert/key.h index 3a09594..263c1ae 100644 --- a/code/redalert/key.h +++ b/code/redalert/key.h @@ -523,121 +523,126 @@ typedef enum KeyASCIIType { typedef enum KeyNumType { - KN_NONE = 0, + KN_NONE = 0, - KN_0 = VK_0, - KN_1 = VK_1, - KN_2 = VK_2, - KN_3 = VK_3, - KN_4 = VK_4, - KN_5 = VK_5, - KN_6 = VK_6, - KN_7 = VK_7, - KN_8 = VK_8, - KN_9 = VK_9, - KN_A = VK_A, - KN_B = VK_B, - KN_BACKSLASH = VK_NONE_DC, - KN_BACKSPACE = VK_BACK, - KN_C = VK_C, - KN_CAPSLOCK = VK_CAPITAL, - KN_CENTER = VK_CLEAR, - KN_COMMA = VK_NONE_BC, - KN_D = VK_D, - KN_DELETE = VK_DELETE, - KN_DOWN = VK_DOWN, - KN_DOWNLEFT = VK_END, - KN_DOWNRIGHT = VK_NEXT, - KN_E = VK_E, - KN_END = VK_END, - KN_EQUAL = VK_NONE_BB, - KN_ESC = VK_ESCAPE, - KN_E_DELETE = VK_DELETE, - KN_E_DOWN = VK_NUMPAD2, - KN_E_END = VK_NUMPAD1, - KN_E_HOME = VK_NUMPAD7, - KN_E_INSERT = VK_INSERT, - KN_E_LEFT = VK_NUMPAD4, - KN_E_PGDN = VK_NUMPAD3, - KN_E_PGUP = VK_NUMPAD9, - KN_E_RIGHT = VK_NUMPAD6, - KN_E_UP = VK_NUMPAD8, - KN_F = VK_F, - KN_F1 = VK_F1, - KN_F10 = 67, - KN_F11 = 68, - KN_F12 = 69, - KN_F2 = 59, - KN_F3 = 60, - KN_F4 = 61, - KN_F5 = 62, - KN_F6 = 63, - KN_F7 = 64, - KN_F8 = 65, - KN_F9 = 66, - KN_G = VK_G, - KN_GRAVE = VK_NONE_C0, - KN_H = VK_H, - KN_HOME = VK_HOME, - KN_I = VK_I, - KN_INSERT = VK_INSERT, - KN_J = VK_J, - KN_K = VK_K, - KN_KEYPAD_ASTERISK= VK_MULTIPLY, - KN_KEYPAD_MINUS = VK_SUBTRACT, - KN_KEYPAD_PLUS = VK_ADD, - KN_KEYPAD_RETURN = VK_RETURN, - KN_KEYPAD_SLASH = VK_DIVIDE, - KN_L = VK_L, - KN_LALT = VK_MENU, - KN_LBRACKET = VK_NONE_DB, - KN_LCTRL = VK_CONTROL, - KN_LEFT = VK_LEFT, - KN_LMOUSE = VK_LBUTTON, - KN_LSHIFT = VK_SHIFT, - KN_M = VK_M, - KN_MINUS = VK_NONE_BD, - KN_N = VK_N, - KN_NUMLOCK = VK_NUMLOCK, - KN_O = VK_O, - KN_P = VK_P, - KN_PAUSE = VK_PAUSE, - KN_PERIOD = VK_NONE_BE, - KN_PGDN = VK_NEXT, - KN_PGUP = VK_PRIOR, - KN_PRNTSCRN = VK_PRINT, - KN_Q = VK_Q, - KN_R = VK_R, - KN_RALT = VK_MENU, - KN_RBRACKET = VK_NONE_DD, - KN_RCTRL = VK_CONTROL, - KN_RETURN = VK_RETURN, - KN_RIGHT = VK_RIGHT, - KN_RMOUSE = VK_RBUTTON, - KN_RSHIFT = VK_SHIFT, - KN_S = VK_S, - KN_SCROLLLOCK = VK_SCROLL, - KN_SEMICOLON = VK_NONE_BA, - KN_SLASH = VK_NONE_BF, - KN_SPACE = VK_SPACE, - KN_SQUOTE = VK_NONE_DE, - KN_T = VK_T, - KN_TAB = VK_TAB, - KN_U = VK_U, - KN_UP = VK_UP, - KN_UPLEFT = VK_HOME, - KN_UPRIGHT = VK_PRIOR, - KN_V = VK_V, - KN_W = VK_W, - KN_X = VK_X, - KN_Y = VK_Y, - KN_Z = VK_Z, + KN_0, + KN_1, + KN_2, + KN_3, + KN_4, + KN_5, + KN_6, + KN_7, + KN_8, + KN_9, + KN_A, + KN_B, + KN_C, + KN_D, + KN_E, + KN_F, + KN_G, + KN_H, + KN_I, + KN_J, + KN_K, + KN_L, + KN_M, + KN_N, + KN_O, + KN_P, + KN_Q, + KN_R, + KN_S, + KN_T, + KN_U, + KN_V, + KN_W, + KN_X, + KN_Y, + KN_Z, + + KN_BACKSLASH, + KN_BACKSPACE, + KN_CAPSLOCK, + KN_CENTER, + KN_COMMA, + KN_DELETE, + KN_DOWN, + KN_DOWNLEFT, + KN_DOWNRIGHT, + KN_END, + KN_EQUAL, + KN_ESC, + KN_E_DELETE, + KN_E_DOWN, + KN_E_END, + KN_E_HOME, + KN_E_INSERT, + KN_E_LEFT, + KN_E_PGDN, + KN_E_PGUP, + KN_E_RIGHT, + KN_E_UP, + KN_GRAVE, + KN_HOME, + KN_INSERT, + KN_KEYPAD_ASTERISK, + KN_KEYPAD_MINUS, + KN_KEYPAD_PLUS, + KN_KEYPAD_RETURN, + KN_KEYPAD_SLASH, + KN_MINUS, + KN_NUMLOCK, + KN_PAUSE, + KN_PERIOD, + KN_PGDN, + KN_PGUP, + KN_PRNTSCRN, + KN_SCROLLLOCK, + KN_SEMICOLON, + KN_SLASH, + KN_SPACE, + KN_SQUOTE, + KN_TAB, + KN_UP, + KN_UPLEFT, + KN_UPRIGHT, + + KN_LALT, + KN_LBRACKET, + KN_LCTRL, + KN_LEFT, + KN_LMOUSE, + KN_LSHIFT, + + KN_RALT, + KN_RBRACKET, + KN_RCTRL, + KN_RETURN, + KN_RIGHT, + KN_RMOUSE, + KN_RSHIFT, + + KN_F1, + KN_F2, + KN_F3, + KN_F4, + KN_F5, + KN_F6, + KN_F7, + KN_F8, + KN_F9, + KN_F10, + KN_F11, + KN_F12, KN_SHIFT_BIT = WWKEY_SHIFT_BIT, KN_CTRL_BIT = WWKEY_CTRL_BIT, KN_ALT_BIT = WWKEY_ALT_BIT, KN_RLSE_BIT = WWKEY_RLS_BIT, KN_BUTTON = WWKEY_BTN_BIT, + KN_CAPSLOCK_BIT = WWKEY_SHIFT_BIT, } KeyNumType; diff --git a/code/redalert/shapebtn.cpp b/code/redalert/shapebtn.cpp index ea07f16..7d1dc59 100644 --- a/code/redalert/shapebtn.cpp +++ b/code/redalert/shapebtn.cpp @@ -164,6 +164,7 @@ int ShapeButtonClass::Draw_Me(int forced) } CC_Draw_Shape(ShapeData, shapenum, X, Y, WINDOW_MAIN, SHAPE_NORMAL); + /* ** Display the mouse. */ diff --git a/code/redalert/sidebar.cpp b/code/redalert/sidebar.cpp index f3db0df..2a9912e 100644 --- a/code/redalert/sidebar.cpp +++ b/code/redalert/sidebar.cpp @@ -759,6 +759,9 @@ bool SidebarClass::Scroll(bool up, int column) *=============================================================================================*/ void SidebarClass::Draw_It(bool complete) { + /* Draw black background */ + GL_FillRect(TBLACK, SIDE_X * RESFACTOR, 8 * RESFACTOR, SIDE_WIDTH * RESFACTOR, ScreenHeight - (8 * RESFACTOR)); + PowerClass::Draw_It(complete); BStart(BENCH_SIDEBAR); @@ -772,19 +775,16 @@ void SidebarClass::Draw_It(bool complete) */ int shape = complete ? 0 : 1; - /* - ** The sidebar shape is too big in 640x400 so it needs to be drawn in three chunks. - */ CC_Draw_Shape(SidebarShape, 0, SIDE_X * RESFACTOR, 8*RESFACTOR, WINDOW_MAIN, SHAPE_WIN_REL); - // @@ this one repeats CC_Draw_Shape(SidebarMiddleShape, shape, SIDE_X * RESFACTOR, (8+80)*RESFACTOR, WINDOW_MAIN, SHAPE_WIN_REL); - - CC_Draw_Shape(SidebarBottomShape, shape, SIDE_X * RESFACTOR, ScreenHeight - ( 80*RESFACTOR ), WINDOW_MAIN, SHAPE_WIN_REL); + + CC_Draw_Shape(SidebarBottomShape, shape, SIDE_X * RESFACTOR, ScreenHeight - (80 * RESFACTOR) + 3, WINDOW_MAIN, SHAPE_WIN_REL); Repair.Draw_Me(true); Upgrade.Draw_Me(true); Zoom.Draw_Me(true); + LogicPage->Unlock(); } } @@ -802,7 +802,6 @@ void SidebarClass::Draw_It(bool complete) Zoom.Draw_Me(true); } } - //IsToRedraw = false; BEnd(BENCH_SIDEBAR); } @@ -1226,30 +1225,17 @@ void SidebarClass::StripClass::Init_IO(int id) UpButton[ID].ID = BUTTON_UP+id; UpButton[ID].X = X + (UP_X_OFFSET * RESFACTOR); UpButton[ID].Y = HEIGHT - ( ( OBJECT_HEIGHT + 7 ) * RESFACTOR ); - -#if (FRENCH) -#ifdef WIN32 UpButton[ID].Set_Shape(MFCD::Retrieve("STRIPUP.SHP")); -#else - UpButton[ID].Set_Shape(MFCD::Retrieve("STUP_FIX.SHP")); -#endif -#else //FRENCH - UpButton[ID].Set_Shape(MFCD::Retrieve("STRIPUP.SHP")); -#endif //FRENCH DownButton[ID].IsSticky = true; DownButton[ID].ID = BUTTON_DOWN+id; DownButton[ID].X = X + (DOWN_X_OFFSET * RESFACTOR); DownButton[ID].Y = HEIGHT - ( (OBJECT_HEIGHT + 7 ) * RESFACTOR ); - - /* - ** Buttons are in a slightly different position in the new sidebar - */ - UpButton[ID].Y--; - DownButton[ID].Y--; - DownButton[ID].Set_Shape(MFCD::Retrieve("STRIPDN.SHP")); + UpButton[ID].Y += 3; + DownButton[ID].Y += 3; + for (int index = 0; index < MaxButtonsVisible; index++) { SelectClass & g = SelectButton[ID][index]; g.ID = BUTTON_SELECT; @@ -1828,6 +1814,7 @@ void SidebarClass::StripClass::Draw_It(bool complete) } remapper = 0; + /* ** Now that the shape of the object at the current working slot has been found, ** draw it and any graphic overlays as necessary.