Jump to content
Sign in to follow this  

Option to not scroll the map with mouse over options button

Recommended Posts

How does this code work? It might be interesting to add to RA1 if it doesn't exist there already.

Share this post

Link to post

The scroll up code just has an exception that checks an area of XXX pixels at the left and right side of the screen, and aborts if you're on that and the option is enabled.


You can find the code in C&C95 at address 004A43D0. I got that identified as TabClass_AI.


The "mov ecx, 0A0h" command at 004A43E6 gives the width of the buttons. I had to change this for my patch since the original was still set on the width of the DOS buttons. The actual corner pixel isn't blocked, to allow scrolling diagonally. Only scrolling up is disabled.


I never looked into how it worked, though... all I did was fixing that button width and putting the option it checks into a new var.



Share this post

Link to post

Here's how TabClass::AI() looks like in RA1:



AUTO:005538D0 void TabClass::AI(KeyNumType &, int, int) proc near
AUTO:005538D0                                         ; CODE XREF: HelpClass::AI(KeyNumType &,int,int)+1A0p
AUTO:005538D0                                         ; DATA XREF: DGROUP:005FBA04o
AUTO:005538D0 var_10          = dword ptr -10h
AUTO:005538D0 var_C           = dword ptr -0Ch
AUTO:005538D0                 push    ebp
AUTO:005538D1                 mov     ebp, esp
AUTO:005538D3                 push    esi
AUTO:005538D4                 push    edi
AUTO:005538D5                 sub     esp, 8
AUTO:005538D8                 mov     esi, eax
AUTO:005538DA                 mov     [ebp+var_10], edx
AUTO:005538DD                 mov     [ebp+var_C], ebx
AUTO:005538E0                 test    ecx, ecx
AUTO:005538E2                 jl      short loc_553940
AUTO:005538E4                 cmp     ecx, 10h
AUTO:005538E7                 jge     short loc_553940
AUTO:005538E9                 mov     eax, ds:SomethingWidthRelated
AUTO:005538EE                 dec     eax
AUTO:005538EF                 cmp     eax, ebx
AUTO:005538F1                 jle     short loc_553940
AUTO:005538F3                 test    ebx, ebx
AUTO:005538F5                 jle     short loc_553940
AUTO:005538F7                 xor     eax, eax
AUTO:005538F9                 test    ecx, ecx
AUTO:005538FB                 jle     short loc_553902
AUTO:005538FD                 mov     eax, 1
AUTO:00553902 loc_553902:                             ; CODE XREF: TabClass::AI(KeyNumType &,int,int)+2Bj
AUTO:00553902                 test    eax, eax
AUTO:00553904                 jz      short loc_553940
AUTO:00553906                 mov     eax, [ebp+var_10]
AUTO:00553909                 cmp     word ptr [eax], 1
AUTO:0055390D                 jnz     short loc_553934
AUTO:0055390F                 mov     edi, [ebp+var_C]
AUTO:00553912                 mov     edx, 0FFFFFFFFh
AUTO:00553917                 cmp     edi, 0A0h
AUTO:0055391D                 jge     short loc_553921
AUTO:0055391F                 xor     edx, edx
AUTO:00553921 loc_553921:                             ; CODE XREF: TabClass::AI(KeyNumType &,int,int)+4Dj
AUTO:00553921                 test    edx, edx
AUTO:00553923                 jl      short loc_553934
AUTO:00553925                 mov     eax, esi
AUTO:00553927                 call    TabClass::Set_Active(int)
AUTO:0055392C                 mov     eax, [ebp+var_10]
AUTO:0055392F                 mov     word ptr [eax], 0
AUTO:00553934 loc_553934:                             ; CODE XREF: TabClass::AI(KeyNumType &,int,int)+3Dj
AUTO:00553934                                         ; TabClass::AI(KeyNumType &,int,int)+53j
AUTO:00553934                 mov     eax, esi
AUTO:00553936                 mov     edi, [esi+4]
AUTO:00553939                 xor     ebx, ebx
AUTO:0055393B                 xor     edx, edx
AUTO:0055393D                 call    dword ptr [edi+38h]
AUTO:00553940 loc_553940:                             ; CODE XREF: TabClass::AI(KeyNumType &,int,int)+12j
AUTO:00553940                                         ; TabClass::AI(KeyNumType &,int,int)+17j ...
AUTO:00553940                 lea     edx, [esi+1617h]
AUTO:00553946                 mov     ebx, [edx+1]
AUTO:00553949                 mov     eax, [edx+5]
AUTO:0055394C                 cmp     ebx, 0FFFFFFFFh
AUTO:0055394F                 jz      short loc_55396A
AUTO:00553951                 mov     ebx, ds:long Frame
AUTO:00553957                 mov     edi, [edx+1]
AUTO:0055395A                 mov     edx, ebx
AUTO:0055395C                 sub     edx, edi
AUTO:0055395E                 cmp     edx, eax
AUTO:00553960                 jnb     short loc_553966
AUTO:00553962                 sub     eax, edx
AUTO:00553964                 jmp     short loc_55396A
AUTO:00553966 ; ---------------------------------------------------------------------------
AUTO:00553966 loc_553966:                             ; CODE XREF: TabClass::AI(KeyNumType &,int,int)+90j
AUTO:00553966                 xor     edx, edx
AUTO:00553968                 jmp     short loc_55396C
AUTO:0055396A ; ---------------------------------------------------------------------------
AUTO:0055396A loc_55396A:                             ; CODE XREF: TabClass::AI(KeyNumType &,int,int)+7Fj
AUTO:0055396A                                         ; TabClass::AI(KeyNumType &,int,int)+94j
AUTO:0055396A                 mov     edx, eax
AUTO:0055396C loc_55396C:                             ; CODE XREF: TabClass::AI(KeyNumType &,int,int)+98j
AUTO:0055396C                 cmp     edx, 1
AUTO:0055396F                 jnz     short loc_55398A
AUTO:00553971                 mov     ah, [esi+1613h]
AUTO:00553977                 mov     ebx, [esi+4]
AUTO:0055397A                 or      ah, 1
AUTO:0055397D                 xor     edx, edx
AUTO:0055397F                 mov     [esi+1613h], ah
AUTO:00553985                 mov     eax, esi
AUTO:00553987                 call    dword ptr [ebx+24h]
AUTO:0055398A loc_55398A:                             ; CODE XREF: TabClass::AI(KeyNumType &,int,int)+9Fj
AUTO:0055398A                 lea     eax, [esi+15FAh]
AUTO:00553990                 xor     edx, edx
AUTO:00553992                 mov     ebx, [ebp+var_C]
AUTO:00553995                 call    CreditClass::AI(int)
AUTO:0055399A                 mov     edx, [ebp+var_10]
AUTO:0055399D                 mov     eax, esi
AUTO:0055399F                 call    SidebarClass::AI(KeyNumType &,int,int)
AUTO:005539A4                 lea     esp, [ebp-8]
AUTO:005539A7                 pop     edi
AUTO:005539A8                 pop     esi
AUTO:005539A9                 pop     ebp
AUTO:005539AA                 retn
AUTO:005539AA void TabClass::AI(KeyNumType &, int, int) endp



Wow the CODE tags on this weird forum software eats all the text typed AFTER the



Anyway, quick check at it shows there's a check for 0A0h already there, interesting cause the check is the same as in C&C95 but you had to patch the check to be 0A0h instead of the DOS button width..


Will check it in a debugger tomorrow. Even though EDWIN has code to read the SafeScrolling option, Red Alert doesn't. I assume it's a C&C95 leftover like the AutoScroll Dune 2 leftover and they did a copy and replace for the hard-coded numbers when doing the WIndows port of the game.

Edited by Iran

Share this post

Link to post

Okay after actually checking it in a debugger all the RA95 code is doing is activating the options menu if you click on the Options menu.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.