Secretchronicles / TSC

An open source two-dimensional platform game.
https://secretchronicles.org/
GNU General Public License v3.0
204 stars 50 forks source link

Ghost maryo issue #13

Closed Quintus closed 10 years ago

Quintus commented 11 years ago

See http://secretmaryo.org/phpBB3/viewtopic.php?f=22&t=7821 , patch by deved2:

*** savegame.cpp    2012-03-24 06:31:02.000000000 -0400
--- savegame_new.cpp    2012-04-25 07:25:39.000000000 -0400
*************** void cSave :: Init( void )
*** 177,182 ****
--- 177,186 ----
    m_player_type = 0;
    m_player_state = 0;
    m_itembox_item = 0;
+   if( m_maryo_type == MARYO_GHOST )
+   {
+       m_player_previous_state = 0;
+   }

    // level
    m_level_time = 0;
*************** bool cSavegame :: Save_Game( unsigned in
*** 493,498 ****
--- 497,506 ----
    savegame->m_lives = pLevel_Player->m_lives;
    savegame->m_points = pLevel_Player->m_points;
    savegame->m_player_type = pLevel_Player->m_maryo_type;
+   if( m_maryo_type == MARYO_GHOST )
+   {
+       savegame->m_player_previous_type = pLevel_Player->m_maryo_type_temp_power;
+   }
    savegame->m_player_state = pLevel_Player->m_state;
    savegame->m_itembox_item = pHud_Itembox->m_item_id;
datahead8888 commented 10 years ago

This task can potentially be worked in tandem with #147. Per Quintus, the patch DevEd applied may not just work now because the code has changed since he wrote it. We may also want to test whether invincibility saves and whether carrying an army shell saves for both of these issues. We might as well knock out a lof of associated issues at once if possible.

I'm going to play around with this a little and see what the patch does...

datahead8888 commented 10 years ago

I have coded a fix in PR #159.

Do not close this issue, however, because I found two new problems we will want to discuss:

datahead8888 commented 10 years ago

This is the minor music issue I've been mentioning. I really don't think we need to open another ticket given that it's associated with the bug we're already fixing in PR #159.

Steps to reproduce:

I have to make it play the correct invincibility music when I fix the star issue anyways, so maybe I can try to knock this other one out, too.

EDIT: It's also possible to produce this bug using title screen music. I think logic was outright missing to play the correct music when loading a save state. I've written a fix and added it to the PR.

datahead8888 commented 10 years ago

Invincibility time / state - now saved Fixed the music issue described above *Ghost maryo time remaining - now saved

I think I'll look at the climbing save issue from the other ticket next. That will give insight into saving shell holding.

While testing, I noticed that if you save a shell while holding it then load it, it always is kicked on a load. At the very least we'll want it to let you keep holding if you hold the respective button down. We will probably have to add a one second grace period before it it lets go, which will require a new counter. Our other option is just not to properly save the shell holding state, but this is a bit inconsistent with saving climbing (I think they may use the same variable).

datahead8888 commented 10 years ago

Those last 2 issues were awful...

datahead8888 commented 10 years ago

New bugs found:

We probably need to look into a better save/load strategy for games states long term - maybe we can utilize serialization or a better framework. We also need to make sure we run tests against it every now and then -- it's one of the easiest things to miss.

Quintus commented 10 years ago

Please open new tickets for new bugs. You know, for better overview and more easy incorporation in the changelogs.

god mode doesn't save (do we want it to?)

No. God mode is not meant to be used by the player at all during regular gameplay, it is a cheat.

Press state for switches does not save (tested this in the Desert Break level)

That’s related to how scripting is handled, thus not a bug, but expected behaviour. If you script anything, you are expected to hook into the Save and Load events on the Level object. Though I agree the Std::Switch SSL class could be enhanced to automatically do this, which should be possible -- but this is a feature request, not a bug.

Invisible blocks set to visible on a timer with a script did not save (tested this in the Desert Break Level)

Again, expected behaviour. Use the Save and Load events in the level script. We as the developers can’t foresee all the stuff users want to save, hence you can use those events.

Valete, Quintus

datahead8888 commented 10 years ago

Fixed in PR #159.