hunterz / hzmoria Goto Github PK
View Code? Open in Web Editor NEWMy cleanup fork of UMoria 5.6
License: GNU General Public License v3.0
My cleanup fork of UMoria 5.6
License: GNU General Public License v3.0
Working on a first cleanup pass of this file. It's huge!
Probably want to break it up or something.
Also, there are apparently some hacks/warts to look into:
compact_monsters()
has a note saying hack_monptr
is a "horrible hack" to support being called from deep within creatures()
place_win_monster()
simply calls abort()
if it can't do its job (basically an assert).
I prototyped sound support way back in the 1990s using a couple of WAV files extracted from Warcraft 1 or 2, and it was pretty fun.
Should revisit cross-platform sound support somehow... I think it would make the game more exciting to play, stream, etc.
One option would be just echoing in-game messages to a log file and having an external app monitor it - this is how Dwarf Fortress sound mods work.
A more sophisticated method would probably be to fire events to a separate thread that reacts by playing sounds.
The game keeps complaining about an incompatible scores file. Probably need to clean up the code around that. Maybe make it more aggressive about overwriting and/or institute backwards compatibility tolerance like it has for loading save files.
Also probably need to generate a new default scores file, or (better yet) make the game generate one on the fly when needed.
Curses libraries aren't a good path to a common user experience anymore, so port all the I/O code to BearLibTerminal.
II don't want to write a curses wrapper for BearLibTerminal, so this means replacing all of the curses calls. This is a good thing, because it will help eliminate more environment-specific code variations.
Curses, libtcod, or other frontend support can be (re)added later, but creating an I/O abstraction layer at this time would be overengineering things. Let's go to BearLibTerminal first, then see where that leaves us.
Looking at save.c
turned up a lot of notes:
externs.h
include order concern
save.c
file globals
file_ptr
and xor_byte
fixed. from_savefile
and start_time
need more thoughtwhile()
loop in save_char()
.
_save_char()
goes awrysave_char()
either
unlink()
seems problematicTried to clean up file management configuration a bit, but there's still a split between DOS and *nix that needs to be resolved.
Thoughts on how release files might ideally be handled for modern Windows/Mac/Linux ports:
hours
file should probably just go away, as it's probably a multi-user support feature for sysadminsscores
files should probably go in a user folder, except maybe in a portable install?MORIA.CNF
config file?MORIA.CNF
, .hlp
/news
/license/docs, etc. could probably go in the install directory, next to the game binary.MORIA.CNF
, .hlp
/news
files, etc. could maybe go the app bundle too?/usr/local/bin
or similar?MORIA.CNF
, .hlp
/news
/license/docs, etc. would probably go in /usr/share/hzmoria
and/or /usr/local/etc
?This sounds too complicated for an initial cut. Maybe just go with a portable install at first, and refactor to properly installable solutions later? Expecting the user to unpack to and run from a user folder containing all files is probably reasonable, but needs to be tested on all 3 OSes (especially Mac) for viability.
Player gender is an 8-bit value that is currently treated as a boolean. This is boring.
Looks like it only has the following effects:
Initial thought - add a nonbinary third option:
Another option would be to prompt the character for gender and winner title, but I'm not sure how to handle height/weight for this design.
Lots of strcpy()
going on... May be worth making a wrapper for strncpy()
that puts a null terminator at the end, and then calling that from everywhere - preferably using constants that control/document/standardize destination (and possibly source?) buffer sizes to the extent practical.
This may be somewhat OBE if/when going to C++, except that limits might still need to be imposed for screen/file I/O.
UMoria has a number of features that probably aren't relevant to HZMoria, which targets modern desktop computer environments. These should probably be removed to help keep the codebase as small and clean as possible:
The UMoria codebase is rather messy, with very few headers, source files mixing internal and external functions, code files named "miscXYZ.c" etc.
Should maybe consider breaking the codebase up into subdirectories, possibly even building those into separate static libraries that get linked together at the end. This might help get better code/design separation between various areas of functionality. Maybe have a main header and source file for each module, backed up by headers and/or source files that are internal to that module?
As for the "misc" stuff: See if there are any themes that it can be sorted into, because "misc" is incredibly nondescript, and encourages chaos.
There's a bunch of dead code in the codebase:
#ifdef
'd out stuffAlso need to get down to one common implementation that supports Windows, Mac, and Linux, with no/minimal macrobatics. This means leaning on BearLibTerminal for I/O as much as possible, and trying to stick to ANSI C as much as possible for everything else (file I/O etc.).
Some stuff in death.c that I need to remember to clean up:
flock()
for some reason, that doesn't get used by the MSDOS port. Try to make the POSIX one work, or just get rid of it? Does this fall under #5?display_scores()
prints ALL scores, 20 at a time. Consider just maintaining a top 20?Added support for a proper bool
type, but there's a lot of cleanup that should occur to take advantage of this:
bool
as appropriate.true
/false
(if anything) instead of numerical values.bool
types to/from save files, in order to avoid having to do a dance to ensure good data.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.