PiBoSo Official Forum

GP Bikes => Mods => Plugins => Topic started by: HornetMaX on April 26, 2016, 08:18:03 PM

Title: Bug in output plugin _iState (in Draw()) ?
Post by: HornetMaX 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):


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.
Title: Re: Bug in output plugin _iState (in Draw()) ?
Post by: PiBoSo 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.
Title: Re: Bug in output plugin _iState (in Draw()) ?
Post by: HornetMaX 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 ?
Title: Re: Bug in output plugin _iState (in Draw()) ?
Post by: PiBoSo on April 27, 2016, 09:56:58 AM
Quote from: HornetMaX 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 ?

If a replay is loaded then SPluginsRaceEvent_t -> m_iType sent to the "RaceEvent" function should be set to -1.
Title: Re: Bug in output plugin _iState (in Draw()) ?
Post by: HornetMaX on April 27, 2016, 12:13:57 PM
Quote from: PiBoSo on April 27, 2016, 09:56:58 AM
Quote from: HornetMaX 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 ?

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.
Title: Re: Bug in output plugin _iState (in Draw()) ?
Post by: PiBoSo on April 27, 2016, 01:02:37 PM
Quote from: HornetMaX on April 27, 2016, 12:13:57 PM
Quote from: PiBoSo on April 27, 2016, 09:56:58 AM
Quote from: HornetMaX 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 ?

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.
Title: Re: Bug in output plugin _iState (in Draw()) ?
Post by: HornetMaX on April 27, 2016, 01:27:25 PM
Quote from: PiBoSo on April 27, 2016, 01:02:37 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.
Title: Re: Bug in output plugin _iState (in Draw()) ?
Post by: PiBoSo on April 27, 2016, 01:29:32 PM
Quote from: HornetMaX on April 27, 2016, 01:27:25 PM
Quote from: PiBoSo on April 27, 2016, 01:02:37 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.
Title: Re: Bug in output plugin _iState (in Draw()) ?
Post by: HornetMaX on April 27, 2016, 01:33:28 PM
W00t!1
Title: Re: Bug in output plugin _iState (in Draw()) ?
Post by: HornetMaX on May 10, 2016, 11:37:20 AM
Quote from: PiBoSo on April 27, 2016, 01:02:37 PM
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.
Title: Re: Bug in output plugin _iState (in Draw()) ?
Post by: PiBoSo on May 10, 2016, 11:40:24 AM
Quote from: HornetMaX on May 10, 2016, 11:37:20 AM
Quote from: PiBoSo on April 27, 2016, 01:02:37 PM
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.
Title: Re: Bug in output plugin _iState (in Draw()) ?
Post by: HornetMaX on May 11, 2016, 10:45:51 AM
Thx !!