Camera now moves correctly. Tmp hard coded keys for various camera movements.

This commit is contained in:
Justin Marshall
2020-06-04 18:46:36 -07:00
parent c167569d1b
commit 7b2d6f0f09
4 changed files with 37 additions and 27 deletions
+5 -5
View File
@@ -730,7 +730,7 @@ void Keyboard_Process(KeyNumType & input)
** Center the map about the construction yard or construction vehicle
** if one is present.
*/
if (key != 0 && key == Options.KeyBase) {
if (key != 0 && key == VK_H) {
Unselect_All();
if (PlayerPtr->CurBuildings) {
for (index = 0; index < Buildings.Count(); index++) {
@@ -862,19 +862,19 @@ void Keyboard_Process(KeyNumType & input)
** Scrolls the tactical map in the direction specified.
*/
int distance = CELL_LEPTON_W;
if (key != 0 && key == Options.KeyScrollLeft) {
if (key != 0 && key == VK_LEFT) {
Map.Scroll_Map(DIR_W, distance, true);
input = KN_NONE;
}
if (key != 0 && key == Options.KeyScrollRight) {
if (key != 0 && key == VK_RIGHT) {
Map.Scroll_Map(DIR_E, distance, true);
input = KN_NONE;
}
if (key != 0 && key == Options.KeyScrollUp) {
if (key != 0 && key == VK_UP) {
Map.Scroll_Map(DIR_N, distance, true);
input = KN_NONE;
}
if (key != 0 && key == Options.KeyScrollDown) {
if (key != 0 && key == VK_DOWN) {
Map.Scroll_Map(DIR_S, distance, true);
input = KN_NONE;
}
+19 -16
View File
@@ -562,24 +562,27 @@ short const * DisplayClass::Text_Overlap_List(char const * text, int x, int y) c
*=============================================================================================*/
void DisplayClass::Set_View_Dimensions(int x, int y, int width, int height)
{
if (width == -1) {
TacLeptonWidth = Pixel_To_Lepton(SeenBuff.Get_Width()-x);
} else {
TacLeptonWidth = width * CELL_LEPTON_W;
}
//if (width == -1) {
// TacLeptonWidth = Pixel_To_Lepton(SeenBuff.Get_Width()-x);
//} else {
// TacLeptonWidth = width * CELL_LEPTON_W;
//}
TacLeptonWidth = Pixel_To_Lepton(SeenBuff.Get_Width() - x);
// ST - 3/1/2019 12:05PM
// Made the below code more consistent with the width calculation. This is needed if we aren't going to draw the tabs at the top of the screen
//
if (height == -1) {
TacLeptonHeight = Pixel_To_Lepton(SeenBuff.Get_Height() - y);
//height = (SeenBuff.Get_Height()-y) / CELL_PIXEL_H;
}
else {
TacLeptonHeight = height * CELL_LEPTON_H;
}
//if (height == -1) {
// TacLeptonHeight = Pixel_To_Lepton(SeenBuff.Get_Height() - y);
// //height = (SeenBuff.Get_Height()-y) / CELL_PIXEL_H;
//}
//else {
// TacLeptonHeight = height * CELL_LEPTON_H;
//}
//TacLeptonHeight = height * CELL_LEPTON_H;
TacLeptonHeight = Pixel_To_Lepton(SeenBuff.Get_Height() - y);
/*
** Adjust the tactical cell if it is now in an invalid position
** because of the changed dimensions.
@@ -4228,11 +4231,11 @@ void DisplayClass::Set_Tactical_Position(COORDINATE coord)
/*
** Bound the desired location to fit the legal map edges.
*/
int xx = 0;// (int)Coord_X(coord) - (int)Cell_To_Lepton(MapCellX);
int yy = 0;// (int)Coord_Y(coord) - (int)Cell_To_Lepton(MapCellY);
int xx = (int)Coord_X(coord) - (int)Cell_To_Lepton(MapCellX);
int yy = (int)Coord_Y(coord) - (int)Cell_To_Lepton(MapCellY);
Confine_Rect(&xx, &yy, TacLeptonWidth, TacLeptonHeight, Cell_To_Lepton(MapCellWidth) + GlyphXClientSidebarWidthInLeptons, Cell_To_Lepton(MapCellHeight)); // Needed to accomodate Glyphx client sidebar. ST - 4/12/2019 5:29PM
// Confine_Rect(&xx, &yy, TacLeptonWidth, TacLeptonHeight, Cell_To_Lepton(MapCellWidth), Cell_To_Lepton(MapCellHeight));
// Confine_Rect(&xx, &yy, TacLeptonWidth, TacLeptonHeight, Cell_To_Lepton(MapCellWidth) + GlyphXClientSidebarWidthInLeptons, Cell_To_Lepton(MapCellHeight)); // Needed to accomodate Glyphx client sidebar. ST - 4/12/2019 5:29PM
Confine_Rect(&xx, &yy, TacLeptonWidth, TacLeptonHeight, Cell_To_Lepton(MapCellWidth), Cell_To_Lepton(MapCellHeight));
coord = XY_Coord(xx + Cell_To_Lepton(MapCellX), yy + Cell_To_Lepton(MapCellY));
if (ScenarioInit) {
+7 -4
View File
@@ -120,6 +120,9 @@ class WWKeyboardClass
int Tail;
};
#define RA_SCANCODE_MASK (1<<30)
#define RA_SCANCODE_TO_KEYCODE(X) (X | RA_SCANCODE_MASK)
#define VK_NONE 0x00
#define VK_LBUTTON 0x01
#define VK_RBUTTON 0x02
@@ -157,10 +160,10 @@ class WWKeyboardClass
#define VK_NEXT 0x22
#define VK_END 0x23
#define VK_HOME 0x24
#define VK_LEFT 0x25
#define VK_UP 0x26
#define VK_RIGHT 0x27
#define VK_DOWN 0x28
#define VK_LEFT 80
#define VK_UP 82
#define VK_RIGHT 79
#define VK_DOWN 81
#define VK_SELECT 0x29
#define VK_PRINT 0x2A
#define VK_EXECUTE 0x2B
+6 -2
View File
@@ -228,6 +228,10 @@ char const * Map_Selection(void)
bool done = 0;
MouseType shape = MOUSE_NORMAL;
while (!done) {
KeyNumType _key;
int _flags = 0;
WWSDL_ProcessEvents(_key, _flags);
#ifdef WIN32
/*
** If we have just received input focus again after running in the background then
@@ -255,8 +259,8 @@ char const * Map_Selection(void)
timer = delay;
Set_Mouse_Cursor(xspot, yspot, Extract_Shape(MouseClass::MouseShapes, start + frame));
}
if (Keyboard->Check()) {
if ((Keyboard->Get() & 0x10FF) == KN_LMOUSE) {
if (_flags == KN_LMOUSE) {
{
if (choice != -1) {
done = 1;
selection = choice;