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

HYPNO: New engine for some Hypnotix games #3346

Open
wants to merge 69 commits into
base: master
Choose a base branch
from

Conversation

@neuromancer
Copy link
Contributor

@neuromancer neuromancer commented Sep 5, 2021

This PR implements an engine that allows to recreate some Hypnotix games,
which can be point-and-click ones or rail shooters (or both). In particular, this PR supports:

  • Wetlands demo (1995)

  • Marvel Comics Spider-Man: The Sinister Six demo (1996)

These demos are playable, with a few minor graphical issues here and
there. The engine will eventually support the full versions of this games, plus
"Soldier Boyz" (1997). Another game that could be support is
"Bruce Coville's My Teacher Is an Alien" (1997), but it is more difficult,
since the parser is very different from the other games.

neuromancer added 30 commits Sep 6, 2021
void HypnoEngine::runArcade(ArcadeShooting arc) {

_font = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
Common::Event event;
Copy link
Contributor

@mgerhardy mgerhardy Sep 12, 2021

Minor style thing: You could reduce the scope of these variables a little bit by moving them closer to the point where they are used.

Copy link
Contributor Author

@neuromancer neuromancer Sep 16, 2021

Which variable exactly? arc, _font or event?

Copy link
Member

@sev- sev- Sep 16, 2021

Obviously, _font and event.

}

int HypnoEngine::detectTarget(Common::Point mousePos) {
int i = -1;
Copy link
Contributor

@mgerhardy mgerhardy Sep 12, 2021

again minor style (here and in other methods): reducing the scope of the variables increases the readability imo (and would allow to make them const)

Copy link
Contributor Author

@neuromancer neuromancer Sep 16, 2021

Which variable exactly? i ?

Copy link
Member

@sev- sev- Sep 16, 2021

Most of them. Obviously, only i has to be defined before the for() loop. The rest could go right after continue

engines/hypno/boyz/boyz.cpp Outdated Show resolved Hide resolved
Copy link
Member

@sev- sev- left a comment

Got my round of reviews.

One thing that bothers me in the whole engine is frequent string comparisons. But perhaps the performance hit will be minimal.

_stream->seek(directoryTableOffset);
uint16 fileCount = _stream->readUint16LE();
debug(2, "File count = %d", fileCount);
for (int i = 0; i < directoryCount; i++) {
Copy link
Member

@sev- sev- Sep 16, 2021

directoryCount is uint, so make i too

Copy link
Contributor Author

@neuromancer neuromancer Sep 17, 2021

Fixed.

*
*/

#include <typeinfo>
Copy link
Member

@sev- sev- Sep 16, 2021

Why do you need this?

Copy link
Contributor Author

@neuromancer neuromancer Sep 17, 2021

This is needed for using typeid (it compiles fines here, but it will fail in the CI tests for some reason).

void HypnoEngine::runBackground(Background *a) {
if (a->condition.size() > 0 && !_sceneState[a->condition])
return;
Common::Point origin = a->origin;
Copy link
Member

@sev- sev- Sep 16, 2021

I would not create the object here. It would work more efficient to write just a->origin.x on the next line.

Copy link
Contributor Author

@neuromancer neuromancer Sep 17, 2021

Fixed

}

void HypnoEngine::runOverlay(Overlay *a) {
Common::Point origin = a->origin;
Copy link
Member

@sev- sev- Sep 16, 2021

Same here

Copy link
Contributor Author

@neuromancer neuromancer Sep 17, 2021

Fixed.

void HypnoEngine::runCutscene(Cutscene *a) {
stopSound();
disableCursor();
_music = "";
Copy link
Member

@sev- sev- Sep 16, 2021

_music.clear(); is much more effective.

Copy link
Contributor Author

@neuromancer neuromancer Sep 17, 2021

Fixed.

@@ -0,0 +1,92 @@
#include "hypno/grammar.h"
Copy link
Member

@sev- sev- Sep 16, 2021

Missing header

Copy link
Contributor Author

@neuromancer neuromancer Sep 17, 2021

Fixed

}
}

} // End of namespace Hypno
Copy link
Member

@sev- sev- Sep 16, 2021

Missing end line

Copy link
Contributor Author

@neuromancer neuromancer Sep 17, 2021

Fixed

@@ -0,0 +1,74 @@
#include "hypno/grammar.h"
Copy link
Member

@sev- sev- Sep 16, 2021

Missing header.

Copy link
Contributor Author

@neuromancer neuromancer Sep 17, 2021

Fixed

}
}

} // End of namespace Hypno
Copy link
Member

@sev- sev- Sep 16, 2021

Missing end line

Copy link
Contributor Author

@neuromancer neuromancer Sep 17, 2021

Fixed

debugC(1, kHypnoDebugParser, "Parsing %s", arclevel.c_str());
Common::SeekableReadStream *file = afiles[k]->createReadStream();
while (!file->eos()) {
x = file->readByte();
Copy link
Member

@sev- sev- Sep 16, 2021

byte x = file->readByte();

Copy link
Contributor Author

@neuromancer neuromancer Sep 17, 2021

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants