Author Topic: Bug in output plugin _iState (in Draw()) ?  (Read 2266 times)

HornetMaX

  • Hero Member
  • *****
  • Posts: 5944
    • View Profile
Bug in output plugin _iState (in Draw()) ?
« on: April 26, 2016, 08:18:03 PM »
I print out the value of _iState in each Draw() call,  whenever it changes from one call to the other. The documentation for _iState says:

Quote
_iState: 0 = on track; 1 = spectate; 2 = replay.

(except for KRP, which only mentions values 0 and 1 for on track and replay, strange).

I start GPB and start a testing session (offline):

  • When I go to track, state is 0 (OK to me).
  • If while on track I press ESC and click on "Replay", state is 2: seems wrong. Should it be 1 ?
  • If I go back to the pits and press ESC, state is 1 (OK to me).

Online the problem doesn't exist, as you can't press ESC and then click on replay (you have to go back to the pits).

If from GPB main menu I load a saved replay, state is 2 (which is OK).

Didn't check the other sims, I'm getting old and lazy.

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2658
    • View Profile
Re: Bug in output plugin _iState (in Draw()) ?
« Reply #1 on: April 26, 2016, 11:53:24 PM »

When going to replay from track during a testing session, the simulation is paused, so it's not possible to spectate.
The "Live" button is even hidden, so everything seems correct.
Obviously your ambition outweighs your talent

HornetMaX

  • Hero Member
  • *****
  • Posts: 5944
    • View Profile
Re: Bug in output plugin _iState (in Draw()) ?
« Reply #2 on: April 27, 2016, 06:24:04 AM »
OK I see, thanks.

I was kinda hoping to use _iState to tell the difference between a replay/live spectating while in an event from a saved and loaded replay, but I see I can't do that.

Any reason why in a loaded replay some events (e.g. EventInit, TrackCenterline, ...) are not called ?

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2658
    • View Profile
Re: Bug in output plugin _iState (in Draw()) ?
« Reply #3 on: April 27, 2016, 09:56:58 AM »
OK I see, thanks.

I was kinda hoping to use _iState to tell the difference between a replay/live spectating while in an event from a saved and loaded replay, but I see I can't do that.

Any reason why in a loaded replay some events (e.g. EventInit, TrackCenterline, ...) are not called ?

If a replay is loaded then SPluginsRaceEvent_t -> m_iType sent to the "RaceEvent" function should be set to -1.
Obviously your ambition outweighs your talent

HornetMaX

  • Hero Member
  • *****
  • Posts: 5944
    • View Profile
Re: Bug in output plugin _iState (in Draw()) ?
« Reply #4 on: April 27, 2016, 12:13:57 PM »
OK I see, thanks.

I was kinda hoping to use _iState to tell the difference between a replay/live spectating while in an event from a saved and loaded replay, but I see I can't do that.

Any reason why in a loaded replay some events (e.g. EventInit, TrackCenterline, ...) are not called ?

If a replay is loaded then SPluginsRaceEvent_t -> m_iType sent to the "RaceEvent" function should be set to -1.
Thanks, I may be able to work with that.

Still, it would allow to do more stuff if callabacks like EventInit, TrackCenterline etc were called during loaded replays, but no big deal.

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2658
    • View Profile
Re: Bug in output plugin _iState (in Draw()) ?
« Reply #5 on: April 27, 2016, 01:02:37 PM »
OK I see, thanks.

I was kinda hoping to use _iState to tell the difference between a replay/live spectating while in an event from a saved and loaded replay, but I see I can't do that.

Any reason why in a loaded replay some events (e.g. EventInit, TrackCenterline, ...) are not called ?

If a replay is loaded then SPluginsRaceEvent_t -> m_iType sent to the "RaceEvent" function should be set to -1.
Thanks, I may be able to work with that.

Still, it would allow to do more stuff if callabacks like EventInit, TrackCenterline etc were called during loaded replays, but no big deal.

TrackCenterline will be.
EventInit wouldn't make sense, because it is meant for telemetry only.
Obviously your ambition outweighs your talent

HornetMaX

  • Hero Member
  • *****
  • Posts: 5944
    • View Profile
Re: Bug in output plugin _iState (in Draw()) ?
« Reply #6 on: April 27, 2016, 01:27:25 PM »
TrackCenterline will be.
EventInit wouldn't make sense, because it is meant for telemetry only.

Cool, thanks. It would be nice if there was an*Init() and a *Deinit() event common to both loaded replays and live sessions.
I can use TrackCenterline  as Init() (once it is available in loaded replays too), but I may miss a *Deinit() event for cleanup, deallocation etc.

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2658
    • View Profile
Re: Bug in output plugin _iState (in Draw()) ?
« Reply #7 on: April 27, 2016, 01:29:32 PM »
TrackCenterline will be.
EventInit wouldn't make sense, because it is meant for telemetry only.

Cool, thanks. It would be nice if there was an*Init() and a *Deinit() event common to both loaded replays and live sessions.
I can use TrackCenterline  as Init() (once it is available in loaded replays too), but I may miss a *Deinit() event for cleanup, deallocation etc.

RaceDeinit support is coming, too.
Obviously your ambition outweighs your talent

HornetMaX

  • Hero Member
  • *****
  • Posts: 5944
    • View Profile
Re: Bug in output plugin _iState (in Draw()) ?
« Reply #8 on: April 27, 2016, 01:33:28 PM »
W00t!1

HornetMaX

  • Hero Member
  • *****
  • Posts: 5944
    • View Profile
Re: Bug in output plugin _iState (in Draw()) ?
« Reply #9 on: May 10, 2016, 11:37:20 AM »
EventInit wouldn't make sense, because it is meant for telemetry only.

One thing though: in SPluginsBikeEvent_t we have m_iNumberOfGears and m_fMaxRPM. These could be useful also when spectating.
As we can have vehicles with different m_fMaxRPM and m_iNumberOfGears in the same event, it is probably a good idea to add them to SPluginsRaceVehicleData_t.

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2658
    • View Profile
Re: Bug in output plugin _iState (in Draw()) ?
« Reply #10 on: May 10, 2016, 11:40:24 AM »
EventInit wouldn't make sense, because it is meant for telemetry only.

One thing though: in SPluginsBikeEvent_t we have m_iNumberOfGears and m_fMaxRPM. These could be useful also when spectating.
As we can have vehicles with different m_fMaxRPM and m_iNumberOfGears in the same event, it is probably a good idea to add them to SPluginsRaceVehicleData_t.

Gotcha.
Obviously your ambition outweighs your talent

HornetMaX

  • Hero Member
  • *****
  • Posts: 5944
    • View Profile
Re: Bug in output plugin _iState (in Draw()) ?
« Reply #11 on: May 11, 2016, 10:45:51 AM »
Thx !!