* Center on player location at Skirmish start

This commit is contained in:
Ben Lankamp
2020-06-18 22:09:37 +02:00
parent 829f27c76f
commit 71007c06d0
7 changed files with 26 additions and 30 deletions
+1 -2
View File
@@ -3090,7 +3090,6 @@ int DisplayClass::TacticalClass::Action(unsigned flags, KeyNumType & key)
x = Get_Mouse_X();
y = Get_Mouse_Y();
bool edge = (y == 0 || x == 0 || x == SeenBuff.Get_Width()-1 || y == SeenBuff.Get_Height()-1);
COORDINATE coord = Map.Pixel_To_Coord(x, y);
CELL cell = Coord_Cell(coord);
@@ -3344,7 +3343,7 @@ int DisplayClass::TacticalClass::Selection_At_Mouse(unsigned flags, KeyNumType &
if (object != nullptr)
{
bool shiftdown = UserInput.KeyB.Shift = true;
bool shiftdown = UserInput.KeyB.Shift == true;
if (shiftdown)
{
+2 -1
View File
@@ -522,7 +522,8 @@ class HouseClass {
** This records information about the location and size of
** the base.
*/
COORDINATE Center; // Center of the base.
COORDINATE Center; // Center COORDINATE of the base.
CELL CenterCell; // Center CELL of the base.
int Radius; // Average building distance from center (leptons).
struct {
int AirDefense;
+2
View File
@@ -103,10 +103,12 @@ unsigned short WWKeyboardClass::Buff_Get(void)
while (!Check()) {} // wait for key in buffer
unsigned short temp = Fetch_Element();
/*
if (Is_Mouse_Key(temp)) {
MouseQX = Fetch_Element();
MouseQY = Fetch_Element();
}
*/
return(temp);
}
+2 -7
View File
@@ -1776,13 +1776,8 @@ int RadarClass::RTacticalClass::Action(unsigned flags, KeyNumType & key)
** or release event, special mouse queuing storage variables are used. Other
** events must use the current mouse position globals.
*/
if (flags & (LEFTPRESS|LEFTRELEASE|RIGHTPRESS|RIGHTRELEASE)) {
x = Keyboard->MouseQX;
y = Keyboard->MouseQY;
} else {
x = Get_Mouse_X();
y = Get_Mouse_Y();
}
x = Get_Mouse_X();
y = Get_Mouse_Y();
/*
** See if the mouse is over the radar general area, but not yet
+7 -2
View File
@@ -644,10 +644,14 @@ void Fill_In_Data(void)
*/
if (!Debug_Map) {
Map.SidebarClass::Activate(1);
// if (Session.Type == GAME_NORMAL) {
if (Session.Type == GAME_NORMAL) {
Scen.Views[0] = Scen.Views[1] = Scen.Views[2] = Scen.Views[3] = Scen.Waypoint[WAYPT_HOME];
Map.Set_Tactical_Position(Cell_Coord((Scen.Waypoint[WAYPT_HOME] - (MAP_CELL_W * 4 * RESFACTOR)) - (5*RESFACTOR)));
// }
}
if (Session.Type == GAME_SKIRMISH) {
Scen.Views[0] = Scen.Views[1] = Scen.Views[2] = Scen.Views[3] = PlayerPtr->CenterCell;
Map.Set_Tactical_Position( Cell_Coord( (PlayerPtr->CenterCell - (MAP_CELL_W * 4 * RESFACTOR) ) - (5 * RESFACTOR) ) );
}
}
#endif
@@ -3240,6 +3244,7 @@ static void Create_Units(bool official)
** Assign the center of this house to the waypoint location.
*/
hptr->Center = Cell_Coord(centroid);
hptr->CenterCell = centroid;
/*
** If Bases are ON, human & computer houses are treated differently
+12 -15
View File
@@ -3,21 +3,9 @@
extern KeyboardClass * Keyboard;
/*
auto utf8_decode = [](const std::string& str) -> std::wstring
{
if (str.empty()) return std::wstring();
int size_needed = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), NULL, 0);
std::wstring wstrTo(size_needed, 0);
MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), &wstrTo[0], size_needed);
return wstrTo;
};
*/
void UserInputClass::Process_Input(KeyNumType& key, int& flags, bool presentBuffer)
{
bool leftMouseProcessed = false;
SDL_GetMouseState(&Mouse.X, &Mouse.Y);
Keyboard->MouseQX = Mouse.X;
@@ -108,9 +96,18 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags, bool presentBuff
}
int keyFlags = 0x00;
if (state[SDL_SCANCODE_RSHIFT] || state[SDL_SCANCODE_LSHIFT]) keyFlags |= KN_SHIFT_BIT;
if (state[SDL_SCANCODE_RALT] || state[SDL_SCANCODE_LALT]) keyFlags |= KN_ALT_BIT;
if (state[SDL_SCANCODE_RCTRL] || state[SDL_SCANCODE_LCTRL]) keyFlags |= KN_CTRL_BIT;
if (state[SDL_SCANCODE_RSHIFT] || state[SDL_SCANCODE_LSHIFT]) {
KeyB.Shift = true;
keyFlags |= KN_SHIFT_BIT;
}
if (state[SDL_SCANCODE_RALT] || state[SDL_SCANCODE_LALT]) {
keyFlags |= KN_ALT_BIT;
KeyB.Alt = true;
}
if (state[SDL_SCANCODE_RCTRL] || state[SDL_SCANCODE_LCTRL]) {
keyFlags |= KN_CTRL_BIT;
KeyB.Control = true;
}
// handle match between SDL and internals (non-text keys)
auto element = sdl_keyMapping.find((SDL_KeyCode)event.key.keysym.sym);
-3
View File
@@ -112,9 +112,6 @@ class UserInputClass
this->Shift = false;
this->Control = false;
this->Alt = false;
LastKey = SDLK_UNKNOWN;
ASCII = 0x0;
}
};