mirror of
https://github.com/jmarshall23/CnC_Remastered_Collection.git
synced 2026-08-12 08:00:55 +02:00
Improved Scrolling, Large Map Handling
- Bugfix in MapClass::Overpass when placing objects while scrolled all the way up / left on a larger map - Disabled a check in DisplayClass::Set_Cursor_Pos preventing mouse cell coordinates from being updated while scrolled all the way up / left on a larger map - Added (disabled) function to display mouse/cell position - Improved mouse scroll region (but still work to be done)
This commit is contained in:
+21
-17
@@ -105,7 +105,11 @@ void ScrollClass::AI(KeyNumType &input, int x, int y)
|
||||
bool noscroll = false;
|
||||
|
||||
if (!noscroll) {
|
||||
bool at_screen_edge = (y == 0 || x == 0 || x >= SeenBuff.Get_Width()-1 || y >= SeenBuff.Get_Height()-1);
|
||||
|
||||
int screen_width = SeenBuff.Get_Width();
|
||||
int screen_height = SeenBuff.Get_Height();
|
||||
|
||||
bool at_screen_edge = (y == 0 || x == 0 || x >= screen_width - 1 || y >= screen_height - 1);
|
||||
|
||||
/*
|
||||
** Verify that the mouse is over a scroll region.
|
||||
@@ -113,28 +117,28 @@ void ScrollClass::AI(KeyNumType &input, int x, int y)
|
||||
if (Inertia || at_screen_edge) {
|
||||
if (at_screen_edge) {
|
||||
|
||||
player_scrolled=true;
|
||||
player_scrolled = true;
|
||||
|
||||
int half_screen_width = screen_width / 2;
|
||||
int half_screen_height = screen_height / 2;
|
||||
|
||||
/*
|
||||
** Adjust the mouse coordinates to emphasize the
|
||||
** cardinal directions over the diagonals.
|
||||
*/
|
||||
int altx = x;
|
||||
if (altx < 50 * RESFACTOR) altx -= ((50 * RESFACTOR)-altx);
|
||||
int altx = y;
|
||||
if (altx < (50)) altx -= (50) - altx;
|
||||
altx = max(altx, 0);
|
||||
if (altx > ((320-50) * RESFACTOR)) altx += altx-((320-50) * RESFACTOR);
|
||||
altx = min(altx, (320 * RESFACTOR));
|
||||
if (altx > (50 * RESFACTOR) && altx < ((320-50) * RESFACTOR)) {
|
||||
altx += (((320/2) * RESFACTOR)-altx)/2;
|
||||
}
|
||||
if (altx > ((half_screen_width - 50))) altx += altx - ((half_screen_width - 50));
|
||||
altx = min(altx, screen_width);
|
||||
|
||||
int alty = y;
|
||||
if (alty < (50 * RESFACTOR)) alty -= (50 * RESFACTOR)-alty;
|
||||
if (alty < (50)) alty -= (50) - alty;
|
||||
alty = max(alty, 0);
|
||||
if (alty > (150 * RESFACTOR)) alty += alty-(150 * RESFACTOR);
|
||||
alty = min(alty, 200 * RESFACTOR);
|
||||
if (alty > ((half_screen_height - 50))) alty += alty - ((half_screen_height - 50));
|
||||
alty = min(alty, screen_height);
|
||||
|
||||
direction = (DirType)Desired_Facing256((320/2) * RESFACTOR, (200/2) * RESFACTOR, altx, alty);
|
||||
direction = (DirType)Desired_Facing256((half_screen_width), (half_screen_height), x, y);
|
||||
}
|
||||
|
||||
int control = Dir_Facing(direction);
|
||||
@@ -168,9 +172,9 @@ void ScrollClass::AI(KeyNumType &input, int x, int y)
|
||||
/*
|
||||
** Increase the scroll rate if the mouse button is held down.
|
||||
*/
|
||||
// if (Keyboard->Down(KN_LMOUSE)) {
|
||||
// rate = Bound(rate-3, 0, 4);
|
||||
// }
|
||||
// if (Keyboard->Down(KN_LMOUSE)) {
|
||||
// rate = Bound(rate-3, 0, 4);
|
||||
// }
|
||||
if (Keyboard->Down(KN_RMOUSE)) {
|
||||
rate = Bound(rate+1, 4, (int)(sizeof(_rate)/sizeof(_rate[0]))-1);
|
||||
}
|
||||
@@ -180,7 +184,7 @@ void ScrollClass::AI(KeyNumType &input, int x, int y)
|
||||
** one of the 8 facings, then adjust the direction value
|
||||
** accordingly.
|
||||
*/
|
||||
direction = Facing_Dir(Dir_Facing(direction));
|
||||
direction = Facing_Dir(Dir_Facing(direction)) - (1<<5);
|
||||
|
||||
int distance = _rate[rate]/2;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user