Author Topic: Color changing of the needle  (Read 361 times)

Ryoma

  • Helen`s Lover
  • **
  • Posts: 696
    • View Profile
    • My méga
Color changing of the needle
« on: August 22, 2021, 06:46:18 PM »
While working on the Delta, I made a mistake with inm1 and succeed to change color of needle.

I try again with the Musa and it works only when turning wheel.

See enclosed pictures.
Disappointed having unfairly lost the newbies race zct238.

Daniel3D

  • Skid`s Nightmare
  • **
  • Posts: 789
    • View Profile
Re: Color changing of the needle
« Reply #1 on: August 22, 2021, 07:23:41 PM »
I think that is because that mask is only active when the wheel is turned.
Ever tried, ever failed. Try again, fail better.

Currently running 19 separate instances of Stunts or 4D Sports Driving.
---------
Stunts resources.
https://mega.nz/folder/JM8HQI5a#mH5ZBNwXC0eEBmockWo50A

Ryoma

  • Helen`s Lover
  • **
  • Posts: 696
    • View Profile
    • My méga
Re: Color changing of the needle
« Reply #2 on: August 22, 2021, 07:57:13 PM »
Yes in order to priority of display : insX and inmX and after dasX. And inm2 does not exist anymore.

So this solution is not the way to go. I made a lot of tests.
Disappointed having unfairly lost the newbies race zct238.

Daniel3D

  • Skid`s Nightmare
  • **
  • Posts: 789
    • View Profile
Re: Color changing of the needle
« Reply #3 on: August 22, 2021, 08:45:53 PM »
O don't think that changing the color of the needle is possible.
The car files contain the graphics and the needle position.
But no information about the animation of the needle.
Therefore, I think that the needle is drawn by the main game engine.
That is where the color is given. If the color can be changed, then it will be for all cars.
Ever tried, ever failed. Try again, fail better.

Currently running 19 separate instances of Stunts or 4D Sports Driving.
---------
Stunts resources.
https://mega.nz/folder/JM8HQI5a#mH5ZBNwXC0eEBmockWo50A

Ryoma

  • Helen`s Lover
  • **
  • Posts: 696
    • View Profile
    • My méga
Re: Color changing of the needle
« Reply #4 on: August 22, 2021, 09:38:41 PM »
Red for all cars will be cool!!!!
Disappointed having unfairly lost the newbies race zct238.

Daniel3D

  • Skid`s Nightmare
  • **
  • Posts: 789
    • View Profile
Re: Color changing of the needle
« Reply #5 on: August 22, 2021, 09:57:02 PM »
I had a quick look in the source and found this.

https://bitbucket.org/dreadnaut/restunts/src/master/src/restunts/asm/seg005.asm#lines-2710

meter_needle_color

Code: [Select]
loc_23456:
    cmp     [bp+var_6], 0
    jnz     short loc_23485
    mov     ax, si
    shl     ax, 1
    mov     [bp+var_20], ax
    push    meter_needle_color
    mov     bx, ax
    mov     al, (simd_player.spdpoints+1)[bx]
    sub     ah, ah
    push    ax
    mov     al, simd_player.spdpoints[bx]
    push    ax
    push    simd_player.spdcenter.y2
    push    simd_player.spdcenter.x2
    call    preRender_line
    add     sp, 0Ah
loc_23485:
    mov     ax, di
    shl     ax, 1
    mov     [bp+var_20], ax
    push    meter_needle_color
    mov     bx, ax
    mov     al, (simd_player.revpoints+1)[bx]
    sub     ah, ah
    push    ax
    mov     al, simd_player.revpoints[bx]
    push    ax
    push    simd_player.revcenter.y2
    push    simd_player.revcenter.x2
    call    preRender_line
    add     sp, 0Ah
    mov     al, [bp+var_2]
    cbw
    or      ax, ax
    jz      short loc_234BE
    cmp     ax, 2           ; st. whl. position flag
    jz      short loc_234EC
    jmp     short loc_234DE
    ; align 2
    db 144

After tracing the meter_needle_color back it is loaded without value, it seems to be tied to the font color.
« Last Edit: August 22, 2021, 11:33:34 PM by Daniel3D »
Ever tried, ever failed. Try again, fail better.

Currently running 19 separate instances of Stunts or 4D Sports Driving.
---------
Stunts resources.
https://mega.nz/folder/JM8HQI5a#mH5ZBNwXC0eEBmockWo50A

Cas

  • Straight Specialist
  • ***
  • Posts: 1100
  • Think different. That's OK... as long as you think
    • View Profile
    • Dimioca Labs
Re: Color changing of the needle
« Reply #6 on: August 23, 2021, 12:55:34 AM »
Tweaking the code a little bit, it could be possible to get this value loaded from a byte in "simd" instead of that variable. This would make the needle colour configurable. Just loading it this way maybe can be done without changing the opcode length, but there are a few catches.

I think the best candidate in "simd" for this is the byte right after the number of gears. That is, the number of gears is being stored as a word, but only the lower byte is interpreted, so the high byte is normally zero, but if you change it, it has no effect. Of course, 0 is black, so doing this would make the needle of all previously created cars to be black. With some additional code, this byte could be, for example, XORed against 0Fh or ADDed 0Fh to, in order to make white the default.

I'll be researching on that, although I have a ton of other things to do and not much time.
Earth is my country. Science is my religion.