Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TWINE: new engine for Little Big Adventure 1 #2532

Merged
merged 85 commits into from Oct 24, 2020
Merged

Conversation

mgerhardy
Copy link
Contributor

@mgerhardy mgerhardy commented Oct 16, 2020

Ported Little Big Adventure twin-e which is no longer under active development (since 2015 afaik) to ScummVM.

The engine is still work-in-progress but I though that sharing it already might make sense to get feedback.

Midi Sound and music is ported. Input is using the KeyMapper. Rendering is using Graphics::ManagedSurface.

TODO

  • Refactor the input code - struct Keyboard - replace all those magic numbers and bitmask checks with proper constants
  • Fix the menu handling
  • Port the Audio-CD code
  • Replace memset with Common::fill
  • Support autosaving and loading/saving via ui
  • Fix blitting (alpha issues for e.g. the character- TwinEEngine::copyBlockPhys)

@ghost
Copy link

ghost commented Oct 16, 2020

Congratulations 🎉. DeepCode analyzed your code in 0.972 seconds and we found no issues. Enjoy a moment of no bugs ☀️.

👉 View analysis in DeepCode’s Dashboard | Configure the bot

.clang-tidy Outdated Show resolved Hide resolved
engines/twine/actor.cpp Outdated Show resolved Hide resolved
engines/twine/actor.cpp Outdated Show resolved Hide resolved
actor->standOn = -1;
actor->zone = -1;

memset(&actor->staticFlags, 0, 2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's recommended that engines use Common::fill rather than memset directly

engines/twine/actor.cpp Outdated Show resolved Hide resolved
engines/twine/animations.h Outdated Show resolved Hide resolved
fpsCycles(25); // rest

count++;
} while (!quit);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from maybe clarifying quit to be a bool rather than an int, something you'll need to do is hunt down every place where you have a loop like this and ensure that you break out of the loop if a call to the engine's shouldQuit() method returns true. Otherwise, the game will be prevented from exiting if the user tries to close the ScummVM window when execution is within the loop

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True - but I think that I would rather like to convert these ui debug actions to console commands.

engines/twine/debug.grid.cpp Outdated Show resolved Hide resolved
engines/twine/debug.grid.h Outdated Show resolved Hide resolved
engines/twine/detection.cpp Outdated Show resolved Hide resolved
engines/twine/detection.h Outdated Show resolved Hide resolved
Copy link
Member

@sev- sev- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good progress. If you need help or guidance with moving away from filereader.cpp to our Common::Stream code, or what to do with sdlengine.cpp, just say so.

engines/access/events.cpp Outdated Show resolved Hide resolved
engines/twine/actor.h Outdated Show resolved Hide resolved
engines/twine/animations.cpp Outdated Show resolved Hide resolved
engines/twine/fcaseopen.cpp Outdated Show resolved Hide resolved
engines/twine/fcaseopen.cpp Outdated Show resolved Hide resolved
engines/twine/redraw.cpp Outdated Show resolved Hide resolved
engines/twine/shadeangletab.h Show resolved Hide resolved
engines/twine/sound.cpp Show resolved Hide resolved
engines/twine/twine.cpp Outdated Show resolved Hide resolved
*
* Adapted from the ScummVM project
*/
struct EventInfo {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check, how well our audio/midiparser_xmidi.cpp is suitable for you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition, it looks like the game is using Miles, so you may want to take advantage of the Miles MIDI driver in audio/miles.h as well.

@mgerhardy mgerhardy force-pushed the pr/twine branch 2 times, most recently from 742d388 to 2b34f79 Compare October 19, 2020 09:57
@mgerhardy
Copy link
Contributor Author

@sev- I would like to convert the TwinEEngine::readKeys method to use the KeyMapper from the start. But right now I don't have a clue on how to convert all these SDL_PollEvent calls to the KeyMapper actions. Is that the way to go? Or should I try to use g_system->getEventManager()->pollEvent(event) as a replacement for now?

@mgerhardy mgerhardy force-pushed the pr/twine branch 3 times, most recently from 1184963 to 1324025 Compare October 20, 2020 08:37
@mgerhardy
Copy link
Contributor Author

Palette handling is still broken.

Bildschirmfoto von 2020-10-20 13-13-03

I could need some help here.

void TwinEEngine::setPalette(uint8 *palette) {
    g_system->getPaletteManager()->setPalette(palette, 0, 256);
    flip();
}

void TwinEEngine::flip() {
    g_system->copyRectToScreen(frontVideoBuffer, SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
    g_system->updateScreen();
}

@mgerhardy mgerhardy force-pushed the pr/twine branch 3 times, most recently from 69c3af5 to ac3e1ac Compare October 20, 2020 18:59
@sev-
Copy link
Member

sev- commented Oct 20, 2020

Keymapper consists of 2 parts: registering keys and assigning them custom ids. Then use normal pollEvent() and process those ids.

You may find the documentation here: https://wiki.scummvm.org/index.php?title=Keymapper

Copy link
Member

@sev- sev- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked for the second time till file menu.h

engines/twine/actor.h Outdated Show resolved Hide resolved
engines/twine/detection.h Outdated Show resolved Hide resolved
@mgerhardy mgerhardy changed the title WIP: TWINE: new engine for Little Big Adventure 1 TWINE: new engine for Little Big Adventure 1 Oct 24, 2020
also converted the code to the coding guidelines of the scummvm team
@sev-
Copy link
Member

sev- commented Oct 24, 2020

As discussed, merging this, so the work could continue in-tree.

@sev- sev- merged commit 4e4681f into scummvm:master Oct 24, 2020
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants