Archived
1
0

Muppet Hunter 0.0.1 Commit

This commit is contained in:
2021-10-09 16:05:43 -05:00
commit 6ae83ea5d8
12 changed files with 1327 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
# Muppet Hunt
A silly game inspired by [Hunt The Wumpus](https://en.wikipedia.org/wiki/Hunt_the_Wumpus), but more... interesting!
## Gameplay Mechanics
* The cave system is a [dodecahedron](https://en.wikipedia.org/wiki/File:Hunt_the_Wumpus_map.svg) as in Hunt The Wumpus.
* Every 3 turns, The Muppet randomly moves to a cave nearby.
* You have a 50% chance of dying when you encounter The Muppet.
* Every move depletes 1 supply out of the starting 20 supplies.
* You can camp and consume 1 supply rather than shooting or moving.
* There is 2 Maltego and 2 Ankle Bitter hazards.
* The Maltego hazard randomly teleports the player to a location that doesn't have a Muppet. It is possible to be teleported to another Maltego hazard...
* The Ankle Bitter hazard steals between 1 to 5 of your supplies.
* The Muppet is immune to hazards.
## Build Info
This is fully coded and compiled using [Open Watcom 1.9 C++ Compiler](www.openwatcom.org/). Output build is a 16-bit MSDOS COM Executable. Game is designed to be run on [DosBox](https://dosbox.com) or any DOS compatible setup. I used [DosBox-X](https://dosbox-x.com) for development and highly recommend it.
## TODO
* Add Neural Network to The Muppet so it actively hunts and learns from player.
* DosBox Launcher
## License
Copyright (C) 2021 William Welna (wwelna@occultusterra.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+180
View File
@@ -0,0 +1,180 @@
/* Copyright (C) 2021 William Welna (wwelna@occultusterra.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "headers.hpp"
#include "font8x8_basic.h"
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 200
#define GLYPH_SIZE 8
#define TERM_WIDTH 40
#define TERM_HEIGHT 25
#define VGA256 0x13
#define TEXT_MODE 0x03
/*
inline void put_pixel(int x, int y, unsigned char color) { // Not used anymore :'(
VGA[((y<<8)+(y<<6))+x] = color;
} */
VGA256Term::VGA256Term() {
this->video_buffer = (unsigned char far *)0xA0000000L;
this->term_x = 0;
this->term_y = 0;
this->Set_Video_Mode(VGA256);
this->clear_screen(15); // 15 = White
// Make sure this stuff is clear
memset(this->term_buff, 0, TERM_WIDTH*TERM_HEIGHT);
memset(this->term_buff2, 0, TERM_WIDTH*TERM_HEIGHT);
}
void VGA256Term::print_char(char c, int x1, int y1, char color, char bgcolor) {
int x,y;
char *glyph;
if(c == 0) glyph = (char *)font8x8_basic[0];
else glyph = (char *)font8x8_basic[c-32];
for(y=0; y < GLYPH_SIZE; ++y)
for(x=0; x < GLYPH_SIZE; ++x)
if(glyph[y] & (1 << x))
this->video_buffer[(((y1+y)<<8)+((y1+y)<<6))+(x1+x)] = color;
else
this->video_buffer[(((y1+y)<<8)+((y1+y)<<6))+(x1+x)] = bgcolor;
}
void VGA256Term::draw_term() {
int x,y;
for(y=0; y < TERM_HEIGHT; ++y)
for(x=0; x < TERM_WIDTH; ++x)
if(term_buff2[x][y] != term_buff[x][y])
this->print_char(term_buff[x][y], x*GLYPH_SIZE, y*GLYPH_SIZE, 0, 15); // 0 = Black, 15 = White
memcpy(term_buff2, term_buff, TERM_WIDTH*TERM_HEIGHT);
}
void VGA256Term::term_newline() {
unsigned int x, y;
if(term_y >= TERM_HEIGHT-1) {
for(y=1; y < TERM_HEIGHT; ++y)
for(x=0; x < TERM_WIDTH; ++x) // Move everything up by 1, erasing the first line
term_buff[x][y-1] = term_buff[x][y];
for(x=0; x < TERM_WIDTH; ++x) // clear last line
term_buff[x][TERM_HEIGHT-1] = 0;
term_y = TERM_HEIGHT-1;
} else term_y += 1;
term_x = 0; // Back to start
}
void VGA256Term::move_cursor_offset(unsigned int x, unsigned int y) {
if( (term_x + x) < TERM_WIDTH && (term_y + y) < TERM_HEIGHT) {
term_x += x;
term_y += y;
}
}
void VGA256Term::printf_term(char *s, ...) {
char buffer[8]; // Shouldn't have a number longer than 7 digits...
unsigned int x=0;
unsigned int arg_stack_count=0;
unsigned int arg_int;
va_list ap;
while(*(s+x) != 0) {
if(*(s+x) == '%') arg_stack_count += 1;
++x;
}
va_start(ap, s);
for(x=0; *(s+x) != 0; ++x) {
if(*(s+x) == '\n')
this->term_newline();
else if(*(s+x) == '\t')
this->move_cursor_offset(3, 0); // 3 space tabs
else if(*(s+x) == '%') { // Print decimal
arg_int = va_arg(ap, int);
memset(buffer, 0, 8);
itoa(arg_int, buffer, 10);
this->printf_term(buffer); // recursive call to print string sequence
} else if(term_x < TERM_WIDTH && term_y < TERM_HEIGHT) { // Within bounds
term_buff[term_x][term_y] = *(s+x);
term_x += 1;
} else if(term_x > TERM_WIDTH) { // do screen wrap
this->term_newline();
term_buff[term_x][term_y] = *(s+x);
term_x += 1;
}
}
va_end(ap);
this->draw_term();
}
void VGA256Term::printchar_term(char c) {
if(term_x < TERM_WIDTH && term_y < TERM_HEIGHT) {
term_buff[term_x][term_y] = c;
term_x += 1;
} else if (term_x > TERM_WIDTH) { // screen wrap
this->term_newline();
term_buff[term_x][term_y] = c;
term_x += 1;
}
}
int VGA256Term::get_int() {
char c;
int ret=0;
while ((c=getch()) != '\r')
if(c < 58 && c > 47) {
ret = ((ret << 3) + (ret << 1)) + (c-48);
this->printchar_term(c); this->draw_term();
}
this->term_newline();
return ret;
}
void VGA256Term::clear_screen(unsigned char color) {
_fmemset(this->video_buffer, color, SCREEN_WIDTH*SCREEN_HEIGHT);
}
void VGA256Term::Set_Video_Mode(int mode) {
union REGS inregs, outregs;
inregs.h.ah = 0;
inregs.h.al = (unsigned char)mode;
int86(0x10, &inregs, &outregs);
}
void VGA256Term::set_color(int index, int red, int green, int blue) {
outp(0x03c8, index);
outp(0x03c9, red);
outp(0x03c9, green);
outp(0x03c9, blue);
}
/*
inline int sgn(int x) {
return (x < 0) ? -1 : (x > 0);
} */
VGA256Term::~VGA256Term() {
this->Set_Video_Mode(TEXT_MODE);
}
+158
View File
@@ -0,0 +1,158 @@
#ifndef FONTS
// https://github.com/dhepper/font8x8/blob/master/font8x8_basic.h
/**
* 8x8 monochrome bitmap fonts for rendering
* Author: Daniel Hepper <daniel@hepper.net>
*
* License: Public Domain
*
* Based on:
* // Summary: font8x8.h
* // 8x8 monochrome bitmap fonts for rendering
* //
* // Author:
* // Marcel Sondaar
* // International Business Machines (public domain VGA fonts)
* //
* // License:
* // Public Domain
*
* Fetched from: http://dimensionalrift.homelinux.net/combuster/mos3/?p=viewsource&file=/modules/gfx/font8_8.asm
**/
// Constant: font8x8_basic
// Contains an 8x8 font map for unicode points U+0000 - U+007F (basic latin)
char font8x8_basic[96][8] = { // Changed 128-32 is 96
/* { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul)
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F */
// We do not need and can save 32 bytes by skipping the above, and just sub 32
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space)
{ 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!)
{ 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (")
{ 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#)
{ 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($)
{ 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%)
{ 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&)
{ 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (')
{ 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (()
{ 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ())
{ 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*)
{ 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+)
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,)
{ 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-)
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.)
{ 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/)
{ 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0)
{ 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1)
{ 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2)
{ 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3)
{ 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4)
{ 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5)
{ 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6)
{ 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7)
{ 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8)
{ 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9)
{ 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:)
{ 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (;)
{ 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<)
{ 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=)
{ 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>)
{ 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?)
{ 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@)
{ 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A)
{ 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B)
{ 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C)
{ 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D)
{ 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E)
{ 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F)
{ 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G)
{ 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H)
{ 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I)
{ 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J)
{ 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K)
{ 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L)
{ 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M)
{ 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N)
{ 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O)
{ 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P)
{ 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q)
{ 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R)
{ 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S)
{ 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T)
{ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U)
{ 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V)
{ 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W)
{ 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X)
{ 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y)
{ 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z)
{ 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([)
{ 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\)
{ 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (])
{ 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^)
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_)
{ 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`)
{ 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a)
{ 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b)
{ 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c)
{ 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d)
{ 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e)
{ 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f)
{ 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g)
{ 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h)
{ 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i)
{ 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j)
{ 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k)
{ 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l)
{ 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m)
{ 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n)
{ 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o)
{ 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p)
{ 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q)
{ 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r)
{ 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s)
{ 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t)
{ 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u)
{ 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v)
{ 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w)
{ 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x)
{ 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y)
{ 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z)
{ 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({)
{ 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|)
{ 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (})
{ 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~)
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F
};
#endif
+87
View File
@@ -0,0 +1,87 @@
#ifndef MAUH_HEADERS
#define MAUH_HEADERS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <I86.h>
#include <dos.h>
#include <conio.h>
#include <malloc.h>
#include <time.h>
#include <stdarg.h>
//#define DEBUG
class Room {
public:
int ID;
Room *rooms[3];
bool hasAnkleBitters;
bool hasMaltego;
Room(int id);
void setRooms(Room *r1, Room *r2, Room *r3);
~Room();
#ifdef DEBUG
void debug();
#endif
};
class Player {
public:
Room *location;
int arrows;
bool hasDied;
int supplies;
Player(Room *location);
~Player();
void doActions();
#ifdef DEBUG
void debug();
#endif
};
class Muppet {
public:
Room *location;
bool hasDied;
int moveCounter;
Muppet(Room *location);
void doActions();
void runAway();
~Muppet();
#ifdef DEBUG
void debug();
#endif
};
class VGA256Term {
public:
VGA256Term();
void draw_term();
void clear_screen(unsigned char color);
void printf_term(char *s, ...);
void printchar_term(char c);
void move_cursor_offset(unsigned int x, unsigned int y);
int get_int();
~VGA256Term();
private:
unsigned char far *video_buffer;
char term_buff[40][25];
char term_buff2[40][25];
int term_x, term_y;
void Set_Video_Mode(int mode);
void print_char(char c, int x1, int y1, char color, char bgcolor);
void set_color(int index, int red, int green, int blue);
void term_newline();
};
#endif
+50
View File
@@ -0,0 +1,50 @@
/* Copyright (C) 2021 William Welna (wwelna@occultusterra.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "headers.hpp"
Muppet::Muppet(Room *location) {
this->location = location;
this->moveCounter = 0;
this->hasDied = false;
}
void Muppet::doActions() {
if(this->moveCounter == 3) {
this->runAway();
this->moveCounter = 0;
}
this->moveCounter++;
}
void Muppet::runAway() {
int randRoom = (rand()%3);
this->location = this->location->rooms[randRoom];
}
Muppet::~Muppet() {
}
#ifdef DEBUG
void Muppet::debug() {
printf("Muppet Location #%d moveCounter %d hasDied %d\n", this->location->ID, this->moveCounter, this->hasDied);
}
#endif
+193
View File
@@ -0,0 +1,193 @@
/* Copyright (C) 2021 William Welna (wwelna@occultusterra.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "headers.hpp"
inline int getRandomRoom() {
int randint = (rand()%20);
if(randint == 0 || randint == 4 || randint == 1 || randint == 7) randint += 11;
return randint;
}
bool startGame(VGA256Term *Term) {
Room *rooms[20];
int x;
int randint;
char c;
for(x=0; x < 20; ++x)
rooms[x] = new Room(x+1);
// Ring 1
rooms[0]->setRooms(rooms[4], rooms[1], rooms[7]);
rooms[1]->setRooms(rooms[0], rooms[2], rooms[9]);
rooms[2]->setRooms(rooms[1], rooms[3], rooms[11]);
rooms[3]->setRooms(rooms[4], rooms[3], rooms[13]);
rooms[4]->setRooms(rooms[0], rooms[3], rooms[5]);
// Ring 2
rooms[5]->setRooms(rooms[4], rooms[6], rooms[14]);
rooms[6]->setRooms(rooms[5], rooms[7], rooms[16]);
rooms[7]->setRooms(rooms[6], rooms[0], rooms[7]);
rooms[8]->setRooms(rooms[7], rooms[16], rooms[18]);
rooms[9]->setRooms(rooms[8], rooms[1], rooms[10]);
rooms[10]->setRooms(rooms[9], rooms[18], rooms[11]);
rooms[11]->setRooms(rooms[10], rooms[2], rooms[12]);
rooms[12]->setRooms(rooms[11], rooms[19], rooms[13]);
rooms[13]->setRooms(rooms[12], rooms[3], rooms[14]);
rooms[14]->setRooms(rooms[13], rooms[15], rooms[5]);
// Ring 3
rooms[15]->setRooms(rooms[14], rooms[19], rooms[16]);
rooms[16]->setRooms(rooms[15], rooms[6], rooms[17]);
rooms[17]->setRooms(rooms[16], rooms[8], rooms[18]);
rooms[18]->setRooms(rooms[17], rooms[10], rooms[19]);
rooms[19]->setRooms(rooms[15], rooms[12], rooms[18]);
Muppet *Cody = new Muppet(rooms[getRandomRoom()]);
// Add Ankle Bitters
x=2;
while(x > 0) {
randint = getRandomRoom();
if(!rooms[randint]->hasAnkleBitters && !rooms[randint]->hasMaltego) {
rooms[randint]->hasAnkleBitters = true;
x -= 1;
}
}
// Add Maltego
x=2;
while(x > 0) {
randint = getRandomRoom();
if(!rooms[randint]->hasAnkleBitters && !rooms[randint]->hasMaltego) {
rooms[randint]->hasMaltego = true;
x -= 1;
}
}
Player *Neal = new Player(rooms[0]);
while(Neal->hasDied == false && Cody->hasDied == false) {
Term->printf_term("\nYou are in Cave #%\n\t% Arrows and % Supplies.\n\tTunnels lead to [%, %, %]\n", Neal->location->ID, Neal->arrows, Neal->supplies, Neal->location->rooms[0]->ID, Neal->location->rooms[1]->ID, Neal->location->rooms[2]->ID);
if( (Cody->location->ID == Neal->location->rooms[0]->ID) || (Cody->location->ID == Neal->location->rooms[1]->ID) || (Cody->location->ID == Neal->location->rooms[2]->ID) )
Term->printf_term("You hear the Squeal of a Muppet!\n");
if(Neal->location->rooms[0]->hasMaltego || Neal->location->rooms[1]->hasMaltego || Neal->location->rooms[2]->hasMaltego)
Term->printf_term("You are blinded by rainbow orbs!\n");
if(Neal->location->rooms[0]->hasAnkleBitters || Neal->location->rooms[1]->hasAnkleBitters || Neal->location->rooms[2]->hasAnkleBitters)
Term->printf_term("You clutch your supplies nervously...\n");
Term->printf_term("[M]ove [W]ait [S]hoot?\n");
top: c = getch();
switch(c) {
case 'm':
case 'M':
invalid1: Term->printf_term("Where to? :> "); x = Term->get_int();
if(Neal->location->rooms[0]->ID == x || Neal->location->rooms[1]->ID == x || Neal->location->rooms[2]->ID == x)
Neal->location = rooms[x-1];
else {
Term->printf_term("Invalid Room ID\n");
goto invalid1;
}
break;
case 's':
case 'S':
invalid2: Term->printf_term("Fire arrow to? :> "); x = Term->get_int();
if(Neal->location->rooms[0]->ID == x || Neal->location->rooms[1]->ID == x || Neal->location->rooms[2]->ID == x)
if(Cody->location->ID == x) {
Term->printf_term("You hear a squeal!\n");
Cody->hasDied = true;
} else
Term->printf_term("You hear a ting...\n");
else {
Term->printf_term("Invalid Room ID\n");
goto invalid2;
}
break;
case 'w':
case 'W':
Term->printf_term("Camping for one turn...\n");
break;
default:
goto top;
}
if(Neal->location->ID == Cody->location->ID) {
if(rand()%2) {
Term->printf_term("The Muppet runs away sqealing!\n");
Cody->runAway();
} else {
Term->printf_term("The Muppet attacks!\n");
Neal->hasDied = true;
}
}
if(Neal->hasDied == false) {
if(Neal->location->hasAnkleBitters == true) {
Term->printf_term("Ankle Bitters have stolen from you!\n");
Neal->supplies -= (rand()%4)+1; // 1-5 supplies get stolen
} else if(Neal->location->hasMaltego == true) {
Term->printf_term("You stare at Maltego and get disoriented...\n");
randagain: randint = rand()%20;
if(Cody->location->ID != rooms[randint]->ID)
Neal->location = rooms[randint];
else goto randagain;
}
}
if(Cody->hasDied == false) Cody->doActions();
Neal->doActions();
}
if(Neal->hasDied == true) Term->printf_term("And... You have died...\n");
else if(Cody->hasDied == true) {
Term->printf_term("You've slain the Muppet!\n");
}
Term->printf_term("Play Another Game? [Y]es or any key to exit\n");
c = getch();
if(c == 'y' || c == 'Y') return true;
else return false;
}
void print_center(VGA256Term *Term, char *s) {
int len = strlen(s);
int offset = (40-len)/2;
Term->move_cursor_offset(offset, 0);
Term->printf_term(s);
}
int main(int argc, unsigned char **argv) {
VGA256Term *Term = new VGA256Term();
time_t t;
srand((unsigned)time(&t));
print_center(Term, "In The Caves, You Must Survive...\n");
print_center(Term, "The Angry Muppets!\n");
while(startGame(Term) == true) {
// clear screen and stuff?
}
delete Term;
return 0;
}
+2
View File
@@ -0,0 +1,2 @@
FIL monster.obj,muppet.obj,player.obj,room.obj,VGA256Term.obj
+481
View File
@@ -0,0 +1,481 @@
40
targetIdent
0
MProject
1
MComponent
0
2
WString
3
EXE
3
WString
5
dc6en
1
0
1
4
MCommand
0
5
MCommand
0
6
MItem
10
muppet.com
7
WString
3
EXE
8
WVList
3
9
MRState
10
WString
5
WLINK
11
WString
25
?????No debug information
1
1
12
MRState
13
WString
5
WLINK
14
WString
14
?????Debug all
1
0
15
MCState
16
WString
5
WLINK
17
WString
24
?????Eliminate dead code
1
1
18
WVList
0
-1
1
1
0
19
WPickList
10
20
MItem
5
*.cpp
21
WString
6
CPPOBJ
22
WVList
18
23
MRState
24
WString
3
WPP
25
WString
21
?????No optimizations
1
0
26
MRState
27
WString
3
WPP
28
WString
24
?????Space optimizations
1
1
29
MCState
30
WString
3
WPP
31
WString
22
?????Branch prediction
1
1
32
MCState
33
WString
3
WPP
34
WString
23
?????Loop optimizations
1
1
35
MCState
36
WString
3
WPP
37
WString
19
?????Loop unrolling
1
1
38
MCState
39
WString
3
WPP
40
WString
30
?????Call/return optimizations
1
1
41
MCState
42
WString
3
WPP
43
WString
32
?????In-line intrinsic functions
1
1
44
MCState
45
WString
3
WPP
46
WString
25
?????Relax alias checking
1
1
47
MCState
48
WString
3
WPP
49
WString
27
?????Instruction scheduling
1
1
50
MCState
51
WString
3
WPP
52
WString
33
?????Allow repeated optimizations
1
1
53
MCState
54
WString
3
WPP
55
WString
23
?????Math optimizations
1
1
56
MCState
57
WString
3
WPP
58
WString
39
?????Numerically unstable optimizations
1
1
59
MCState
60
WString
3
WPP
61
WString
26
?????Consistent FP results
1
1
62
MVState
63
WString
3
WPP
64
WString
29
?????Expand function in-line:
1
65
WString
2
20
1
66
MRState
67
WString
3
WPP
68
WString
9
??6??8086
1
0
69
MRState
70
WString
3
WPP
71
WString
10
??6??80486
1
1
72
MRState
73
WString
3
WPP
74
WString
9
?????None
1
1
75
MRState
76
WString
3
WPP
77
WString
30
?????Normal exception handling
1
0
78
WVList
0
-1
1
1
0
79
MItem
11
monster.cpp
80
WString
6
CPPOBJ
81
WVList
0
82
WVList
0
20
1
1
0
83
MItem
10
muppet.cpp
84
WString
6
CPPOBJ
85
WVList
0
86
WVList
0
20
1
1
0
87
MItem
10
player.cpp
88
WString
6
CPPOBJ
89
WVList
0
90
WVList
0
20
1
1
0
91
MItem
8
room.cpp
92
WString
6
CPPOBJ
93
WVList
0
94
WVList
0
20
1
1
0
95
MItem
14
VGA256Term.cpp
96
WString
6
CPPOBJ
97
WVList
0
98
WVList
0
20
1
1
0
99
MItem
3
*.h
100
WString
3
NIL
101
WVList
0
102
WVList
0
-1
1
1
0
103
MItem
15
font8x8_basic.h
104
WString
3
NIL
105
WVList
0
106
WVList
0
99
1
1
0
107
MItem
5
*.hpp
108
WString
3
NIL
109
WVList
0
110
WVList
0
-1
1
1
0
111
MItem
11
headers.hpp
112
WString
3
NIL
113
WVList
0
114
WVList
0
107
1
1
0
+2
View File
@@ -0,0 +1,2 @@
FIL monster.obj,muppet.obj,player.obj,room.obj,VGA256Term.obj
+43
View File
@@ -0,0 +1,43 @@
40
projectIdent
0
VpeMain
1
WRect
1408
132
7680
9216
2
MProject
3
MCommand
0
4
MCommand
0
1
5
WFileName
10
muppet.tgt
6
WVList
1
7
VComponent
8
WRect
0
0
5712
4352
0
0
9
WFileName
10
muppet.tgt
0
9
7
+46
View File
@@ -0,0 +1,46 @@
/* Copyright (C) 2021 William Welna (wwelna@occultusterra.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "headers.hpp"
Player::Player(Room *location) {
this->location = location;
this->arrows = 5;
this->hasDied=false;
this->supplies = 20;
}
void Player::doActions() {
if(this->supplies <= 0) {
this->hasDied = true;
} else
this->supplies -= 1;
}
Player::~Player() {
}
#ifdef DEBUG
void Player::debug() {
printf("PLAYER LOCATION #%i Arrows %d Died %d\n", this->location->ID, this->arrows, this->hasDied);
}
#endif
+43
View File
@@ -0,0 +1,43 @@
/* Copyright (C) 2021 William Welna (wwelna@occultusterra.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "headers.hpp"
Room::Room(int id) {
this->ID = id;
this->hasAnkleBitters = false;
this->hasMaltego = false;
}
void Room::setRooms(Room *r1, Room *r2, Room *r3) {
this->rooms[0] = r1;
this->rooms[1] = r2;
this->rooms[2] = r3;
}
Room::~Room() {
}
#ifdef DEBUG
void Room::debug() {
printf("ROOM ID #%d Borders [%d %d %d]\n", this->ID, this->rooms[0]->ID, this->rooms[1]->ID, this->rooms[2]->ID);
}
#endif