Revert "Merge branch 'master' into master"

This reverts commit b91fab3474, reversing
changes made to 78812727c7.
This commit is contained in:
Justin Marshall
2020-07-02 13:42:08 -07:00
parent abfa27fa06
commit 33b9fd94bd
20 changed files with 740 additions and 1075 deletions
+5 -6
View File
@@ -8,12 +8,11 @@
/fonts /fonts
/sound /sound
/ui /ui
/*.mix
/*.pal
/*.ini
/*.exe /*.exe
/*.ilk /*.ilk
/*.MIX /*.dat
/*.PAL /savegame*
/*.INI
/*.DAT
/SAVEGAME*
/cache
+1 -3
View File
@@ -11,8 +11,6 @@ set(CMAKE_VERBOSE_MAKEFILE ON)
set(src_io set(src_io
./redalert/io/userinput.cpp ./redalert/io/userinput.cpp
./redalert/io/userinput.h ./redalert/io/userinput.h
./redalert/io/eventqueue.h
./redalert/io/eventqueue.cpp
) )
set(src_win32lib set(src_win32lib
@@ -742,4 +740,4 @@ if (UNIX)
set_target_properties(RedAlert PROPERTIES OUTPUT_NAME "RedAlert" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/.." ) set_target_properties(RedAlert PROPERTIES OUTPUT_NAME "RedAlert" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/.." )
endif(UNIX) endif(UNIX)
target_include_directories(RedAlert PRIVATE ./external/xml/;./external/devil/;./external/;./redalert/win32lib;./redalert/io;./external/lua/;./external/imgui;./external/dxsdk/Include;./external/ffmpeg-win32/include;./external/sdl2/include;./win32lib;./external/openal/include) target_include_directories(RedAlert PRIVATE ./external/xml/;./external/devil/;./external/;./redalert/win32lib;./external/lua/;./external/imgui;./external/dxsdk/Include;./external/ffmpeg-win32/include;./external/sdl2/include;./win32lib;./external/openal/include)
+5 -5
View File
@@ -743,7 +743,7 @@ void Keyboard_Process(KeyNumType & input)
** Center the map about the construction yard or construction vehicle ** Center the map about the construction yard or construction vehicle
** if one is present. ** if one is present.
*/ */
if (key != 0 && key == Options.KeyBase) { if (key != 0 && key == VK_H) {
Unselect_All(); Unselect_All();
if (PlayerPtr->CurBuildings) { if (PlayerPtr->CurBuildings) {
for (index = 0; index < Buildings.Count(); index++) { for (index = 0; index < Buildings.Count(); index++) {
@@ -875,19 +875,19 @@ void Keyboard_Process(KeyNumType & input)
** Scrolls the tactical map in the direction specified. ** Scrolls the tactical map in the direction specified.
*/ */
int distance = CELL_LEPTON_W; int distance = CELL_LEPTON_W;
if (key != 0 && key == KN_LEFT) { if (key != 0 && key == VK_LEFT) {
Map.Scroll_Map(DIR_W, distance, true); Map.Scroll_Map(DIR_W, distance, true);
input = KN_NONE; input = KN_NONE;
} }
if (key != 0 && key == KN_RIGHT) { if (key != 0 && key == VK_RIGHT) {
Map.Scroll_Map(DIR_E, distance, true); Map.Scroll_Map(DIR_E, distance, true);
input = KN_NONE; input = KN_NONE;
} }
if (key != 0 && key == KN_UP) { if (key != 0 && key == VK_UP) {
Map.Scroll_Map(DIR_N, distance, true); Map.Scroll_Map(DIR_N, distance, true);
input = KN_NONE; input = KN_NONE;
} }
if (key != 0 && key == KN_DOWN) { if (key != 0 && key == VK_DOWN) {
Map.Scroll_Map(DIR_S, distance, true); Map.Scroll_Map(DIR_S, distance, true);
input = KN_NONE; input = KN_NONE;
} }
+1 -1
View File
@@ -275,7 +275,7 @@ class DisplayClass: public MapClass
*/ */
class TacticalClass : public GadgetClass { class TacticalClass : public GadgetClass {
public: public:
TacticalClass(void) : GadgetClass(0,0,0,0,KEYBOARD|LEFTPRESS|LEFTRELEASE|LEFTHELD|LEFTUP|RIGHTPRESS,true) {}; TacticalClass(void) : GadgetClass(0,0,0,0,LEFTPRESS|LEFTRELEASE|LEFTHELD|LEFTUP|RIGHTPRESS,true) {};
int Selection_At_Mouse(unsigned flags, KeyNumType & key); int Selection_At_Mouse(unsigned flags, KeyNumType & key);
int Command_Object(unsigned flags, KeyNumType & key); int Command_Object(unsigned flags, KeyNumType & key);
+48 -21
View File
@@ -253,8 +253,39 @@ int EditClass::Action(unsigned flags, KeyNumType & key)
} else { } else {
#ifdef WIN32 #ifdef WIN32
//KeyASCIIType ascii = (KeyASCIIType)(Keyboard->To_ASCII(key) & 0xff); KeyASCIIType ascii = (KeyASCIIType)(Keyboard->To_ASCII(key) & 0xff);
Handle_Key(key, flags);
/*
** 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;
}
}
} }
#else //WIN32 #else //WIN32
@@ -343,11 +374,11 @@ void EditClass::Draw_Text(char const * text)
* HISTORY: * * HISTORY: *
* 01/21/1995 JLB : Created. * * 01/21/1995 JLB : Created. *
*=============================================================================================*/ *=============================================================================================*/
bool EditClass::Handle_Key(KeyNumType key, unsigned flags) bool EditClass::Handle_Key(KeyASCIIType ascii)
{ {
unsigned rawKey = key & 0xff; unsigned char testAscii = (unsigned char)ascii;
switch (rawKey) { switch (ascii) {
/* /*
** Handle the special case of a non-keyboard event. It is possible that this ** 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 ** key code might be passed to this routine if this routine has been overridden
@@ -356,7 +387,6 @@ bool EditClass::Handle_Key(KeyNumType key, unsigned flags)
case 0: case 0:
break; break;
/* /*
** If the return key is pressed, then remove the focus from this edit ** If the return key is pressed, then remove the focus from this edit
** gadget but otherwise let the normal gadget processing proceed. This ** gadget but otherwise let the normal gadget processing proceed. This
@@ -364,14 +394,14 @@ bool EditClass::Handle_Key(KeyNumType key, unsigned flags)
** so that the controlling program will know that the text can be ** so that the controlling program will know that the text can be
** processed. ** processed.
*/ */
case KN_RETURN: case KA_RETURN:
Clear_Focus(); Clear_Focus();
return(false); return(false);
/* /*
** When the BACKSPACE key is pressed, remove the last character in the edit string. ** When the BACKSPACE key is pressed, remove the last character in the edit string.
*/ */
case KN_BACKSPACE: case KA_BACKSPACE:
if (Length) { if (Length) {
Length--; Length--;
String[Length] = '\0'; String[Length] = '\0';
@@ -384,13 +414,11 @@ bool EditClass::Handle_Key(KeyNumType key, unsigned flags)
** if it can legally be added to the edit string and do so if possible. ** if it can legally be added to the edit string and do so if possible.
*/ */
default: default:
unsigned char keyAscii = UserInput.KeyB.ASCII;
if (key & KN_SHIFT_BIT || key & KN_CAPSLOCK_BIT) keyAscii = toupper(keyAscii);
/* /*
** Don't add a character if the length is greater than edit width. ** Don't add a character if the length is greater than edit width.
*/ */
if (((int)String_Pixel_Width(String) + (int)Char_Pixel_Width(keyAscii) ) >= (Width-2)) { if (((int)String_Pixel_Width(String) + (int)Char_Pixel_Width(testAscii) ) >= (Width-2)) {
break; break;
} }
@@ -403,21 +431,21 @@ bool EditClass::Handle_Key(KeyNumType key, unsigned flags)
** Invisible characters are never added to the string. This is ** Invisible characters are never added to the string. This is
** especially true for spaces at the beginning of the string. ** especially true for spaces at the beginning of the string.
*/ */
if (!isgraph(keyAscii) && keyAscii != ' ') break; if (!isgraph(testAscii) && testAscii != ' ') break;
if (keyAscii == ' ' && Length == 0) break; if (testAscii == ' ' && Length == 0) break;
/* /*
** If this is an upper case only edit gadget, then force the alphabetic ** If this is an upper case only edit gadget, then force the alphabetic
** character to upper case. ** character to upper case.
*/ */
if ((EditFlags & UPPERCASE) && isalpha(keyAscii)) { if ((EditFlags & UPPERCASE) && isalpha(testAscii)) {
rawKey = (KeyASCIIType)toupper(keyAscii); testAscii = (KeyASCIIType)toupper(testAscii);
} }
if ((!(EditFlags & NUMERIC) || !isdigit(keyAscii)) && if ((!(EditFlags & NUMERIC) || !isdigit(testAscii)) &&
(!(EditFlags & ALPHA) || !isalpha(keyAscii)) && (!(EditFlags & ALPHA) || !isalpha(testAscii)) &&
(!(EditFlags & MISC) || isalnum(keyAscii)) && (!(EditFlags & MISC) || isalnum(testAscii)) &&
rawKey != ' ') { testAscii != ' ') {
break; break;
} }
@@ -427,9 +455,8 @@ bool EditClass::Handle_Key(KeyNumType key, unsigned flags)
** because the event flag has been cleared. This prevents the gadget's ID ** because the event flag has been cleared. This prevents the gadget's ID
** number from being returned just because the gadget has been edited. ** number from being returned just because the gadget has been edited.
*/ */
String[Length++] = keyAscii; String[Length++] = testAscii;
String[Length] = '\0'; String[Length] = '\0';
Flag_To_Redraw(); Flag_To_Redraw();
break; break;
} }
+1 -1
View File
@@ -91,7 +91,7 @@ class EditClass : public ControlClass
virtual int Action (unsigned flags, KeyNumType &key); virtual int Action (unsigned flags, KeyNumType &key);
virtual void Draw_Background(void); virtual void Draw_Background(void);
virtual void Draw_Text(char const * text); virtual void Draw_Text(char const * text);
virtual bool Handle_Key(KeyNumType ascii, unsigned flags); virtual bool Handle_Key(KeyASCIIType ascii);
private: private:
int IsReadOnly; int IsReadOnly;
-1
View File
@@ -162,7 +162,6 @@ extern PKey SlowKey;
extern RulesClass Rule; extern RulesClass Rule;
extern KeyboardClass * Keyboard; extern KeyboardClass * Keyboard;
extern UserInputClass UserInput; extern UserInputClass UserInput;
extern EventQueueClass EventQueue;
extern RandomStraw CryptRandom; extern RandomStraw CryptRandom;
extern RandomClass NonCriticalRandomNumber; extern RandomClass NonCriticalRandomNumber;
extern CarryoverClass * Carryover; extern CarryoverClass * Carryover;
+1 -2
View File
@@ -200,8 +200,7 @@ struct NoInitClass {
#endif #endif
#include "key.h" #include "key.h"
#include "io/userinput.h" #include "io/UserInput.h"
#include "io/eventqueue.h"
#include <wwlib32.h> #include <wwlib32.h>
#include "mpu.h" #include "mpu.h"
+104 -48
View File
@@ -58,31 +58,31 @@
#include <SDL.h> #include <SDL.h>
/* /*
** This records the current gadget the the gadget system is "stuck on". Such a ** This records the current gadget the the gadget system is "stuck on". Such a
** gadget will be processed to the exclusion of all others until the mouse button ** gadget will be processed to the exclusion of all others until the mouse button
** is no longer pressed. ** is no longer pressed.
*/ */
GadgetClass* GadgetClass::StuckOn = 0; GadgetClass * GadgetClass::StuckOn = 0;
/* /*
** This is a copy of a pointer to the last list used by the gadget input system. ** This is a copy of a pointer to the last list used by the gadget input system.
** If a change of list is detected, then all gadgets are forced to be redrawn. ** If a change of list is detected, then all gadgets are forced to be redrawn.
*/ */
GadgetClass* GadgetClass::LastList = 0; GadgetClass * GadgetClass::LastList = 0;
/* /*
** This points to the gadget that is intercepting all keyboard events. ** This points to the gadget that is intercepting all keyboard events.
*/ */
GadgetClass* GadgetClass::Focused = 0; GadgetClass * GadgetClass::Focused = 0;
/* /*
** This points to the current color scheme for drawing all gadgets. ** This points to the current color scheme for drawing all gadgets.
*/ */
static RemapControlType _GreyScheme = { 15 }; static RemapControlType _GreyScheme = {15};
RemapControlType* GadgetClass::ColorScheme = &_GreyScheme; RemapControlType * GadgetClass::ColorScheme = &_GreyScheme;
/*********************************************************************************************** /***********************************************************************************************
* GadgetClass::GadgetClass -- Constructor for gadget object. * * GadgetClass::GadgetClass -- Constructor for gadget object. *
@@ -110,7 +110,7 @@ GadgetClass::GadgetClass(int x, int y, int w, int h, unsigned flags, int sticky)
X(x), Y(y), Width(w), Height(h), IsToRepaint(false), IsSticky(sticky), IsDisabled(false), Flags(flags) X(x), Y(y), Width(w), Height(h), IsToRepaint(false), IsSticky(sticky), IsDisabled(false), Flags(flags)
{ {
if (IsSticky) { if (IsSticky) {
Flags |= LEFTPRESS | LEFTRELEASE; Flags |= LEFTPRESS|LEFTRELEASE;
} }
} }
@@ -130,7 +130,7 @@ GadgetClass::GadgetClass(int x, int y, int w, int h, unsigned flags, int sticky)
* HISTORY: * * HISTORY: *
* 08/01/1996 JLB : Created. * * 08/01/1996 JLB : Created. *
*=============================================================================================*/ *=============================================================================================*/
GadgetClass::GadgetClass(GadgetClass const& gadget) : GadgetClass::GadgetClass(GadgetClass const & gadget) :
X(gadget.X), X(gadget.X),
Y(gadget.Y), Y(gadget.Y),
Width(gadget.Width), Width(gadget.Width),
@@ -190,7 +190,7 @@ GadgetClass::~GadgetClass(void)
* * * *
* HISTORY: 01/03/1995 MML : Created. * * HISTORY: 01/03/1995 MML : Created. *
*=========================================================================*/ *=========================================================================*/
int GadgetClass::Clicked_On(KeyNumType& key, unsigned flags, int mousex, int mousey) int GadgetClass::Clicked_On(KeyNumType & key, unsigned flags, int mousex, int mousey)
{ {
/* /*
** Set flags to match only those events that occur AND are being looked for. If ** Set flags to match only those events that occur AND are being looked for. If
@@ -281,10 +281,10 @@ void GadgetClass::Disable(void)
* HISTORY: * * HISTORY: *
* 01/15/1995 JLB : Created. * * 01/15/1995 JLB : Created. *
*=============================================================================================*/ *=============================================================================================*/
GadgetClass* GadgetClass::Remove(void) GadgetClass * GadgetClass::Remove(void)
{ {
Clear_Focus(); Clear_Focus();
return(GadgetClass*)LinkClass::Remove(); return(GadgetClass *)LinkClass::Remove();
} }
@@ -303,7 +303,7 @@ GadgetClass* GadgetClass::Remove(void)
* HISTORY: * * HISTORY: *
* 01/15/1995 JLB : Created. * * 01/15/1995 JLB : Created. *
*=============================================================================================*/ *=============================================================================================*/
GadgetClass* GadgetClass::Get_Next(void) const GadgetClass * GadgetClass::Get_Next(void) const
{ {
return(GadgetClass*)LinkClass::Get_Next(); return(GadgetClass*)LinkClass::Get_Next();
} }
@@ -324,7 +324,7 @@ GadgetClass* GadgetClass::Get_Next(void) const
* HISTORY: * * HISTORY: *
* 01/15/1995 JLB : Created. * * 01/15/1995 JLB : Created. *
*=============================================================================================*/ *=============================================================================================*/
GadgetClass* GadgetClass::Get_Prev(void) const GadgetClass * GadgetClass::Get_Prev(void) const
{ {
return(GadgetClass*)LinkClass::Get_Prev(); return(GadgetClass*)LinkClass::Get_Prev();
} }
@@ -347,7 +347,7 @@ GadgetClass* GadgetClass::Get_Prev(void) const
*=============================================================================================*/ *=============================================================================================*/
void GadgetClass::Delete_List(void) void GadgetClass::Delete_List(void)
{ {
GadgetClass* g = this; GadgetClass * g = this;
/* /*
** Move to head of the list. ** Move to head of the list.
@@ -365,7 +365,7 @@ void GadgetClass::Delete_List(void)
while (g) { while (g) {
g->Clear_Focus(); g->Clear_Focus();
GadgetClass* temp = g; GadgetClass * temp = g;
g = g->Get_Next(); g = g->Get_Next();
delete temp; delete temp;
} }
@@ -391,7 +391,7 @@ void GadgetClass::Delete_List(void)
* HISTORY: * * HISTORY: *
* 01/15/1995 JLB : Created. * * 01/15/1995 JLB : Created. *
*=============================================================================================*/ *=============================================================================================*/
int GadgetClass::Action(unsigned flags, KeyNumType&) int GadgetClass::Action(unsigned flags, KeyNumType &)
{ {
/* /*
** If any of the event flags are active, then this indicates that something probably ** If any of the event flags are active, then this indicates that something probably
@@ -450,7 +450,7 @@ int GadgetClass::Draw_Me(int forced)
*=============================================================================================*/ *=============================================================================================*/
void GadgetClass::Draw_All(bool forced) void GadgetClass::Draw_All(bool forced)
{ {
GadgetClass* gadget = this; GadgetClass * gadget = this;
while (gadget != NULL) { while (gadget != NULL) {
gadget->Draw_Me(forced); gadget->Draw_Me(forced);
@@ -471,9 +471,7 @@ void GadgetClass::Draw_All(bool forced)
*=========================================================================*/ *=========================================================================*/
KeyNumType GadgetClass::Input(void) KeyNumType GadgetClass::Input(void)
{ {
EventMessage eventMessage; KeyNumType key;
KeyNumType key = KN_NONE;
int flags = 0;
int forced = false; int forced = false;
/* /*
@@ -490,52 +488,111 @@ KeyNumType GadgetClass::Input(void)
/* /*
** Fetch any pending keyboard input. ** Fetch any pending keyboard input.
*/ */
UserInput.Process_Input(key, flags); key = Keyboard->Check();
if (key != 0) {
if (EventQueue.Check()) { key = Keyboard->Get();
eventMessage = EventQueue.Get();
eventMessage.Key_Flags(key, flags);
} }
/*
** For mouse button clicks, the mouse position is actually held in the MouseQ...
** globals rather than their normal Mouse... globals. This is because we need to
** know the position of the mouse at the exact instant when the click occurred
** rather the the mouse position at the time we get around to this function.
*/
// jmarshall
UserInput.Process_Input( g_globalKeyNumType, g_globalKeyFlags);
int flags = g_globalKeyFlags;
// jmarshall end
/*
** Set the mouse button state flags. These will be passed to the individual
** buttons so that they can determine what action to perform (if any).
*/
//if (key) {
// if (key == KN_LMOUSE) {
// flags |= LEFTPRESS;
// }
// if (key == KN_RMOUSE) {
// flags |= RIGHTPRESS;
// }
// if (key == (KN_LMOUSE | KN_RLSE_BIT)) {
// flags |= LEFTRELEASE;
// }
// if (key == (KN_RMOUSE | KN_RLSE_BIT)) {
// flags |= RIGHTRELEASE;
// }
//}
/*
** If the mouse wasn't responsible for this key code, then it must be from
** the keyboard. Flag this fact.
*/
if (key && !flags) {
flags |= KEYBOARD;
}
/*
** Mouse button up or down action is ignored if there is a keyboard event. This
** allows keyboard events to fall through normally even if the mouse is over a
** gadget that is flagged for LEFTUP or RIGHTUP.
*/
// jmarshall
//if (!key) {
//
// /*
// ** Check for the mouse being held down. We can't use the normal input system
// ** for this, so we must examine the actual current state of the mouse
// ** buttons. As a side note, if we determine that the mouse button isn't being
// ** held down, then we automatically know that it must be up -- set the flag
// ** accordingly.
// */
// if (Keyboard->Down(KN_LMOUSE)) {
// flags |= LEFTHELD;
// } else {
// flags |= LEFTUP;
// }
// if (Keyboard->Down(KN_RMOUSE)) {
// flags |= RIGHTHELD;
// } else {
// flags |= RIGHTUP;
// }
//}
// jmarshall end
/* /*
** If "sticky" processing is active, then only process the stuck gadget. ** If "sticky" processing is active, then only process the stuck gadget.
*/ */
if (StuckOn) { if (StuckOn) {
StuckOn->Draw_Me(false); StuckOn->Draw_Me(false);
GadgetClass* oldstuck = StuckOn; GadgetClass * oldstuck = StuckOn;
StuckOn->Clicked_On(key, flags, UserInput.Mouse.X, UserInput.Mouse.Y); StuckOn->Clicked_On(key, flags, UserInput.Mouse.X, UserInput.Mouse.Y);
if (StuckOn) {
if (StuckOn)
{
StuckOn->Draw_Me(false); StuckOn->Draw_Me(false);
} } else {
else {
oldstuck->Draw_Me(false); oldstuck->Draw_Me(false);
} }
} } else {
else
{
/* /*
** If there is a gadget that has the keyboard focus, then route all keyboard ** If there is a gadget that has the keyboard focus, then route all keyboard
** events to it. ** events to it.
*/ */
if (Focused && eventMessage.EventType == EventMessageType::EVENT_KEYBOARD) { if (Focused && (flags & KEYBOARD)) {
Focused->Draw_Me(false); Focused->Draw_Me(false);
Focused->Clicked_On(key, flags, UserInput.Mouse.X, UserInput.Mouse.Y); Focused->Clicked_On(key, flags, UserInput.Mouse.X, UserInput.Mouse.Y);
if (Focused) { if (Focused) {
Focused->Draw_Me(false); Focused->Draw_Me(false);
} }
} } else {
else {
/* /*
** Sweep through all the buttons in the chain and pass the current button state ** Sweep through all the buttons in the chain and pass the current button state
** and keyboard input data to them. These routines will detect whether they should ** and keyboard input data to them. These routines will detect whether they should
** perform some action and return a flag to this effect. They also have the option ** perform some action and return a flag to this effect. They also have the option
** of changing the key value so that an appropriate return value is used for this ** of changing the key value so that an appropriate return value is use for this
** processing routine. ** processing routine.
*/ */
GadgetClass* next_button = this; GadgetClass * next_button = this;
while (next_button != NULL) { while (next_button != NULL) {
/* /*
@@ -564,7 +621,6 @@ KeyNumType GadgetClass::Input(void)
} }
} }
} }
return(key); return(key);
} }
@@ -589,14 +645,14 @@ KeyNumType GadgetClass::Input(void)
* HISTORY: * * HISTORY: *
* 01/16/1995 JLB : Created. * * 01/16/1995 JLB : Created. *
*=============================================================================================*/ *=============================================================================================*/
ControlClass* GadgetClass::Extract_Gadget(unsigned id) ControlClass * GadgetClass::Extract_Gadget(unsigned id)
{ {
GadgetClass* g = this; GadgetClass * g = this;
if (id != 0) { if (id != 0) {
while (g != NULL) { while (g != NULL) {
if (g->Get_ID() == id) { if (g->Get_ID() == id) {
return((ControlClass*)g); return((ControlClass *)g);
} }
g = g->Get_Next(); g = g->Get_Next();
} }
@@ -745,7 +801,7 @@ bool GadgetClass::Has_Focus(void)
*=============================================================================================*/ *=============================================================================================*/
int GadgetClass::Is_List_To_Redraw(void) int GadgetClass::Is_List_To_Redraw(void)
{ {
GadgetClass* gadget = this; GadgetClass * gadget = this;
while (gadget != NULL) { while (gadget != NULL) {
if (gadget->IsToRepaint) { if (gadget->IsToRepaint) {
-1
View File
@@ -257,7 +257,6 @@ RulesClass Rule;
** user input class pointer. ** user input class pointer.
*/ */
UserInputClass UserInput; UserInputClass UserInput;
EventQueueClass EventQueue;
/*************************************************************************** /***************************************************************************
** All keyboard input is routed through the object pointed to by this ** All keyboard input is routed through the object pointed to by this
-157
View File
@@ -1,157 +0,0 @@
#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;
}
}
}
}
-121
View File
@@ -1,121 +0,0 @@
#pragma once
#include <memory>
/*
* 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; }
};
+19 -96
View File
@@ -1,60 +1,18 @@
#include "../function.h" #include "../FUNCTION.H"
#include "userinput.h" #include "UserInput.h"
extern KeyboardClass* Keyboard; extern KeyboardClass * Keyboard;
std::map<KeyNumType, SDL_KeyCode> sdl_keyMapping_reverse;
UserInputClass::UserInputClass()
{
LastAction = InputAction::INPUT_ACTION_NONE;
// generate reverse keymapping
for (auto it = sdl_keyMapping.begin(); it != sdl_keyMapping.end(); it++)
{
sdl_keyMapping_reverse[it->second] = it->first;
}
}
bool UserInputClass::KeyboardState::Key_Down(KeyNumType key) const
{
auto sdl_Key = sdl_keyMapping_reverse.find(key);
if (sdl_Key != sdl_keyMapping_reverse.end())
{
const SDL_Scancode scanCode = SDL_GetScancodeFromKey(sdl_Key->second);
const Uint8* keyState = SDL_GetKeyboardState(NULL);
return (keyState[scanCode]);
}
return false;
}
bool UserInputClass::MouseState::Mouse_Down(KeyNumType key) const
{
// get mouse state, we are only interested in the buttons
const Uint32 MouseState = SDL_GetMouseState(NULL, NULL);
switch (key)
{
case KN_LMOUSE:
return MouseState & SDL_BUTTON(SDL_BUTTON_LEFT);
break;
case KN_RMOUSE:
return MouseState & SDL_BUTTON(SDL_BUTTON_RIGHT);
break;
}
}
void UserInputClass::Process_Input(KeyNumType& key, int& flags) void UserInputClass::Process_Input(KeyNumType& key, int& flags)
{ {
bool leftMouseProcessed = false; bool leftMouseProcessed = false;
SDL_GetMouseState(&Mouse.X, &Mouse.Y);
const Uint32 MouseState = SDL_GetMouseState(&Mouse.X, &Mouse.Y);
flags = 0;
Keyboard->MouseQX = Mouse.X; Keyboard->MouseQX = Mouse.X;
Keyboard->MouseQY = Mouse.Y; Keyboard->MouseQY = Mouse.Y;
flags = 0;
static SDL_Event event; static SDL_Event event;
memset(&event, 0, sizeof(SDL_Event)); memset(&event, 0, sizeof(SDL_Event));
@@ -86,13 +44,8 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags)
break; break;
/* Mouse is moving */
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION:
if (!(MouseState & SDL_BUTTON(SDL_BUTTON_LEFT))) flags = GadgetClass::LEFTUP;
{
flags |= GadgetClass::LEFTUP;
}
break; break;
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
@@ -102,22 +55,20 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags)
key = KN_LMOUSE; key = KN_LMOUSE;
flags |= GadgetClass::LEFTPRESS; flags |= GadgetClass::LEFTPRESS;
EventQueue.Put(EventMessage(Mouse.X, Mouse.Y, KN_LMOUSE));
Keyboard->Put_Element(KN_LMOUSE); Keyboard->Put_Element(KN_LMOUSE);
leftMouseProcessed = true; leftMouseProcessed = true;
numFramesLMouse++;
// after first left-mouse down, abort handling any other SDL events // Seems to fix "missed mouse click" bug
// because game might first need to switch into rubber band mode if (numFramesLMouse == 0) {
if (numFramesLMouse == 1) return; numFramesLMouse++;
return;
}
numFramesLMouse++;
} }
else if (event.button.button == SDL_BUTTON_RIGHT) { else if (event.button.button == SDL_BUTTON_RIGHT) {
Mouse.Button_Right == MouseButtonState::MOUSE_BUTTON_DOWN; Mouse.Button_Right == MouseButtonState::MOUSE_BUTTON_DOWN;
EventQueue.Put(EventMessage(Mouse.X, Mouse.Y, KN_RMOUSE));
Keyboard->Put_Element(KN_RMOUSE); Keyboard->Put_Element(KN_RMOUSE);
key = KN_RMOUSE; key = KN_RMOUSE;
@@ -130,29 +81,19 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags)
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
if (event.button.button == SDL_BUTTON_LEFT) { if (event.button.button == SDL_BUTTON_LEFT) {
Mouse.Button_Left == MouseButtonState::MOUSE_BUTTON_RELEASE; Mouse.Button_Left == MouseButtonState::MOUSE_BUTTON_RELEASE;
flags &= GadgetClass::LEFTPRESS;
EventQueue.Put(EventMessage(Mouse.X, Mouse.Y, KN_LMOUSE, MouseButtonState::MOUSE_BUTTON_RELEASE));
flags |= GadgetClass::LEFTRELEASE; flags |= GadgetClass::LEFTRELEASE;
numFramesLMouse = 0; numFramesLMouse = 0;
} }
else if (event.button.button == SDL_BUTTON_RIGHT) { else if (event.button.button == SDL_BUTTON_RIGHT) {
Mouse.Button_Right == MouseButtonState::MOUSE_BUTTON_RELEASE; Mouse.Button_Right == MouseButtonState::MOUSE_BUTTON_RELEASE;
EventQueue.Put(EventMessage(Mouse.X, Mouse.Y, KN_RMOUSE, MouseButtonState::MOUSE_BUTTON_RELEASE)); flags &= GadgetClass::RIGHTPRESS;
flags |= GadgetClass::RIGHTRELEASE; flags |= GadgetClass::RIGHTRELEASE;
numFramesLMouse = 0; numFramesLMouse = 0;
} }
break; break;
// Keyboard key lifted up
case SDL_KEYUP:
flags |= GadgetClass::KEYBOARD;
break;
// Keyboard key pressed down
case SDL_KEYDOWN: case SDL_KEYDOWN:
{ {
if (event.key.keysym.scancode == SDL_SCANCODE_GRAVE) { if (event.key.keysym.scancode == SDL_SCANCODE_GRAVE) {
@@ -169,14 +110,7 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags)
break; break;
} }
flags |= GadgetClass::KEYBOARD;
int keyFlags = 0x00; int keyFlags = 0x00;
KeyB.Shift = false;
KeyB.Alt = false;
KeyB.Control = false;
KeyB.CapsLock = false;
if (state[SDL_SCANCODE_RSHIFT] || state[SDL_SCANCODE_LSHIFT]) { if (state[SDL_SCANCODE_RSHIFT] || state[SDL_SCANCODE_LSHIFT]) {
KeyB.Shift = true; KeyB.Shift = true;
keyFlags |= KN_SHIFT_BIT; keyFlags |= KN_SHIFT_BIT;
@@ -189,29 +123,20 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags)
keyFlags |= KN_CTRL_BIT; keyFlags |= KN_CTRL_BIT;
KeyB.Control = true; KeyB.Control = true;
} }
if (state[SDL_SCANCODE_CAPSLOCK]) {
keyFlags |= KN_CAPSLOCK_BIT;
KeyB.CapsLock = true;
}
// handle match between SDL and internals ( non-text keys ) // handle match between SDL and internals (non-text keys)
auto element = sdl_keyMapping.find((SDL_KeyCode)event.key.keysym.sym); auto element = sdl_keyMapping.find((SDL_KeyCode)event.key.keysym.sym);
if (element != sdl_keyMapping.end()) if (element != sdl_keyMapping.end())
{ {
//EventQueue.Put( element->second | keyFlags );
EventQueue.Put(EventMessage((KeyNumType)element->second, element->second, KeyB.Shift, KeyB.Alt, KeyB.Control, KeyB.CapsLock));
Keyboard->Put_Element(element->second | keyFlags); Keyboard->Put_Element(element->second | keyFlags);
KeyB.ASCII = element->second;
KeyB.LastKey = element->first;
KeyB.ASCII = 0x0;
} }
break; break;
} }
case SDL_TEXTINPUT: case SDL_TEXTINPUT:
// limit to range 0-255 // limit to range 0-255
if (event.text.text[0] == (event.text.text[0] & 0xFF)) if (event.text.text[0] == ( event.text.text[0] & 0xFF ) )
{ {
KeyB.ASCII = (char)event.text.text[0]; KeyB.ASCII = (char)event.text.text[0];
} }
@@ -226,8 +151,6 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags)
if (!leftMouseProcessed && numFramesLMouse != 0) if (!leftMouseProcessed && numFramesLMouse != 0)
{ {
Mouse.Button_Left == MouseButtonState::MOUSE_BUTTON_HOLD; Mouse.Button_Left == MouseButtonState::MOUSE_BUTTON_HOLD;
flags |= GadgetClass::LEFTHELD; flags = GadgetClass::LEFTHELD;
EventQueue.Put(EventMessage(Mouse.X, Mouse.Y, KN_LMOUSE, MouseButtonState::MOUSE_BUTTON_HOLD));
} }
} }
+12 -28
View File
@@ -1,9 +1,9 @@
#pragma once #ifndef USERINPUT_H
#define USERINPUT_H
#include <SDL.h> #include <SDL.h>
#include <SDL_syswm.h> #include <SDL_syswm.h>
#include <map> #include <map>
#include <queue>
#include "examples/imgui_impl_sdl.h" #include "examples/imgui_impl_sdl.h"
@@ -86,37 +86,24 @@ std::map<SDL_KeyCode, KeyNumType> const sdl_keyMapping = {
{ SDLK_DOWN, KN_DOWN }, { SDLK_DOWN, KN_DOWN },
{ SDLK_LEFT, KN_LEFT }, { SDLK_LEFT, KN_LEFT },
{ SDLK_RIGHT, KN_RIGHT }, { 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<KeyNumType, SDL_KeyCode> sdl_keyMapping_reverse;
const int USERINPUT_SHIFT_BIT = 0x100; class UserInputClass
const int USERINPUT_CTRL_BIT = 0x200; {
const int USERINPUT_ALT_BIT = 0x400; public:
typedef enum {
typedef enum {
MOUSE_BUTTON_UP, MOUSE_BUTTON_UP,
MOUSE_BUTTON_DOWN, MOUSE_BUTTON_DOWN,
MOUSE_BUTTON_HOLD, MOUSE_BUTTON_HOLD,
MOUSE_BUTTON_RELEASE, MOUSE_BUTTON_RELEASE,
} MouseButtonState; } MouseButtonState;
typedef enum { typedef enum {
INPUT_ACTION_NONE, INPUT_ACTION_NONE,
INPUT_ACTION_KEYBOARD, INPUT_ACTION_KEYBOARD,
INPUT_ACTION_MOUSE, INPUT_ACTION_MOUSE,
} InputAction; } InputAction;
class UserInputClass
{
public:
UserInputClass();
void UserInputClass::Process_Input(KeyNumType& key = g_globalKeyNumType, int& flags = g_globalKeyFlags); void UserInputClass::Process_Input(KeyNumType& key = g_globalKeyNumType, int& flags = g_globalKeyFlags);
InputAction LastAction; InputAction LastAction;
@@ -129,9 +116,6 @@ public:
bool Shift; bool Shift;
bool Control; bool Control;
bool Alt; bool Alt;
bool CapsLock;
bool Key_Down(KeyNumType key) const;
void ResetState() { void ResetState() {
this->Shift = false; this->Shift = false;
@@ -151,8 +135,6 @@ public:
MouseButtonState Button_Middle; MouseButtonState Button_Middle;
MouseButtonState Button_Right; MouseButtonState Button_Right;
bool UserInputClass::MouseState::Mouse_Down(KeyNumType key) const;
void ResetState() { void ResetState() {
this->Button_Left = MouseButtonState::MOUSE_BUTTON_UP; this->Button_Left = MouseButtonState::MOUSE_BUTTON_UP;
this->Button_Middle = MouseButtonState::MOUSE_BUTTON_UP; this->Button_Middle = MouseButtonState::MOUSE_BUTTON_UP;
@@ -161,6 +143,8 @@ public:
}; };
MouseState Mouse; MouseState Mouse;
private: private:
int numFramesLMouse = 0; int numFramesLMouse = 0;
}; };
#endif
+1 -1
View File
@@ -372,7 +372,7 @@ bool WWKeyboardClass::Down(unsigned short key)
return g_globalKeyFlags & GadgetClass::RIGHTPRESS; return g_globalKeyFlags & GadgetClass::RIGHTPRESS;
} }
return UserInput.KeyB.Key_Down((KeyNumType)key); return(GetAsyncKeyState(key & 0xFF) == 0 ? false : true);
} }
+107 -112
View File
@@ -525,124 +525,119 @@ typedef enum KeyASCIIType {
typedef enum KeyNumType { typedef enum KeyNumType {
KN_NONE = 0, KN_NONE = 0,
KN_0, KN_0 = VK_0,
KN_1, KN_1 = VK_1,
KN_2, KN_2 = VK_2,
KN_3, KN_3 = VK_3,
KN_4, KN_4 = VK_4,
KN_5, KN_5 = VK_5,
KN_6, KN_6 = VK_6,
KN_7, KN_7 = VK_7,
KN_8, KN_8 = VK_8,
KN_9, KN_9 = VK_9,
KN_A, KN_A = VK_A,
KN_B, KN_B = VK_B,
KN_C, KN_BACKSLASH = VK_NONE_DC,
KN_D, KN_BACKSPACE = VK_BACK,
KN_E, KN_C = VK_C,
KN_F, KN_CAPSLOCK = VK_CAPITAL,
KN_G, KN_CENTER = VK_CLEAR,
KN_H, KN_COMMA = VK_NONE_BC,
KN_I, KN_D = VK_D,
KN_J, KN_DELETE = VK_DELETE,
KN_K, KN_DOWN = VK_DOWN,
KN_L, KN_DOWNLEFT = VK_END,
KN_M, KN_DOWNRIGHT = VK_NEXT,
KN_N, KN_E = VK_E,
KN_O, KN_END = VK_END,
KN_P, KN_EQUAL = VK_NONE_BB,
KN_Q, KN_ESC = VK_ESCAPE,
KN_R, KN_E_DELETE = VK_DELETE,
KN_S, KN_E_DOWN = VK_NUMPAD2,
KN_T, KN_E_END = VK_NUMPAD1,
KN_U, KN_E_HOME = VK_NUMPAD7,
KN_V, KN_E_INSERT = VK_INSERT,
KN_W, KN_E_LEFT = VK_NUMPAD4,
KN_X, KN_E_PGDN = VK_NUMPAD3,
KN_Y, KN_E_PGUP = VK_NUMPAD9,
KN_Z, KN_E_RIGHT = VK_NUMPAD6,
KN_E_UP = VK_NUMPAD8,
KN_BACKSLASH, KN_F = VK_F,
KN_BACKSPACE, KN_F1 = VK_F1,
KN_CAPSLOCK, KN_F10 = 67,
KN_CENTER, KN_F11 = 68,
KN_COMMA, KN_F12 = 69,
KN_DELETE, KN_F2 = 59,
KN_DOWN, KN_F3 = 60,
KN_DOWNLEFT, KN_F4 = 61,
KN_DOWNRIGHT, KN_F5 = 62,
KN_END, KN_F6 = 63,
KN_EQUAL, KN_F7 = 64,
KN_ESC, KN_F8 = 65,
KN_E_DELETE, KN_F9 = 66,
KN_E_DOWN, KN_G = VK_G,
KN_E_END, KN_GRAVE = VK_NONE_C0,
KN_E_HOME, KN_H = VK_H,
KN_E_INSERT, KN_HOME = VK_HOME,
KN_E_LEFT, KN_I = VK_I,
KN_E_PGDN, KN_INSERT = VK_INSERT,
KN_E_PGUP, KN_J = VK_J,
KN_E_RIGHT, KN_K = VK_K,
KN_E_UP, KN_KEYPAD_ASTERISK= VK_MULTIPLY,
KN_GRAVE, KN_KEYPAD_MINUS = VK_SUBTRACT,
KN_HOME, KN_KEYPAD_PLUS = VK_ADD,
KN_INSERT, KN_KEYPAD_RETURN = VK_RETURN,
KN_KEYPAD_ASTERISK, KN_KEYPAD_SLASH = VK_DIVIDE,
KN_KEYPAD_MINUS, KN_L = VK_L,
KN_KEYPAD_PLUS, KN_LALT = VK_MENU,
KN_KEYPAD_RETURN, KN_LBRACKET = VK_NONE_DB,
KN_KEYPAD_SLASH, KN_LCTRL = VK_CONTROL,
KN_MINUS, KN_LEFT = VK_LEFT,
KN_NUMLOCK, KN_LMOUSE = VK_LBUTTON,
KN_PAUSE, KN_LSHIFT = VK_SHIFT,
KN_PERIOD, KN_M = VK_M,
KN_PGDN, KN_MINUS = VK_NONE_BD,
KN_PGUP, KN_N = VK_N,
KN_PRNTSCRN, KN_NUMLOCK = VK_NUMLOCK,
KN_SCROLLLOCK, KN_O = VK_O,
KN_SEMICOLON, KN_P = VK_P,
KN_SLASH, KN_PAUSE = VK_PAUSE,
KN_SPACE, KN_PERIOD = VK_NONE_BE,
KN_SQUOTE, KN_PGDN = VK_NEXT,
KN_TAB, KN_PGUP = VK_PRIOR,
KN_UP, KN_PRNTSCRN = VK_PRINT,
KN_UPLEFT, KN_Q = VK_Q,
KN_UPRIGHT, KN_R = VK_R,
KN_RALT = VK_MENU,
KN_LALT, KN_RBRACKET = VK_NONE_DD,
KN_LBRACKET, KN_RCTRL = VK_CONTROL,
KN_LCTRL, KN_RETURN = VK_RETURN,
KN_LEFT, KN_RIGHT = VK_RIGHT,
KN_LMOUSE, KN_RMOUSE = VK_RBUTTON,
KN_LSHIFT, KN_RSHIFT = VK_SHIFT,
KN_S = VK_S,
KN_RALT, KN_SCROLLLOCK = VK_SCROLL,
KN_RBRACKET, KN_SEMICOLON = VK_NONE_BA,
KN_RCTRL, KN_SLASH = VK_NONE_BF,
KN_RETURN, KN_SPACE = VK_SPACE,
KN_RIGHT, KN_SQUOTE = VK_NONE_DE,
KN_RMOUSE, KN_T = VK_T,
KN_RSHIFT, KN_TAB = VK_TAB,
KN_U = VK_U,
KN_F1, KN_UP = VK_UP,
KN_F2, KN_UPLEFT = VK_HOME,
KN_F3, KN_UPRIGHT = VK_PRIOR,
KN_F4, KN_V = VK_V,
KN_F5, KN_W = VK_W,
KN_F6, KN_X = VK_X,
KN_F7, KN_Y = VK_Y,
KN_F8, KN_Z = VK_Z,
KN_F9,
KN_F10,
KN_F11,
KN_F12,
KN_SHIFT_BIT = WWKEY_SHIFT_BIT, KN_SHIFT_BIT = WWKEY_SHIFT_BIT,
KN_CTRL_BIT = WWKEY_CTRL_BIT, KN_CTRL_BIT = WWKEY_CTRL_BIT,
KN_ALT_BIT = WWKEY_ALT_BIT, KN_ALT_BIT = WWKEY_ALT_BIT,
KN_RLSE_BIT = WWKEY_RLS_BIT, KN_RLSE_BIT = WWKEY_RLS_BIT,
KN_BUTTON = WWKEY_BTN_BIT, KN_BUTTON = WWKEY_BTN_BIT,
KN_CAPSLOCK_BIT = WWKEY_SHIFT_BIT,
} KeyNumType; } KeyNumType;
+1 -2
View File
@@ -591,7 +591,6 @@ void OptionsClass::Load_Settings(void)
SlowPalette = ini.Get_Bool(OPTIONS, "SlowPalette", SlowPalette); SlowPalette = ini.Get_Bool(OPTIONS, "SlowPalette", SlowPalette);
IsPaletteScroll = ini.Get_Bool(OPTIONS, "PaletteScroll", IsPaletteScroll); IsPaletteScroll = ini.Get_Bool(OPTIONS, "PaletteScroll", IsPaletteScroll);
/*
KeyForceMove1 = (KeyNumType)ini.Get_Int(HotkeyName, "KeyForceMove1", KeyForceMove1); KeyForceMove1 = (KeyNumType)ini.Get_Int(HotkeyName, "KeyForceMove1", KeyForceMove1);
KeyForceMove2 = (KeyNumType)ini.Get_Int(HotkeyName, "KeyForceMove2", KeyForceMove2); KeyForceMove2 = (KeyNumType)ini.Get_Int(HotkeyName, "KeyForceMove2", KeyForceMove2);
KeyForceAttack1 = (KeyNumType)ini.Get_Int(HotkeyName, "KeyForceAttack1", KeyForceAttack1); KeyForceAttack1 = (KeyNumType)ini.Get_Int(HotkeyName, "KeyForceAttack1", KeyForceAttack1);
@@ -642,6 +641,7 @@ void OptionsClass::Load_Settings(void)
KeyTeam9 = (KeyNumType)ini.Get_Int(HotkeyName, "KeyTeam9", KeyTeam9); KeyTeam9 = (KeyNumType)ini.Get_Int(HotkeyName, "KeyTeam9", KeyTeam9);
KeyTeam10 = (KeyNumType)ini.Get_Int(HotkeyName, "KeyTeam10", KeyTeam10); KeyTeam10 = (KeyNumType)ini.Get_Int(HotkeyName, "KeyTeam10", KeyTeam10);
#ifdef WIN32 #ifdef WIN32
KeyForceMove1 = (KeyNumType)(KeyForceMove1 & ~WWKEY_VK_BIT); KeyForceMove1 = (KeyNumType)(KeyForceMove1 & ~WWKEY_VK_BIT);
KeyForceMove2 = (KeyNumType)(KeyForceMove2 & ~WWKEY_VK_BIT); KeyForceMove2 = (KeyNumType)(KeyForceMove2 & ~WWKEY_VK_BIT);
@@ -693,7 +693,6 @@ void OptionsClass::Load_Settings(void)
KeyTeam9 = (KeyNumType)(KeyTeam9 & ~WWKEY_VK_BIT); KeyTeam9 = (KeyNumType)(KeyTeam9 & ~WWKEY_VK_BIT);
KeyTeam10 = (KeyNumType)(KeyTeam10 & ~WWKEY_VK_BIT); KeyTeam10 = (KeyNumType)(KeyTeam10 & ~WWKEY_VK_BIT);
#endif #endif
*/
} }
+34 -43
View File
@@ -44,11 +44,11 @@
#include "function.h" #include "function.h"
/* /*
** Points to the shape to use for the "desired" power level indicator. ** Points to the shape to use for the "desired" power level indicator.
*/ */
void const* PowerClass::PowerShape; void const * PowerClass::PowerShape;
void const* PowerClass::PowerBarShape; void const * PowerClass::PowerBarShape;
PowerClass::PowerButtonClass PowerClass::PowerButton; PowerClass::PowerButtonClass PowerClass::PowerButton;
@@ -137,8 +137,8 @@ void PowerClass::One_Time(void)
RadarClass::One_Time(); RadarClass::One_Time();
PowerButton.X = ScreenWidth - (640 - (POWER_X * RESFACTOR)); PowerButton.X = ScreenWidth - (640 - (POWER_X * RESFACTOR));
PowerButton.Y = POWER_Y * RESFACTOR; PowerButton.Y = POWER_Y * RESFACTOR;
PowerButton.Width = (POWER_WIDTH * RESFACTOR) - 1; PowerButton.Width = (POWER_WIDTH * RESFACTOR)-1;
PowerButton.Height = ScreenHeight - (POWER_Y * RESFACTOR);// POWER_HEIGHT* RESFACTOR; PowerButton.Height = ScreenHeight - ( POWER_Y * RESFACTOR ) ;// POWER_HEIGHT* RESFACTOR;
PowerShape = MFCD::Retrieve("POWER.SHP"); PowerShape = MFCD::Retrieve("POWER.SHP");
PowerBarShape = MFCD::Retrieve("POWERBAR.SHP"); PowerBarShape = MFCD::Retrieve("POWERBAR.SHP");
} }
@@ -162,14 +162,13 @@ void PowerClass::One_Time(void)
*=============================================================================================*/ *=============================================================================================*/
void PowerClass::Draw_It(bool complete) void PowerClass::Draw_It(bool complete)
{ {
static int _modtable[] = { static int _modtable[]={
0, -1, 0, 1, 0, -1, -2, -1, 0, 1, 2, 1 ,0 0, -1, 0, 1, 0, -1, -2, -1, 0, 1, 2, 1 ,0
}; };
// jmarshall - render the world before the power bar. // jmarshall - render the world before the power bar.
RadarClass::Draw_It(complete); RadarClass::Draw_It(complete);
// jmarshall end // jmarshall end
{ {
BStart(BENCH_POWER); BStart(BENCH_POWER);
@@ -177,7 +176,7 @@ void PowerClass::Draw_It(bool complete)
if (Map.IsSidebarActive) { if (Map.IsSidebarActive) {
IsToRedraw = false; IsToRedraw = false;
ShapeFlags_Type flags = SHAPE_NORMAL; ShapeFlags_Type flags = SHAPE_NORMAL;
void const* remap = NULL; void const * remap = NULL;
if (FlashTimer > 1 && ((FlashTimer % 3) & 0x01) != 0) { if (FlashTimer > 1 && ((FlashTimer % 3) & 0x01) != 0) {
flags = flags | SHAPE_FADING; flags = flags | SHAPE_FADING;
@@ -191,13 +190,13 @@ void PowerClass::Draw_It(bool complete)
int bottomOfBar = (88 * RESFACTOR) + 56; int bottomOfBar = (88 * RESFACTOR) + 56;
while (bottomOfBar < PowerButton.Height + 42) while(bottomOfBar < PowerButton.Height + 34 )
{ {
CC_Draw_Shape(PowerBarShape, 1, ScreenWidth - (640 - (240 * RESFACTOR)), bottomOfBar, WINDOW_MAIN, flags | SHAPE_NORMAL | SHAPE_WIN_REL, remap); CC_Draw_Shape(PowerBarShape, 1, ScreenWidth - (640 - (240 * RESFACTOR)), bottomOfBar, WINDOW_MAIN, flags | SHAPE_NORMAL | SHAPE_WIN_REL, remap);
bottomOfBar += 8 * RESFACTOR; bottomOfBar += 8 * RESFACTOR;
} }
int bottom = bottomOfBar + (28 * RESFACTOR); int bottom = ( PowerButton.Y * RESFACTOR ) + PowerButton.Height;
/* /*
** Determine how much the power production exceeds or falls short ** Determine how much the power production exceeds or falls short
@@ -208,6 +207,8 @@ void PowerClass::Draw_It(bool complete)
power_height = Bound(power_height, 0, PowerButton.Height - 2); power_height = Bound(power_height, 0, PowerButton.Height - 2);
drain_height = Bound(drain_height, 0, PowerButton.Height - 2); drain_height = Bound(drain_height, 0, PowerButton.Height - 2);
bottom -= (15 * RESFACTOR);
/* /*
** Draw the power output graphic on top of the power bar framework. ** Draw the power output graphic on top of the power bar framework.
*/ */
@@ -232,21 +233,18 @@ void PowerClass::Draw_It(bool complete)
** ST - 5/2/96 11:23AM ** ST - 5/2/96 11:23AM
*/ */
power_height = (power_height * (76 * RESFACTOR + 1)) / (53 * RESFACTOR + 1); power_height = (power_height*(76*RESFACTOR+1)) / (53*RESFACTOR+1);
drain_height = (drain_height * (76 * RESFACTOR + 1)) / (53 * RESFACTOR + 1); drain_height = (drain_height*(76*RESFACTOR+1)) / (53*RESFACTOR+1);
//bottom = (175*RESFACTOR)+1; //bottom = (175*RESFACTOR)+1;
LogicPage->Fill_Rect(ScreenWidth - (640 - (245 * RESFACTOR)), bottom - power_height, ScreenWidth - (640 - (245 * RESFACTOR + 1)), bottom, color2); LogicPage->Fill_Rect(ScreenWidth - (640 - (245*RESFACTOR)), bottom - power_height, ScreenWidth - (640 - (245*RESFACTOR+1)), bottom, color2 );
LogicPage->Fill_Rect(ScreenWidth - (640 - (246 * RESFACTOR)), bottom - power_height, ScreenWidth - (640 - (246 * RESFACTOR + 1)), bottom, color1); LogicPage->Fill_Rect(ScreenWidth - (640 - (246*RESFACTOR)), bottom - power_height, ScreenWidth - (640 - (246*RESFACTOR+1)), bottom, color1 );
} }
/* /*
** Draw the power drain threshold marker. ** Draw the power drain threshold marker.
*/ */
if (PlayerPtr->Drain > 0) CC_Draw_Shape(PowerShape, 0, ScreenWidth - (640 - (((POWER_X * RESFACTOR)) +RESFACTOR)), bottom - (drain_height + (2 * RESFACTOR)), WINDOW_MAIN, flags | SHAPE_NORMAL, remap);
{
CC_Draw_Shape(PowerShape, 0, ScreenWidth - (640 - (((POWER_X * RESFACTOR)) + RESFACTOR)), bottom - (drain_height + (2 * RESFACTOR)), WINDOW_MAIN, flags | SHAPE_NORMAL, remap);
}
} }
LogicPage->Unlock(); LogicPage->Unlock();
} }
@@ -272,7 +270,7 @@ void PowerClass::Draw_It(bool complete)
* 12/20/1994 JLB : Created. * * 12/20/1994 JLB : Created. *
* 12/31/1994 JLB : Uses mouse coordinate parameters. * * 12/31/1994 JLB : Uses mouse coordinate parameters. *
*=============================================================================================*/ *=============================================================================================*/
void PowerClass::AI(KeyNumType& input, int x, int y) void PowerClass::AI(KeyNumType &input, int x, int y)
{ {
if (Map.IsSidebarActive /*IsActive*/) { if (Map.IsSidebarActive /*IsActive*/) {
int olddrain = DrainHeight; int olddrain = DrainHeight;
@@ -289,11 +287,9 @@ void PowerClass::AI(KeyNumType& input, int x, int y)
PowerBounce = 12; PowerBounce = 12;
if (PowerHeight > DesiredPowerHeight) { if (PowerHeight > DesiredPowerHeight) {
PowerDir = -1; PowerDir = -1;
} } else if (PowerHeight < DesiredPowerHeight) {
else if (PowerHeight < DesiredPowerHeight) {
PowerDir = 1; PowerDir = 1;
} } else {
else {
PowerBounce = 0; PowerBounce = 0;
} }
} }
@@ -308,11 +304,9 @@ void PowerClass::AI(KeyNumType& input, int x, int y)
DrainBounce = 12; DrainBounce = 12;
if (DrainHeight > DesiredDrainHeight) { if (DrainHeight > DesiredDrainHeight) {
DrainDir = -1; DrainDir = -1;
} } else if (DrainHeight < DesiredDrainHeight) {
else if (DrainHeight < DesiredDrainHeight) {
DrainDir = 1; DrainDir = 1;
} } else {
else {
DrainBounce = 0; DrainBounce = 0;
} }
} }
@@ -321,8 +315,7 @@ void PowerClass::AI(KeyNumType& input, int x, int y)
IsToRedraw = true; IsToRedraw = true;
Flag_To_Redraw(false); Flag_To_Redraw(false);
DrainBounce--; DrainBounce--;
} } else {
else {
/* /*
** If we need to move the drain height then do so. ** If we need to move the drain height then do so.
*/ */
@@ -335,8 +328,7 @@ void PowerClass::AI(KeyNumType& input, int x, int y)
IsToRedraw = true; IsToRedraw = true;
Flag_To_Redraw(false); Flag_To_Redraw(false);
PowerBounce--; PowerBounce--;
} } else {
else {
/* /*
** If we need to move the power height then do so. ** If we need to move the power height then do so.
*/ */
@@ -353,7 +345,7 @@ void PowerClass::AI(KeyNumType& input, int x, int y)
/* /*
** Flag to redraw if the power bar flash effect has expired. ** Flag to redraw if the power bar flash effect has expired.
*/ */
// if (FlashTimer == 1) { // if (FlashTimer == 1) {
if (FlashTimer > 0) { if (FlashTimer > 0) {
IsToRedraw = true; IsToRedraw = true;
Flag_To_Redraw(false); Flag_To_Redraw(false);
@@ -382,7 +374,7 @@ void PowerClass::AI(KeyNumType& input, int x, int y)
* HISTORY: * * HISTORY: *
* 06/01/1995 JLB : Created. * * 06/01/1995 JLB : Created. *
*=============================================================================================*/ *=============================================================================================*/
void PowerClass::Refresh_Cells(CELL cell, short const* list) void PowerClass::Refresh_Cells(CELL cell, short const * list)
{ {
if (*list == REFRESH_SIDEBAR) { if (*list == REFRESH_SIDEBAR) {
IsToRedraw = true; IsToRedraw = true;
@@ -406,14 +398,14 @@ void PowerClass::Refresh_Cells(CELL cell, short const* list)
*=========================================================================*/ *=========================================================================*/
int PowerClass::Power_Height(int value) int PowerClass::Power_Height(int value)
{ {
int num = value / POWER_STEP_LEVEL; // figure out the initial num of DRAIN_VALUE's int num = value/ POWER_STEP_LEVEL; // figure out the initial num of DRAIN_VALUE's
int retval = 0; // currently there is no power int retval = 0; // currently there is no power
/* /*
** Loop through the different hundreds figuring out the fractional piece ** Loop through the different hundreds figuring out the fractional piece
** of each. ** of each.
*/ */
for (int lp = 0; lp < num; lp++) { for (int lp = 0; lp < num; lp ++) {
retval = retval + (((POWER_HEIGHT - 2) - retval) / POWER_STEP_FACTOR); retval = retval + (((POWER_HEIGHT - 2) - retval) / POWER_STEP_FACTOR);
value -= POWER_STEP_LEVEL; value -= POWER_STEP_LEVEL;
} }
@@ -425,7 +417,7 @@ int PowerClass::Power_Height(int value)
retval = retval + (((((POWER_HEIGHT - 2) - retval) / POWER_STEP_FACTOR) * value) / POWER_STEP_LEVEL); retval = retval + (((((POWER_HEIGHT - 2) - retval) / POWER_STEP_FACTOR) * value) / POWER_STEP_LEVEL);
} }
retval = Bound(retval, 0, POWER_HEIGHT - 2); retval = Bound(retval, 0, POWER_HEIGHT-2);
return(retval); return(retval);
} }
@@ -447,7 +439,7 @@ int PowerClass::Power_Height(int value)
* HISTORY: * * HISTORY: *
* 08/07/1995 JLB : Created. * * 08/07/1995 JLB : Created. *
*=============================================================================================*/ *=============================================================================================*/
int PowerClass::PowerButtonClass::Action(unsigned flags, KeyNumType& key) int PowerClass::PowerButtonClass::Action(unsigned flags, KeyNumType & key)
{ {
if (!Map.IsSidebarActive) { if (!Map.IsSidebarActive) {
return(false); return(false);
@@ -460,8 +452,7 @@ int PowerClass::PowerButtonClass::Action(unsigned flags, KeyNumType& key)
Map.Override_Mouse_Shape(MOUSE_NORMAL); Map.Override_Mouse_Shape(MOUSE_NORMAL);
if (PlayerPtr->Power_Fraction() < 1 && PlayerPtr->Power > 0) { if (PlayerPtr->Power_Fraction() < 1 && PlayerPtr->Power > 0) {
Map.Help_Text(TXT_POWER_OUTPUT_LOW, -1, -1, GadgetClass::Get_Color_Scheme()->Color); Map.Help_Text(TXT_POWER_OUTPUT_LOW, -1, -1, GadgetClass::Get_Color_Scheme()->Color);
} } else {
else {
Map.Help_Text(TXT_POWER_OUTPUT, -1, -1, GadgetClass::Get_Color_Scheme()->Color); Map.Help_Text(TXT_POWER_OUTPUT, -1, -1, GadgetClass::Get_Color_Scheme()->Color);
} }
GadgetClass::Action(flags, key); GadgetClass::Action(flags, key);
-1
View File
@@ -164,7 +164,6 @@ int ShapeButtonClass::Draw_Me(int forced)
} }
CC_Draw_Shape(ShapeData, shapenum, X, Y, WINDOW_MAIN, SHAPE_NORMAL); CC_Draw_Shape(ShapeData, shapenum, X, Y, WINDOW_MAIN, SHAPE_NORMAL);
/* /*
** Display the mouse. ** Display the mouse.
*/ */
+179 -204
View File
@@ -76,19 +76,19 @@
#include "function.h" #include "function.h"
//#undef RESFACTOR //#undef RESFACTOR
//#define RESFACTOR 1 //#define RESFACTOR 1
void* SidebarClass::SidebarShape = NULL; void * SidebarClass::SidebarShape = NULL;
void* SidebarClass::SidebarMiddleShape = NULL; void * SidebarClass::SidebarMiddleShape = NULL;
void* SidebarClass::SidebarBottomShape = NULL; void * SidebarClass::SidebarBottomShape = NULL;
/*************************************************************************** /***************************************************************************
** This holds the translucent table for use with the construction clock ** This holds the translucent table for use with the construction clock
** animation. ** animation.
*/ */
char SidebarClass::StripClass::ClockTranslucentTable[(1 + 1) * 256]; char SidebarClass::StripClass::ClockTranslucentTable[(1+1)*256];
/*************************************************************************** /***************************************************************************
@@ -121,9 +121,9 @@ SidebarClass::StripClass::SelectButton[COLUMNS][MAX_VISIBLE];
/* /*
** Shape data pointers ** Shape data pointers
*/ */
void* SidebarClass::StripClass::LogoShapes = NULL; void * SidebarClass::StripClass::LogoShapes = NULL;
void const* SidebarClass::StripClass::ClockShapes; void const * SidebarClass::StripClass::ClockShapes;
void const* SidebarClass::StripClass::SpecialShapes[SPC_COUNT]; void const * SidebarClass::StripClass::SpecialShapes[SPC_COUNT];
/*********************************************************************************************** /***********************************************************************************************
@@ -169,16 +169,16 @@ SidebarClass::SidebarClass(void) :
* HISTORY: * * HISTORY: *
* 08/06/1996 JLB : Created. * * 08/06/1996 JLB : Created. *
*=============================================================================================*/ *=============================================================================================*/
SidebarClass::SidebarClass(NoInitClass const& x) : PowerClass(x) SidebarClass::SidebarClass(NoInitClass const & x) : PowerClass(x)
{ {
/* /*
** Set up the coordinates for the sidebar strips. These coordinates are for ** Set up the coordinates for the sidebar strips. These coordinates are for
** the upper left corner. ** the upper left corner.
*/ */
// Column[0].X = COLUMN_ONE_X * RESFACTOR; // Column[0].X = COLUMN_ONE_X * RESFACTOR;
// Column[0].Y = COLUMN_ONE_Y * RESFACTOR; // Column[0].Y = COLUMN_ONE_Y * RESFACTOR;
// Column[1].X = COLUMN_TWO_X * RESFACTOR; // Column[1].X = COLUMN_TWO_X * RESFACTOR;
// Column[1].Y = COLUMN_TWO_Y * RESFACTOR; // Column[1].Y = COLUMN_TWO_Y * RESFACTOR;
} }
@@ -224,25 +224,25 @@ void SidebarClass::One_Time(void)
** code so that as the sidebar buildable buttons scroll, they get properly ** code so that as the sidebar buildable buttons scroll, they get properly
** clipped at the top and bottom edges. ** clipped at the top and bottom edges.
*/ */
WindowList[WINDOW_SIDEBAR][WINDOWX] = ((SIDE_X + 8)) * RESFACTOR; WindowList[WINDOW_SIDEBAR][WINDOWX] = ((SIDE_X+8)) * RESFACTOR;
WindowList[WINDOW_SIDEBAR][WINDOWY] = (SIDE_Y + 1 + TOP_HEIGHT) * RESFACTOR; WindowList[WINDOW_SIDEBAR][WINDOWY] = (SIDE_Y + 1 + TOP_HEIGHT) * RESFACTOR;
WindowList[WINDOW_SIDEBAR][WINDOWWIDTH] = (SIDE_WIDTH)*RESFACTOR; WindowList[WINDOW_SIDEBAR][WINDOWWIDTH] = (SIDE_WIDTH) * RESFACTOR;
WindowList[WINDOW_SIDEBAR][WINDOWHEIGHT] = ScreenHeight; WindowList[WINDOW_SIDEBAR][WINDOWHEIGHT] = ScreenHeight;
// WindowList[WINDOW_SIDEBAR][WINDOWHEIGHT] = (StripClass::MAX_VISIBLE * StripClass::OBJECT_HEIGHT-1) * RESFACTOR; // WindowList[WINDOW_SIDEBAR][WINDOWHEIGHT] = (StripClass::MAX_VISIBLE * StripClass::OBJECT_HEIGHT-1) * RESFACTOR;
/* /*
** Top of the window seems to be wrong for the new sidebar. ST - 5/2/96 2:49AM ** Top of the window seems to be wrong for the new sidebar. ST - 5/2/96 2:49AM
*/ */
WindowList[WINDOW_SIDEBAR][WINDOWY] -= 1 * RESFACTOR; WindowList[WINDOW_SIDEBAR][WINDOWY] -= 1*RESFACTOR;
/* /*
** Set up the coordinates for the sidebar strips. These coordinates are for ** Set up the coordinates for the sidebar strips. These coordinates are for
** the upper left corner. ** the upper left corner.
*/ */
// Column[0].X = COLUMN_ONE_X * RESFACTOR; // Column[0].X = COLUMN_ONE_X * RESFACTOR;
// Column[0].Y = COLUMN_ONE_Y * RESFACTOR; // Column[0].Y = COLUMN_ONE_Y * RESFACTOR;
// Column[1].X = COLUMN_TWO_X * RESFACTOR; // Column[1].X = COLUMN_TWO_X * RESFACTOR;
// Column[1].Y = COLUMN_TWO_Y * RESFACTOR; // Column[1].Y = COLUMN_TWO_Y * RESFACTOR;
Column[0].One_Time(0); Column[0].One_Time(0);
Column[1].One_Time(1); Column[1].One_Time(1);
@@ -307,8 +307,8 @@ void SidebarClass::Init_IO(void)
Repair.IsSticky = true; Repair.IsSticky = true;
Repair.ID = BUTTON_REPAIR; Repair.ID = BUTTON_REPAIR;
Repair.X = ScreenWidth - (640 - (0x1f2 / 2) * RESFACTOR); Repair.X = ScreenWidth - (640 - (0x1f2/2)*RESFACTOR);
Repair.Y = (0x96 / 2) * RESFACTOR; Repair.Y = (0x96/2)*RESFACTOR;
Repair.IsPressed = false; Repair.IsPressed = false;
Repair.IsToggleType = true; Repair.IsToggleType = true;
Repair.ReflectButtonState = true; Repair.ReflectButtonState = true;
@@ -317,7 +317,7 @@ void SidebarClass::Init_IO(void)
Upgrade.IsSticky = true; Upgrade.IsSticky = true;
Upgrade.ID = BUTTON_UPGRADE; Upgrade.ID = BUTTON_UPGRADE;
Upgrade.X = ScreenWidth - (640 - 0x21f); Upgrade.X = ScreenWidth - (640 - 0x21f);
Upgrade.Y = (0x96 / 2) * RESFACTOR; Upgrade.Y = (0x96/2)*RESFACTOR;
Upgrade.IsPressed = false; Upgrade.IsPressed = false;
Upgrade.IsToggleType = true; Upgrade.IsToggleType = true;
Upgrade.ReflectButtonState = true; Upgrade.ReflectButtonState = true;
@@ -325,15 +325,14 @@ void SidebarClass::Init_IO(void)
Zoom.IsSticky = true; Zoom.IsSticky = true;
Zoom.ID = BUTTON_ZOOM; Zoom.ID = BUTTON_ZOOM;
Zoom.X = ScreenWidth - (640 - ((0x24c / 2) * RESFACTOR)); Zoom.X = ScreenWidth - (640 - ((0x24c/2)*RESFACTOR));
Zoom.Y = (0x96 / 2) * RESFACTOR; Zoom.Y = (0x96/2)*RESFACTOR;
Zoom.IsPressed = false; Zoom.IsPressed = false;
Zoom.Set_Shape(MFCD::Retrieve("MAP.SHP")); Zoom.Set_Shape(MFCD::Retrieve("MAP.SHP"));
if ((IsRadarActive && Is_Zoomable()) || Session.Type != GAME_NORMAL) { if ((IsRadarActive && Is_Zoomable()) || Session.Type != GAME_NORMAL) {
Zoom.Enable(); Zoom.Enable();
} } else {
else {
Zoom.Disable(); Zoom.Disable();
} }
Column[0].Init_IO(0); Column[0].Init_IO(0);
@@ -345,8 +344,8 @@ void SidebarClass::Init_IO(void)
if (IsSidebarActive) { if (IsSidebarActive) {
IsSidebarActive = false; IsSidebarActive = false;
Activate(1); Activate(1);
// Background.Zap(); // Background.Zap();
// Add_A_Button(Background); // Add_A_Button(Background);
} }
} }
} }
@@ -389,7 +388,7 @@ void SidebarClass::Init_Theater(TheaterType theater)
*=============================================================================================*/ *=============================================================================================*/
void SidebarClass::Reload_Sidebar(void) void SidebarClass::Reload_Sidebar(void)
{ {
static char* sidebarnames[] = { static char * sidebarnames[]={
"SIDE?NA.SHP", //NATO "SIDE?NA.SHP", //NATO
"SIDE?NA.SHP", "SIDE?NA.SHP",
"SIDE?US.SHP", //USSR "SIDE?US.SHP", //USSR
@@ -403,18 +402,18 @@ void SidebarClass::Reload_Sidebar(void)
}; };
int houseloaded = 0; int houseloaded = 0;
if (PlayerPtr) { if(PlayerPtr) {
houseloaded = PlayerPtr->ActLike; houseloaded = PlayerPtr->ActLike;
} }
/* Don't have write access to the static char array. ST - 5/20/2019 */ /* Don't have write access to the static char array. ST - 5/20/2019 */
#if (0) #if (0)
char* sidename = sidebarnames[houseloaded]; char * sidename = sidebarnames[houseloaded];
*(sidename + 4) = '1'; *(sidename+4) = '1';
SidebarShape = (void*)MFCD::Retrieve(sidename); SidebarShape = (void*)MFCD::Retrieve(sidename);
*(sidename + 4) = '2'; *(sidename+4) = '2';
SidebarMiddleShape = (void*)MFCD::Retrieve(sidename); SidebarMiddleShape = (void*)MFCD::Retrieve(sidename);
*(sidename + 4) = '3'; *(sidename+4) = '3';
SidebarBottomShape = (void*)MFCD::Retrieve(sidename); SidebarBottomShape = (void*)MFCD::Retrieve(sidename);
#else #else
char sb_name[16]; char sb_name[16];
@@ -507,7 +506,7 @@ bool SidebarClass::Factory_Link(int factory, RTTIType type, int id)
* HISTORY: * * HISTORY: *
* 01/19/1995 JLB : Created. * * 01/19/1995 JLB : Created. *
*=============================================================================================*/ *=============================================================================================*/
void SidebarClass::Refresh_Cells(CELL cell, short const* list) void SidebarClass::Refresh_Cells(CELL cell, short const * list)
{ {
if (*list == REFRESH_SIDEBAR) { if (*list == REFRESH_SIDEBAR) {
IsToRedraw = true; IsToRedraw = true;
@@ -773,16 +772,19 @@ void SidebarClass::Draw_It(bool complete)
*/ */
int shape = complete ? 0 : 1; int shape = complete ? 0 : 1;
CC_Draw_Shape(SidebarShape, 0, SIDE_X * RESFACTOR, 8 * RESFACTOR, WINDOW_MAIN, SHAPE_WIN_REL); /*
** 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);
CC_Draw_Shape(SidebarMiddleShape, shape, SIDE_X * RESFACTOR, (8 + 80) * 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) + 3, WINDOW_MAIN, SHAPE_WIN_REL); CC_Draw_Shape(SidebarBottomShape, shape, SIDE_X * RESFACTOR, ScreenHeight - ( 80*RESFACTOR ), WINDOW_MAIN, SHAPE_WIN_REL);
Repair.Draw_Me(true); Repair.Draw_Me(true);
Upgrade.Draw_Me(true); Upgrade.Draw_Me(true);
Zoom.Draw_Me(true); Zoom.Draw_Me(true);
LogicPage->Unlock(); LogicPage->Unlock();
} }
} }
@@ -800,6 +802,7 @@ void SidebarClass::Draw_It(bool complete)
Zoom.Draw_Me(true); Zoom.Draw_Me(true);
} }
} }
//IsToRedraw = false;
BEnd(BENCH_SIDEBAR); BEnd(BENCH_SIDEBAR);
} }
@@ -827,7 +830,7 @@ void SidebarClass::Draw_It(bool complete)
* 12/31/1994 JLB : Uses mouse coordinate parameters. * * 12/31/1994 JLB : Uses mouse coordinate parameters. *
* 06/27/1995 JLB : <TAB> key toggles sidebar. * * 06/27/1995 JLB : <TAB> key toggles sidebar. *
*=============================================================================================*/ *=============================================================================================*/
void SidebarClass::AI(KeyNumType& input, int x, int y) void SidebarClass::AI(KeyNumType & input, int x, int y)
{ {
bool redraw = true; bool redraw = true;
@@ -891,20 +894,19 @@ void SidebarClass::AI(KeyNumType& input, int x, int y)
*/ */
if (PlayerPtr->BScan) { if (PlayerPtr->BScan) {
Activate_Repair(true); Activate_Repair(true);
} } else {
else {
Activate_Repair(false); Activate_Repair(false);
} }
if (input == (BUTTON_REPAIR | KN_BUTTON)) { if (input == (BUTTON_REPAIR|KN_BUTTON)) {
Repair_Mode_Control(-1); Repair_Mode_Control(-1);
} }
if (input == (BUTTON_ZOOM | KN_BUTTON)) { if (input == (BUTTON_ZOOM|KN_BUTTON)) {
Zoom_Mode_Control(); Zoom_Mode_Control();
} }
if (input == (BUTTON_UPGRADE | KN_BUTTON)) { if (input == (BUTTON_UPGRADE|KN_BUTTON)) {
Sell_Mode_Control(-1); Sell_Mode_Control(-1);
} }
@@ -1028,7 +1030,7 @@ bool SidebarClass::Activate(int control)
** activate it on the left side of the screen. ** activate it on the left side of the screen.
*/ */
if (IsSidebarActive /*&& X*/) { if (IsSidebarActive /*&& X*/) {
Set_View_Dimensions(0, 8 * RESFACTOR, SeenBuff.Get_Width() - (SIDE_WIDTH * RESFACTOR)); Set_View_Dimensions( 0, 8 * RESFACTOR, SeenBuff.Get_Width() - ( SIDE_WIDTH * RESFACTOR ) );
IsToRedraw = true; IsToRedraw = true;
Help_Text(TXT_NONE); Help_Text(TXT_NONE);
@@ -1046,8 +1048,7 @@ bool SidebarClass::Activate(int control)
Add_A_Button(Map.RadarButton); Add_A_Button(Map.RadarButton);
Map.PowerButton.Zap(); Map.PowerButton.Zap();
Add_A_Button(Map.PowerButton); Add_A_Button(Map.PowerButton);
} } else {
else {
Help_Text(TXT_NONE); Help_Text(TXT_NONE);
Set_View_Dimensions(0, 0); Set_View_Dimensions(0, 0);
Remove_A_Button(Repair); Remove_A_Button(Repair);
@@ -1085,7 +1086,7 @@ bool SidebarClass::Activate(int control)
* HISTORY: * * HISTORY: *
* 12/31/1994 JLB : Created. * * 12/31/1994 JLB : Created. *
*=============================================================================================*/ *=============================================================================================*/
SidebarClass::StripClass::StripClass(InitClass const&) : SidebarClass::StripClass::StripClass(InitClass const & ) :
X(0), X(0),
Y(0), Y(0),
ID(0), ID(0),
@@ -1123,11 +1124,11 @@ SidebarClass::StripClass::StripClass(InitClass const&) :
* HISTORY: * * HISTORY: *
* 12/31/1994 JLB : Created. * * 12/31/1994 JLB : Created. *
*=============================================================================================*/ *=============================================================================================*/
void SidebarClass::StripClass::One_Time(int) void SidebarClass::StripClass::One_Time(int )
{ {
// Sidebar height // Sidebar height
HEIGHT = ScreenHeight; HEIGHT = ScreenHeight;
MaxButtonsVisible = (HEIGHT - ((SIDE_Y + TOP_HEIGHT + OBJECT_HEIGHT) * RESFACTOR)) / (OBJECT_HEIGHT * RESFACTOR); MaxButtonsVisible = ( HEIGHT - ( ( SIDE_Y + TOP_HEIGHT + OBJECT_HEIGHT ) * RESFACTOR ) ) / ( OBJECT_HEIGHT * RESFACTOR );
/* /*
** Sidebar is player team specific in Hires ** Sidebar is player team specific in Hires
@@ -1138,7 +1139,7 @@ void SidebarClass::StripClass::One_Time(int)
char buffer[_MAX_FNAME]; char buffer[_MAX_FNAME];
sprintf(buffer, "%sICON", SpecialWeaponFile[lp]); sprintf(buffer, "%sICON", SpecialWeaponFile[lp]);
char fullname[_MAX_FNAME + _MAX_EXT]; char fullname[_MAX_FNAME+_MAX_EXT];
_makepath(fullname, NULL, NULL, buffer, ".SHP"); _makepath(fullname, NULL, NULL, buffer, ".SHP");
SpecialShapes[lp] = MFCD::Retrieve(fullname); SpecialShapes[lp] = MFCD::Retrieve(fullname);
} }
@@ -1160,7 +1161,7 @@ void SidebarClass::StripClass::One_Time(int)
* HISTORY: * * HISTORY: *
* 05/19/1995 JLB : commented * * 05/19/1995 JLB : commented *
*=============================================================================================*/ *=============================================================================================*/
void const* SidebarClass::StripClass::Get_Special_Cameo(SpecialWeaponType type) void const * SidebarClass::StripClass::Get_Special_Cameo(SpecialWeaponType type)
{ {
if ((unsigned)type < SPC_COUNT) { if ((unsigned)type < SPC_COUNT) {
return(SpecialShapes[type]); return(SpecialShapes[type]);
@@ -1222,25 +1223,38 @@ void SidebarClass::StripClass::Init_IO(int id)
ID = id; ID = id;
UpButton[ID].IsSticky = true; UpButton[ID].IsSticky = true;
UpButton[ID].ID = BUTTON_UP + id; UpButton[ID].ID = BUTTON_UP+id;
UpButton[ID].X = X + (UP_X_OFFSET * RESFACTOR); UpButton[ID].X = X + (UP_X_OFFSET * RESFACTOR);
UpButton[ID].Y = HEIGHT - ((OBJECT_HEIGHT + 7) * RESFACTOR); UpButton[ID].Y = HEIGHT - ( ( OBJECT_HEIGHT + 7 ) * RESFACTOR );
#if (FRENCH)
#ifdef WIN32
UpButton[ID].Set_Shape(MFCD::Retrieve("STRIPUP.SHP")); 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].IsSticky = true;
DownButton[ID].ID = BUTTON_DOWN + id; DownButton[ID].ID = BUTTON_DOWN+id;
DownButton[ID].X = X + (DOWN_X_OFFSET * RESFACTOR); DownButton[ID].X = X + (DOWN_X_OFFSET * RESFACTOR);
DownButton[ID].Y = HEIGHT - ((OBJECT_HEIGHT + 7) * 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")); DownButton[ID].Set_Shape(MFCD::Retrieve("STRIPDN.SHP"));
UpButton[ID].Y += 3;
DownButton[ID].Y += 3;
for (int index = 0; index < MaxButtonsVisible; index++) { for (int index = 0; index < MaxButtonsVisible; index++) {
SelectClass& g = SelectButton[ID][index]; SelectClass & g = SelectButton[ID][index];
g.ID = BUTTON_SELECT; g.ID = BUTTON_SELECT;
g.X = X; g.X = X;
g.Y = Y + ((OBJECT_HEIGHT * index) * RESFACTOR); g.Y = Y + ((OBJECT_HEIGHT*index) * RESFACTOR);
g.Width = OBJECT_WIDTH * RESFACTOR; g.Width = OBJECT_WIDTH * RESFACTOR;
g.Height = OBJECT_HEIGHT * RESFACTOR; g.Height = OBJECT_HEIGHT * RESFACTOR;
g.Set_Owner(*this, index); g.Set_Owner(*this, index);
@@ -1265,28 +1279,28 @@ void SidebarClass::StripClass::Init_Theater(TheaterType theater)
Reload_LogoShapes(); Reload_LogoShapes();
if ((theater != THEATER_NONE) && (theater != ::LastTheater)) { if ( (theater != THEATER_NONE) && (theater != ::LastTheater)) {
static TLucentType const ClockCols[1] = { static TLucentType const ClockCols[1] = {
{GREEN, BLACK, 100, 0} {GREEN, BLACK, 100, 0}
// {GREEN, LTGREY, 180, 0} // {GREEN, LTGREY, 180, 0}
}; };
/* /*
** Make sure that remapping doesn't occur on the colors that cycle. ** Make sure that remapping doesn't occur on the colors that cycle.
*/ */
PaletteClass pal = OriginalPalette; PaletteClass pal = OriginalPalette;
memset(&pal[CYCLE_COLOR_START * 3], 0x3f, CYCLE_COLOR_COUNT * 3); memset(&pal[CYCLE_COLOR_START*3], 0x3f, CYCLE_COLOR_COUNT*3);
Build_Translucent_Table(pal, &ClockCols[0], 1, (void*)ClockTranslucentTable); Build_Translucent_Table(pal, &ClockCols[0], 1, (void*)ClockTranslucentTable);
// Mem_Copy(GamePalette, OriginalPalette, 768); // Mem_Copy(GamePalette, OriginalPalette, 768);
// memset(&GamePalette[CYCLE_COLOR_START*3], 0x3f, CYCLE_COLOR_COUNT*3); // memset(&GamePalette[CYCLE_COLOR_START*3], 0x3f, CYCLE_COLOR_COUNT*3);
/* /*
** Create the translucent table used for the sidebar. ** Create the translucent table used for the sidebar.
*/ */
// Build_Translucent_Table(GamePalette, &ClockCols[0], 1, (void*)ClockTranslucentTable); // Build_Translucent_Table(GamePalette, &ClockCols[0], 1, (void*)ClockTranslucentTable);
// GamePalette = OriginalPalette; // GamePalette = OriginalPalette;
Conquer_Build_Fading_Table(GamePalette, &ClockTranslucentTable[256], BLACK, 100); Conquer_Build_Fading_Table(GamePalette, &ClockTranslucentTable[256], BLACK, 100);
} }
@@ -1297,7 +1311,7 @@ void SidebarClass::StripClass::Reload_LogoShapes(void)
/* /*
** Load hi-res strip art here since it is player side specific ** Load hi-res strip art here since it is player side specific
*/ */
static char* stripnames[] = { static char * stripnames[]={
"stripna.shp", //Nato "stripna.shp", //Nato
"stripna.shp", "stripna.shp",
"stripus.shp", //USSR "stripus.shp", //USSR
@@ -1315,13 +1329,13 @@ void SidebarClass::StripClass::Reload_LogoShapes(void)
** Sidebar art is dependent on the side of the player ** Sidebar art is dependent on the side of the player
*/ */
if (PlayerPtr) { if(PlayerPtr) {
houseloaded = PlayerPtr->ActLike; houseloaded = PlayerPtr->ActLike;
} }
// jmarshall // jmarshall
if (houseloaded >= HOUSE_BAD) if (houseloaded >= HOUSE_BAD)
return; return;
// jmarshall end // jmarshall end
LogoShapes = (void*)MFCD::Retrieve(stripnames[houseloaded]); LogoShapes = (void*)MFCD::Retrieve(stripnames[houseloaded]);
} }
@@ -1444,9 +1458,8 @@ bool SidebarClass::StripClass::Scroll(bool up)
if (up) { if (up) {
if (!TopIndex) return(false); if (!TopIndex) return(false);
Scroller--; Scroller--;
} } else {
else { if ( TopIndex+ MaxButtonsVisible >= BuildableCount ) return(false);
if (TopIndex + MaxButtonsVisible >= BuildableCount) return(false);
Scroller++; Scroller++;
} }
return(true); return(true);
@@ -1497,7 +1510,7 @@ void SidebarClass::StripClass::Flag_To_Redraw(void)
* 12/31/1994 JLB : Created. * * 12/31/1994 JLB : Created. *
* 12/31/1994 JLB : Uses mouse coordinate parameters. * * 12/31/1994 JLB : Uses mouse coordinate parameters. *
*=============================================================================================*/ *=============================================================================================*/
bool SidebarClass::StripClass::AI(KeyNumType& input, int, int) bool SidebarClass::StripClass::AI(KeyNumType & input, int , int )
{ {
bool redraw = false; bool redraw = false;
@@ -1505,13 +1518,13 @@ bool SidebarClass::StripClass::AI(KeyNumType& input, int, int)
** If this is scroll button for this side strip, then scroll the strip as ** If this is scroll button for this side strip, then scroll the strip as
** indicated. ** indicated.
*/ */
if (input == (UpButton[ID].ID | KN_BUTTON)) { // && !IsScrolling if (input == (UpButton[ID].ID|KN_BUTTON)) { // && !IsScrolling
UpButton[ID].IsPressed = false; UpButton[ID].IsPressed = false;
if (!Scroll(true)) { if (!Scroll(true)) {
Sound_Effect(VOC_SCOLD); Sound_Effect(VOC_SCOLD);
} }
} }
if (input == (DownButton[ID].ID | KN_BUTTON)) { // && !IsScrolling if (input == (DownButton[ID].ID|KN_BUTTON)) { // && !IsScrolling
DownButton[ID].IsPressed = false; DownButton[ID].IsPressed = false;
if (!Scroll(false)) { if (!Scroll(false)) {
Sound_Effect(VOC_SCOLD); Sound_Effect(VOC_SCOLD);
@@ -1523,10 +1536,9 @@ bool SidebarClass::StripClass::AI(KeyNumType& input, int, int)
** logic handler. This might result in up or down scrolling. ** logic handler. This might result in up or down scrolling.
*/ */
if (!IsScrolling && Scroller) { if (!IsScrolling && Scroller) {
if (BuildableCount <= MaxButtonsVisible) { if (BuildableCount <= MaxButtonsVisible ) {
Scroller = 0; Scroller = 0;
} } else {
else {
/* /*
** Top of list is moving toward lower ordered entries in the object list. It looks like ** Top of list is moving toward lower ordered entries in the object list. It looks like
@@ -1536,8 +1548,7 @@ bool SidebarClass::StripClass::AI(KeyNumType& input, int, int)
if (Scroller < 0) { if (Scroller < 0) {
if (!TopIndex) { if (!TopIndex) {
Scroller = 0; Scroller = 0;
} } else {
else {
Scroller++; Scroller++;
IsScrollingDown = false; IsScrollingDown = false;
IsScrolling = true; IsScrolling = true;
@@ -1545,12 +1556,10 @@ bool SidebarClass::StripClass::AI(KeyNumType& input, int, int)
Slid = 0; Slid = 0;
} }
} } else {
else {
if (TopIndex + MaxButtonsVisible >= BuildableCount) { if (TopIndex + MaxButtonsVisible >= BuildableCount) {
Scroller = 0; Scroller = 0;
} } else {
else {
Scroller--; Scroller--;
Slid = OBJECT_HEIGHT; Slid = OBJECT_HEIGHT;
IsScrollingDown = true; IsScrollingDown = true;
@@ -1571,8 +1580,7 @@ bool SidebarClass::StripClass::AI(KeyNumType& input, int, int)
Slid = 0; Slid = 0;
TopIndex++; TopIndex++;
} }
} } else {
else {
Slid += SCROLL_RATE; Slid += SCROLL_RATE;
if (Slid >= OBJECT_HEIGHT) { if (Slid >= OBJECT_HEIGHT) {
IsScrolling = false; IsScrolling = false;
@@ -1605,7 +1613,7 @@ bool SidebarClass::StripClass::AI(KeyNumType& input, int, int)
int factoryid = Buildables[index].Factory; int factoryid = Buildables[index].Factory;
if (factoryid != -1) { if (factoryid != -1) {
FactoryClass* factory = Factories.Raw_Ptr(factoryid); FactoryClass * factory = Factories.Raw_Ptr(factoryid);
if (factory && (factory->Has_Changed() || factory->Is_Blocked())) { if (factory && (factory->Has_Changed() || factory->Is_Blocked())) {
redraw = true; redraw = true;
@@ -1617,7 +1625,7 @@ bool SidebarClass::StripClass::AI(KeyNumType& input, int, int)
** the main exception to the ability to leave the factory under their own ** the main exception to the ability to leave the factory under their own
** power. ** power.
*/ */
TechnoClass* pending = factory->Get_Object(); TechnoClass * pending = factory->Get_Object();
if (pending != NULL) { if (pending != NULL) {
switch (pending->What_Am_I()) { switch (pending->What_Am_I()) {
case RTTI_VESSEL: case RTTI_VESSEL:
@@ -1694,8 +1702,8 @@ void SidebarClass::StripClass::Draw_It(bool complete)
/* /*
** New sidebar needs to be drawn not filled ** New sidebar needs to be drawn not filled
*/ */
if (BuildableCount < MaxButtonsVisible) { if ( BuildableCount < MaxButtonsVisible ) {
CC_Draw_Shape(LogoShapes, ID, X + (2 * RESFACTOR), Y, WINDOW_MAIN, SHAPE_WIN_REL | SHAPE_NORMAL, 0); CC_Draw_Shape( LogoShapes, ID, X+(2*RESFACTOR), Y, WINDOW_MAIN, SHAPE_WIN_REL|SHAPE_NORMAL, 0);
} }
/* /*
@@ -1713,20 +1721,20 @@ void SidebarClass::StripClass::Draw_It(bool complete)
bool completed; bool completed;
int stage; int stage;
bool darken = false; bool darken = false;
void const* shapefile = 0; void const * shapefile = 0;
int shapenum = 0; int shapenum = 0;
void const* remapper = 0; void const * remapper = 0;
FactoryClass* factory = 0; FactoryClass * factory = 0;
int index = i + TopIndex; int index = i+TopIndex;
int x = X; int x = X;
int y = Y + (i * OBJECT_HEIGHT * RESFACTOR); int y = Y + (i*OBJECT_HEIGHT * RESFACTOR);
/* /*
** If the strip is scrolling, then the offset is adjusted accordingly. ** If the strip is scrolling, then the offset is adjusted accordingly.
*/ */
if (IsScrolling) { if (IsScrolling) {
y -= (OBJECT_HEIGHT - Slid) * RESFACTOR; y -= (OBJECT_HEIGHT - Slid) * RESFACTOR;
// y -= OBJECT_HEIGHT - Slid; // y -= OBJECT_HEIGHT - Slid;
} }
/* /*
@@ -1734,7 +1742,7 @@ void SidebarClass::StripClass::Draw_It(bool complete)
** slot. This shape pointer is used to draw the underlying graphic there. ** slot. This shape pointer is used to draw the underlying graphic there.
*/ */
if (index < BuildableCount) { if (index < BuildableCount) {
ObjectTypeClass const* obj = NULL; ObjectTypeClass const * obj = NULL;
SpecialWeaponType spc = SPC_NONE; SpecialWeaponType spc = SPC_NONE;
if (Buildables[index].BuildableType != RTTI_SPECIAL) { if (Buildables[index].BuildableType != RTTI_SPECIAL) {
@@ -1746,7 +1754,7 @@ void SidebarClass::StripClass::Draw_It(bool complete)
** Fetch the remap table that is appropriate for this object ** Fetch the remap table that is appropriate for this object
** type. ** type.
*/ */
remapper = PlayerPtr->Remap_Table(false, ((TechnoTypeClass const*)obj)->Remap); remapper = PlayerPtr->Remap_Table(false, ((TechnoTypeClass const *)obj)->Remap);
/* /*
** If there is already a factory producing this kind of object, then all ** If there is already a factory producing this kind of object, then all
@@ -1772,10 +1780,9 @@ void SidebarClass::StripClass::Draw_It(bool complete)
completed = factory->Has_Completed(); completed = factory->Has_Completed();
stage = factory->Completion(); stage = factory->Completion();
darken = false; darken = false;
} } else {
else {
production = false; production = false;
// darken = IsBuilding; // darken = IsBuilding;
/* /*
** Darken the imagery if a factory of a matching type is ** Darken the imagery if a factory of a matching type is
@@ -1783,13 +1790,11 @@ void SidebarClass::StripClass::Draw_It(bool complete)
*/ */
darken = isbusy; darken = isbusy;
} }
} } else {
else {
darken = PlayerPtr->Is_Hack_Prevented(Buildables[index].BuildableType, Buildables[index].BuildableID); darken = PlayerPtr->Is_Hack_Prevented(Buildables[index].BuildableType, Buildables[index].BuildableID);
} }
} } else {
else {
spc = SpecialWeaponType(Buildables[index].BuildableID); spc = SpecialWeaponType(Buildables[index].BuildableID);
shapefile = Get_Special_Cameo(spc); shapefile = Get_Special_Cameo(spc);
@@ -1810,22 +1815,19 @@ void SidebarClass::StripClass::Draw_It(bool complete)
remapper = Map.FadingLight; remapper = Map.FadingLight;
} }
} } else {
else {
shapefile = LogoShapes; shapefile = LogoShapes;
if (!darken) { if (!darken) {
shapenum = SB_BLANK; shapenum = SB_BLANK;
} }
} }
} } else {
else {
shapefile = LogoShapes; shapefile = LogoShapes;
shapenum = SB_BLANK; shapenum = SB_BLANK;
production = false; production = false;
} }
remapper = 0; remapper = 0;
/* /*
** Now that the shape of the object at the current working slot has been found, ** Now that the shape of the object at the current working slot has been found,
** draw it and any graphic overlays as necessary. ** draw it and any graphic overlays as necessary.
@@ -1834,10 +1836,10 @@ void SidebarClass::StripClass::Draw_It(bool complete)
*/ */
if (shapenum != SB_BLANK || shapefile != LogoShapes) { if (shapenum != SB_BLANK || shapefile != LogoShapes) {
CC_Draw_Shape(shapefile, shapenum, CC_Draw_Shape(shapefile, shapenum,
x - (WindowList[WINDOW_SIDEBAR][WINDOWX]) + (LEFT_EDGE_OFFSET * RESFACTOR), x-(WindowList[WINDOW_SIDEBAR][WINDOWX])+(LEFT_EDGE_OFFSET * RESFACTOR),
y - WindowList[WINDOW_SIDEBAR][WINDOWY], y-WindowList[WINDOW_SIDEBAR][WINDOWY],
WINDOW_SIDEBAR, WINDOW_SIDEBAR,
SHAPE_NORMAL | SHAPE_WIN_REL | (remapper ? SHAPE_FADING : SHAPE_NORMAL), SHAPE_NORMAL|SHAPE_WIN_REL| (remapper ? SHAPE_FADING : SHAPE_NORMAL),
remapper); remapper);
/* /*
@@ -1846,10 +1848,10 @@ void SidebarClass::StripClass::Draw_It(bool complete)
*/ */
if (darken) { if (darken) {
CC_Draw_Shape(ClockShapes, 0, CC_Draw_Shape(ClockShapes, 0,
x - (WindowList[WINDOW_SIDEBAR][WINDOWX]) + (LEFT_EDGE_OFFSET * RESFACTOR), x-(WindowList[WINDOW_SIDEBAR][WINDOWX])+(LEFT_EDGE_OFFSET * RESFACTOR),
y - WindowList[WINDOW_SIDEBAR][WINDOWY], y-WindowList[WINDOW_SIDEBAR][WINDOWY],
WINDOW_SIDEBAR, WINDOW_SIDEBAR,
SHAPE_NORMAL | SHAPE_WIN_REL | SHAPE_GHOST, SHAPE_NORMAL|SHAPE_WIN_REL|SHAPE_GHOST,
NULL, ClockTranslucentTable); NULL, ClockTranslucentTable);
} }
} }
@@ -1865,17 +1867,16 @@ void SidebarClass::StripClass::Draw_It(bool complete)
** Display text showing that the object is ready to place. ** Display text showing that the object is ready to place.
*/ */
CC_Draw_Shape(ObjectTypeClass::PipShapes, PIP_READY, CC_Draw_Shape(ObjectTypeClass::PipShapes, PIP_READY,
(x - (WindowList[WINDOW_SIDEBAR][WINDOWX])) + (LEFT_EDGE_OFFSET + 15) * RESFACTOR, (x-(WindowList[WINDOW_SIDEBAR][WINDOWX]))+(LEFT_EDGE_OFFSET+15) * RESFACTOR,
(y - WindowList[WINDOW_SIDEBAR][WINDOWY]) + (4 * RESFACTOR), (y-WindowList[WINDOW_SIDEBAR][WINDOWY])+(4 * RESFACTOR),
WINDOW_SIDEBAR, SHAPE_CENTER); WINDOW_SIDEBAR, SHAPE_CENTER);
} } else {
else {
CC_Draw_Shape(ClockShapes, stage + 1, CC_Draw_Shape(ClockShapes, stage+1,
x - (WindowList[WINDOW_SIDEBAR][WINDOWX]) + (LEFT_EDGE_OFFSET * RESFACTOR), x-(WindowList[WINDOW_SIDEBAR][WINDOWX])+(LEFT_EDGE_OFFSET * RESFACTOR),
y - WindowList[WINDOW_SIDEBAR][WINDOWY], y-WindowList[WINDOW_SIDEBAR][WINDOWY],
WINDOW_SIDEBAR, WINDOW_SIDEBAR,
SHAPE_NORMAL | SHAPE_WIN_REL | SHAPE_GHOST, SHAPE_NORMAL|SHAPE_WIN_REL|SHAPE_GHOST,
NULL, ClockTranslucentTable); NULL, ClockTranslucentTable);
/* /*
@@ -1883,8 +1884,8 @@ void SidebarClass::StripClass::Draw_It(bool complete)
*/ */
if (factory && !factory->Is_Building()) { if (factory && !factory->Is_Building()) {
CC_Draw_Shape(ObjectTypeClass::PipShapes, PIP_HOLDING, CC_Draw_Shape(ObjectTypeClass::PipShapes, PIP_HOLDING,
(x - (WindowList[WINDOW_SIDEBAR][WINDOWX])) + ((LEFT_EDGE_OFFSET + 15) * RESFACTOR), (x-(WindowList[WINDOW_SIDEBAR][WINDOWX])) + ((LEFT_EDGE_OFFSET+15) * RESFACTOR),
(y - WindowList[WINDOW_SIDEBAR][WINDOWY]) + (4 * RESFACTOR), (y-WindowList[WINDOW_SIDEBAR][WINDOWY])+(4 * RESFACTOR),
WINDOW_SIDEBAR, SHAPE_CENTER); WINDOW_SIDEBAR, SHAPE_CENTER);
} }
} }
@@ -1931,15 +1932,13 @@ bool SidebarClass::StripClass::Recalc(void)
*/ */
bool redraw = false; bool redraw = false;
for (int index = 0; index < BuildableCount; index++) { for (int index = 0; index < BuildableCount; index++) {
TechnoTypeClass const* tech = Fetch_Techno_Type(Buildables[index].BuildableType, Buildables[index].BuildableID); TechnoTypeClass const * tech = Fetch_Techno_Type(Buildables[index].BuildableType, Buildables[index].BuildableID);
if (tech != NULL) { if (tech != NULL) {
ok = tech->Who_Can_Build_Me(true, false, PlayerPtr->Class->House) != NULL; ok = tech->Who_Can_Build_Me(true, false, PlayerPtr->Class->House) != NULL;
} } else {
else {
if ((unsigned)Buildables[index].BuildableID < SPC_COUNT) { if ((unsigned)Buildables[index].BuildableID < SPC_COUNT) {
ok = PlayerPtr->SuperWeapon[Buildables[index].BuildableID].Is_Present(); ok = PlayerPtr->SuperWeapon[Buildables[index].BuildableID].Is_Present();
} } else {
else {
ok = false; ok = false;
} }
} }
@@ -1949,8 +1948,8 @@ bool SidebarClass::StripClass::Recalc(void)
/* /*
** Removes this entry from the list. ** Removes this entry from the list.
*/ */
if (BuildableCount > 1 && index < BuildableCount - 1) { if (BuildableCount > 1 && index < BuildableCount-1) {
memcpy(&Buildables[index], &Buildables[index + 1], sizeof(Buildables[0]) * ((BuildableCount - index) - 1)); memcpy(&Buildables[index], &Buildables[index+1], sizeof(Buildables[0])*((BuildableCount-index)-1));
} }
TopIndex = 0; TopIndex = 0;
IsToRedraw = true; IsToRedraw = true;
@@ -1989,7 +1988,7 @@ bool SidebarClass::StripClass::Recalc(void)
* 01/19/1995 JLB : Created. * * 01/19/1995 JLB : Created. *
*=============================================================================================*/ *=============================================================================================*/
SidebarClass::StripClass::SelectClass::SelectClass(void) : SidebarClass::StripClass::SelectClass::SelectClass(void) :
ControlClass(0, 0, 0, (OBJECT_WIDTH - 1)* RESFACTOR, OBJECT_HEIGHT* RESFACTOR, LEFTPRESS | RIGHTPRESS | LEFTUP), ControlClass(0, 0, 0, (OBJECT_WIDTH-1) * RESFACTOR, OBJECT_HEIGHT * RESFACTOR, LEFTPRESS|RIGHTPRESS|LEFTUP),
Strip(0), Strip(0),
Index(0) Index(0)
{ {
@@ -2015,7 +2014,7 @@ SidebarClass::StripClass::SelectClass::SelectClass(void) :
* HISTORY: * * HISTORY: *
* 01/19/1995 JLB : Created. * * 01/19/1995 JLB : Created. *
*=============================================================================================*/ *=============================================================================================*/
void SidebarClass::StripClass::SelectClass::Set_Owner(StripClass& strip, int index) void SidebarClass::StripClass::SelectClass::Set_Owner(StripClass & strip, int index)
{ {
Strip = &strip; Strip = &strip;
Index = index; Index = index;
@@ -2042,7 +2041,7 @@ void SidebarClass::StripClass::SelectClass::Set_Owner(StripClass& strip, int ind
* 01/19/1995 JLB : Created. * * 01/19/1995 JLB : Created. *
* 10/09/1996 JLB : Sonar pulse converted to regular event type. * * 10/09/1996 JLB : Sonar pulse converted to regular event type. *
*=============================================================================================*/ *=============================================================================================*/
int SidebarClass::StripClass::SelectClass::Action(unsigned flags, KeyNumType& key) int SidebarClass::StripClass::SelectClass::Action(unsigned flags, KeyNumType & key)
{ {
if (Strip == NULL) return 0; if (Strip == NULL) return 0;
@@ -2050,9 +2049,9 @@ int SidebarClass::StripClass::SelectClass::Action(unsigned flags, KeyNumType& ke
RTTIType otype = Strip->Buildables[index].BuildableType; RTTIType otype = Strip->Buildables[index].BuildableType;
int oid = Strip->Buildables[index].BuildableID; int oid = Strip->Buildables[index].BuildableID;
int fnumber = Strip->Buildables[index].Factory; int fnumber = Strip->Buildables[index].Factory;
RemapControlType* scheme = GadgetClass::Get_Color_Scheme(); RemapControlType * scheme = GadgetClass::Get_Color_Scheme();
ObjectTypeClass const* choice = NULL; ObjectTypeClass const * choice = NULL;
SpecialWeaponType spc = SPC_NONE; SpecialWeaponType spc = SPC_NONE;
/* /*
@@ -2062,15 +2061,14 @@ int SidebarClass::StripClass::SelectClass::Action(unsigned flags, KeyNumType& ke
** kind of factory is specified by the "genfactory" value. This can be used to see ** kind of factory is specified by the "genfactory" value. This can be used to see
** if the factory type is currently busy or not. ** if the factory type is currently busy or not.
*/ */
FactoryClass* factory = PlayerPtr->Fetch_Factory(otype); FactoryClass * factory = PlayerPtr->Fetch_Factory(otype);
Map.Override_Mouse_Shape(MOUSE_NORMAL); Map.Override_Mouse_Shape(MOUSE_NORMAL);
if (index < Strip->BuildableCount) { if (index < Strip->BuildableCount) {
if (otype != RTTI_SPECIAL) { if (otype != RTTI_SPECIAL) {
choice = Fetch_Techno_Type(otype, oid); choice = Fetch_Techno_Type(otype, oid);
} } else {
else {
spc = SpecialWeaponType(oid); spc = SpecialWeaponType(oid);
} }
@@ -2078,8 +2076,7 @@ int SidebarClass::StripClass::SelectClass::Action(unsigned flags, KeyNumType& ke
factory = Factories.Raw_Ptr(fnumber); factory = Factories.Raw_Ptr(fnumber);
} }
} } else {
else {
Map.Help_Text(TXT_NONE); Map.Help_Text(TXT_NONE);
} }
@@ -2112,19 +2109,16 @@ int SidebarClass::StripClass::SelectClass::Action(unsigned flags, KeyNumType& ke
Map.IsTargettingMode = spc; Map.IsTargettingMode = spc;
Unselect_All(); Unselect_All();
Speak(VOX_SELECT_TARGET); Speak(VOX_SELECT_TARGET);
} } else {
else {
OutList.Add(EventClass(EventClass::SPECIAL_PLACE, SPC_SONAR_PULSE, 0)); OutList.Add(EventClass(EventClass::SPECIAL_PLACE, SPC_SONAR_PULSE, 0));
} }
} } else {
else {
PlayerPtr->SuperWeapon[spc].Impatient_Click(); PlayerPtr->SuperWeapon[spc].Impatient_Click();
} }
} }
} }
} } else {
else {
if (choice != NULL) { if (choice != NULL) {
@@ -2164,8 +2158,7 @@ int SidebarClass::StripClass::SelectClass::Action(unsigned flags, KeyNumType& ke
if (!factory->Is_Building()) { if (!factory->Is_Building()) {
Speak(VOX_CANCELED); Speak(VOX_CANCELED);
OutList.Add(EventClass(EventClass::ABANDON, otype, oid)); OutList.Add(EventClass(EventClass::ABANDON, otype, oid));
} } else {
else {
Speak(VOX_SUSPENDED); Speak(VOX_SUSPENDED);
OutList.Add(EventClass(EventClass::SUSPEND, otype, oid)); OutList.Add(EventClass(EventClass::SUSPEND, otype, oid));
Map.Column[0].IsToRedraw = true; Map.Column[0].IsToRedraw = true;
@@ -2195,8 +2188,7 @@ int SidebarClass::StripClass::SelectClass::Action(unsigned flags, KeyNumType& ke
*/ */
if (factory->Is_Building()) { if (factory->Is_Building()) {
Speak(VOX_NO_FACTORY); Speak(VOX_NO_FACTORY);
} } else {
else {
/* /*
** If production has completed, then attempt to have the object exit ** If production has completed, then attempt to have the object exit
@@ -2204,17 +2196,15 @@ int SidebarClass::StripClass::SelectClass::Action(unsigned flags, KeyNumType& ke
*/ */
if (factory->Has_Completed()) { if (factory->Has_Completed()) {
TechnoClass* pending = factory->Get_Object(); TechnoClass * pending = factory->Get_Object();
if (!pending && factory->Get_Special_Item()) { if (!pending && factory->Get_Special_Item()) {
Map.IsTargettingMode = SPC_ANY; Map.IsTargettingMode = SPC_ANY;
} } else {
else { BuildingClass * builder = pending->Who_Can_Build_Me(false, false);
BuildingClass* builder = pending->Who_Can_Build_Me(false, false);
if (!builder) { if (!builder) {
OutList.Add(EventClass(EventClass::ABANDON, otype, oid)); OutList.Add(EventClass(EventClass::ABANDON, otype, oid));
Speak(VOX_NO_FACTORY); Speak(VOX_NO_FACTORY);
} } else {
else {
/* /*
** If the completed object is a building, then change the ** If the completed object is a building, then change the
@@ -2223,9 +2213,8 @@ int SidebarClass::StripClass::SelectClass::Action(unsigned flags, KeyNumType& ke
** the building is actually placed down. ** the building is actually placed down.
*/ */
if (pending->What_Am_I() == RTTI_BUILDING) { if (pending->What_Am_I() == RTTI_BUILDING) {
PlayerPtr->Manual_Place(builder, (BuildingClass*)pending); PlayerPtr->Manual_Place(builder, (BuildingClass *)pending);
} } else {
else {
/* /*
** For objects that can leave the factory under their own ** For objects that can leave the factory under their own
@@ -2236,21 +2225,18 @@ int SidebarClass::StripClass::SelectClass::Action(unsigned flags, KeyNumType& ke
} }
} }
} }
} } else {
else {
if (PlayerPtr->Is_Hack_Prevented(otype, oid)) { if (PlayerPtr->Is_Hack_Prevented(otype, oid)) {
// Eva scolds the player here. // Eva scolds the player here.
} } else {
else {
/* /*
** The factory must have been in a suspended state. Resume construction ** The factory must have been in a suspended state. Resume construction
** normally. ** normally.
*/ */
if (otype == RTTI_INFANTRYTYPE) { if (otype == RTTI_INFANTRYTYPE) {
Speak(VOX_TRAINING); Speak(VOX_TRAINING);
} } else {
else {
Speak(VOX_BUILDING); Speak(VOX_BUILDING);
} }
OutList.Add(EventClass(EventClass::PRODUCE, Strip->Buildables[index].BuildableType, Strip->Buildables[index].BuildableID)); OutList.Add(EventClass(EventClass::PRODUCE, Strip->Buildables[index].BuildableType, Strip->Buildables[index].BuildableID));
@@ -2258,13 +2244,11 @@ int SidebarClass::StripClass::SelectClass::Action(unsigned flags, KeyNumType& ke
} }
} }
} } else {
else {
if (PlayerPtr->Is_Hack_Prevented(otype, oid)) { if (PlayerPtr->Is_Hack_Prevented(otype, oid)) {
// Eva scolds the player here. // Eva scolds the player here.
} } else {
else {
/* /*
** If this side strip is already busy with production, then ignore the ** If this side strip is already busy with production, then ignore the
@@ -2272,16 +2256,14 @@ int SidebarClass::StripClass::SelectClass::Action(unsigned flags, KeyNumType& ke
*/ */
if (otype == RTTI_INFANTRYTYPE) { if (otype == RTTI_INFANTRYTYPE) {
Speak(VOX_TRAINING); Speak(VOX_TRAINING);
} } else {
else {
Speak(VOX_BUILDING); Speak(VOX_BUILDING);
} }
OutList.Add(EventClass(EventClass::PRODUCE, Strip->Buildables[index].BuildableType, Strip->Buildables[index].BuildableID)); OutList.Add(EventClass(EventClass::PRODUCE, Strip->Buildables[index].BuildableType, Strip->Buildables[index].BuildableID));
} }
} }
} }
} } else {
else {
flags = 0; flags = 0;
} }
} }
@@ -2308,7 +2290,7 @@ int SidebarClass::StripClass::SelectClass::Action(unsigned flags, KeyNumType& ke
* HISTORY: * * HISTORY: *
* 03/28/1995 JLB : Created. * * 03/28/1995 JLB : Created. *
*=============================================================================================*/ *=============================================================================================*/
int SidebarClass::SBGadgetClass::Action(unsigned, KeyNumType&) int SidebarClass::SBGadgetClass::Action(unsigned , KeyNumType & )
{ {
Map.Help_Text(TXT_NONE); Map.Help_Text(TXT_NONE);
Map.Override_Mouse_Shape(MOUSE_NORMAL, false); Map.Override_Mouse_Shape(MOUSE_NORMAL, false);
@@ -2405,8 +2387,7 @@ bool SidebarClass::StripClass::Abandon_Production(int factory)
Factories.Raw_Ptr(factory)->Abandon(); Factories.Raw_Ptr(factory)->Abandon();
Buildables[index].Factory = -1; Buildables[index].Factory = -1;
abandon = true; abandon = true;
} } else {
else {
if (Buildables[index].Factory != -1) { if (Buildables[index].Factory != -1) {
noprod = false; noprod = false;
} }
@@ -2456,26 +2437,23 @@ void SidebarClass::Zoom_Mode_Control(void)
** radar spying readout => zoomed ** radar spying readout => zoomed
*/ */
if (IsRadarActive) { if (IsRadarActive) {
if (Is_Zoomed() || Session.Type == GAME_NORMAL) { if (Is_Zoomed() || Session.Type==GAME_NORMAL) {
if (Is_Zoomed() || !Spy_Next_House()) { if (Is_Zoomed() || !Spy_Next_House()) {
Zoom_Mode(Coord_Cell(TacticalCoord)); Zoom_Mode(Coord_Cell(TacticalCoord));
} }
} } else {
else {
if (!Spying_On_House() && !Is_Player_Names()) { if (!Spying_On_House() && !Is_Player_Names()) {
Player_Names(1); Player_Names(1);
} } else {
else {
Player_Names(0); Player_Names(0);
if (!Spy_Next_House()) { if (!Spy_Next_House()) {
Zoom_Mode(Coord_Cell(TacticalCoord)); Zoom_Mode(Coord_Cell(TacticalCoord));
} }
} }
} }
} } else {
else { if (Session.Type!=GAME_NORMAL) {
if (Session.Type != GAME_NORMAL) { Player_Names(Is_Player_Names()==0);
Player_Names(Is_Player_Names() == 0);
} }
} }
#else #else
@@ -2486,26 +2464,23 @@ void SidebarClass::Zoom_Mode_Control(void)
** radar spying readout => not zoomed ** radar spying readout => not zoomed
*/ */
if (IsRadarActive) { if (IsRadarActive) {
if (Session.Type == GAME_NORMAL) { if (Session.Type==GAME_NORMAL) {
if (!Spy_Next_House()) { if (!Spy_Next_House()) {
Zoom_Mode(Coord_Cell(TacticalCoord)); Zoom_Mode(Coord_Cell(TacticalCoord));
} }
} } else {
else {
if (!Spying_On_House() && !Is_Player_Names()) { if (!Spying_On_House() && !Is_Player_Names()) {
Player_Names(1); Player_Names(1);
} } else {
else {
Player_Names(0); Player_Names(0);
if (!Spy_Next_House()) { if (!Spy_Next_House()) {
Zoom_Mode(Coord_Cell(TacticalCoord)); Zoom_Mode(Coord_Cell(TacticalCoord));
} }
} }
} }
} } else {
else { if (Session.Type!=GAME_NORMAL) {
if (Session.Type != GAME_NORMAL) { Player_Names(Is_Player_Names()==0);
Player_Names(Is_Player_Names() == 0);
} }
} }
#endif #endif