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)
@deepcode-ci-bot
Copy link

@deepcode-ci-bot deepcode-ci-bot bot 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);

This comment has been minimized.

@dreammaster

dreammaster Oct 16, 2020
Member

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);

This comment has been minimized.

@dreammaster

dreammaster Oct 16, 2020
Member

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

This comment has been minimized.

@mgerhardy

mgerhardy Oct 17, 2020
Author Contributor

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

engines/twine/debug.grid.h Outdated Show resolved Hide resolved
engines/twine/detection.h Outdated Show resolved Hide resolved
@mgerhardy mgerhardy force-pushed the mgerhardy:pr/twine branch from b8467b0 to 93062d4 Oct 17, 2020
Copy link
Member

@sev- sev- left a comment

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 {

This comment has been minimized.

@sev-

sev- Oct 17, 2020
Member

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

This comment has been minimized.

@ccawley2011

ccawley2011 Oct 22, 2020
Member

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 mgerhardy:pr/twine branch 2 times, most recently from 742d388 to 2b34f79 Oct 18, 2020
@mgerhardy
Copy link
Contributor Author

@mgerhardy mgerhardy commented Oct 19, 2020

@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 mgerhardy:pr/twine branch 3 times, most recently from 1184963 to 1324025 Oct 19, 2020
@mgerhardy
Copy link
Contributor Author

@mgerhardy mgerhardy commented Oct 20, 2020

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 mgerhardy:pr/twine branch 3 times, most recently from 69c3af5 to ac3e1ac Oct 20, 2020
@sev-
Copy link
Member

@sev- 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

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 force-pushed the mgerhardy:pr/twine branch from 06e7c40 to 769dea5 Oct 24, 2020
@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
mgerhardy added 2 commits Oct 14, 2020
also converted the code to the coding guidelines of the scummvm team
@mgerhardy mgerhardy force-pushed the mgerhardy:pr/twine branch from 5f52d54 to 0ad934a Oct 24, 2020
@sev-
Copy link
Member

@sev- 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
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
deepcode-ci-bot Well done, no issues found!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.