Finished game for the first time.

This commit is contained in:
Scott Duensing 2022-08-09 17:18:09 -05:00
parent 6eaadcac58
commit 32672bea9f

View file

@ -53,7 +53,7 @@ STATE_CHOOSE_PRIZE = 20
STATE_WON_GAME = 21
STATE_EXIT_GAME = 22
STATE_PUT_WHERE = 23
STATE_LASERDISC = 24
STATE_DONT_CHANGE = 24 -- Not actually a game state - prevents parser from changing the state to parser
-- Apple II 40 column font.
fntApple12 = fontLoad(GAME .. "/Fonts/PrintChar21.ttf", 12)
@ -282,7 +282,7 @@ function onOverlayUpdate()
if END_FRAME ~= -1 then
--debugPrint("Frame " .. discGetFrame() .. " Waiting " .. END_FRAME)
if (discGetFrame() >= END_FRAME) then
debugPrint("Playback end. Switching to state " .. NEXT_STATE)
--debugPrint("Playback end. Switching to state " .. NEXT_STATE)
discSearch(END_FRAME)
END_FRAME = -1
STATE = NEXT_STATE
@ -390,7 +390,12 @@ function pioneer(newstate, command)
end
-- Show it.
SHOW_JPG = JPGS[frames[1]]
STATE = newstate
if newstate == STATE_PARSER then
NEXT_STATE = newstate
STATE = STATE_DONT_CHANGE
else
STATE = newstate
end
end
-- Are we playing a sequence?
@ -404,10 +409,10 @@ function pioneer(newstate, command)
-- Hide keyboard while video runs.
KEYBOARD_ON = OFF
NEXT_STATE = newstate
STATE = STATE_LASERDISC
STATE = STATE_DONT_CHANGE
end
debugPrint("Laserdisc " .. command .. " NEXT_STATE " .. NEXT_STATE .. " STATE " .. STATE)
--debugPrint("Laserdisc " .. command .. " NEXT_STATE " .. NEXT_STATE .. " STATE " .. STATE)
end
@ -422,7 +427,7 @@ function processGameState(what)
local func = STATES[STATE]
if (func) then
debugPrint("Firing state " .. STATE .. " with [" .. what .. "]")
--debugPrint("Firing state " .. STATE .. " with [" .. what .. "]")
func(what)
end
@ -457,50 +462,62 @@ function resetGameData()
OBJECTS = {
{
-- 1
NAME = "COINS",
DESCRIPTION = "TWO DIMES AND A NICKEL",
LOCATION = 4
}, {
-- 2
NAME = "TOOLKIT",
DESCRIPTION = "IT CONTAINS EVERYTHING NEEDED FOR SMALL ELECTRONIC REPAIRS",
LOCATION = 7
}, {
-- 3
NAME = "TICKET",
DESCRIPTION = "IT SAYS, 'GOOD FOR 1 FREE GAME AT THE BALL TOSS, COURTESY OF CREATIVE COMPUTING, THE #1 MAGAZINE OF SOFTWARE AND APPLICATIONS.'",
LOCATION = 14
}, {
-- 4
NAME = "BOOK",
DESCRIPTION = "THE TITLE IS 'RADIO FREQUENCY JAMMING TECHNIQUES.'",
LOCATION = 15
}, {
-- 5
NAME = "LAMP",
DESCRIPTION = "IT IS VERY GAUDY.",
LOCATION = -1
}, {
-- 6
NAME = "TOWELS",
DESCRIPTION = "NICE AND FLUFFY.",
LOCATION = -1
}, {
-- 7
NAME = "POSTER",
DESCRIPTION = "WHOOPIE -- IT'S THE DALLAS CHEERLEADERS.",
LOCATION = -1
}, {
-- 8
NAME = "BEAR",
DESCRIPTION = "WHEN YOU PUSH THE BUTTON ON ITS BACK, IT SAYS 'I WUV YOU.'",
LOCATION = -1
}, {
-- 9
NAME = "UNIFORM",
DESCRIPTION = "",
LOCATION = 10
}, {
-- 10
NAME = "RADIO",
DESCRIPTION = "",
LOCATION = -1
}, {
-- 11
NAME = "BATTERIES",
DESCRIPTION = "",
LOCATION = -1
}, {
-- 12
NAME = "JAMMER",
DESCRIPTION = "",
LOCATION = -1
@ -637,7 +654,7 @@ STATES = {
[STATE_LOOK] = function(what)
-- Do we want to show the "looking" frame?
if math.random() > 10.6 then
if math.random() > 0.6 then
pioneer(STATE_LOOK_DELAY, "FR2550SE/")
else
STATE = STATE_LOOK_VIDEO
@ -763,7 +780,7 @@ STATES = {
screenPrint("ENTITLES YOU TO COME IN HERE ANY TIME")
screenPrint("YOU WANT?' SHE TURNS HER BACK AND IGNORES YOU.")
STATE = STATE_NONE
STATE = STATE_PARSER
NEXT_STATE = STATE_PARSER
return
end
@ -801,7 +818,8 @@ STATES = {
-- 47100
if OBJECTS[9].LOCATION == 0 then
screenPrint("HE SEES YOUR UNIFORM AND LETS YOU IN.")
STATE = STATE_PARSER
STATE = STATE_NONE
NEXT_STATE = STATE_PARSER
else
screenPrint("HE SAYS, 'EMPLOYEES ONLY' AND THROWS YOU OUT.")
L = 11
@ -827,7 +845,7 @@ STATES = {
V, N = getVerbNoun(what)
debugPrint("Parser [" .. V .. "][" .. N .. "]")
--debugPrint("Parser [" .. V .. "][" .. N .. "]")
STATE = STATE_NONE
@ -917,7 +935,7 @@ STATES = {
screenPrint("UP THE GUN.")
OBJECTS[1].LOCATION = -1
pioneer(STATE_WON_BEAR, "FR10960SE/FR11107PL/")
debugPrint("Asked for state " .. STATE_WON_BEAR)
--debugPrint("Asked for state " .. STATE_WON_BEAR)
end
end
@ -933,6 +951,7 @@ STATES = {
screenPrint("A LAMP, TOWELS, RADIO, OR POSTER.")
screenPrint("WHICH DO YOU WANT?")
OBJECTS[3].LOCATION = -2
STATE = STATE_DONT_CHANGE
NEXT_STATE = STATE_CHOOSE_PRIZE
end
end
@ -1033,6 +1052,7 @@ STATES = {
else
screenPrint("WHERE?")
STATE_DATA = N
STATE = STATE_DONT_CHANGE
NEXT_STATE = STATE_PUT_WHERE
end
end
@ -1042,9 +1062,9 @@ STATES = {
singeQuit()
end
if what == "READ BOOK" and (OBJECTS[3].LOCATION == 0 or OBJECTS[3].LOCATION == L) then
if what == "READ BOOK" and (OBJECTS[4].LOCATION == 0 or OBJECTS[4].LOCATION == L) then
KW = 1
screenPrint("YOU NOW KNOW HOw TO MAKE A")
screenPrint("YOU NOW KNOW HOW TO MAKE A")
screenPrint("JAMMER FROM A RADIO.")
BK = 1
end
@ -1104,7 +1124,6 @@ STATES = {
KW = 1
screenPrint("IT FITS WELL AND MAKES A GOOD")
screenPrint("DISGUISE.")
OBJECTS[9].LOCATION = 0
pioneer(STATE_PARSER, "FR5890SE/")
end
@ -1136,7 +1155,7 @@ STATES = {
NEXT_STATE = STATE_PARSER
end
debugPrint("Parser Exit")
--debugPrint("Parser Exit")
end,
@ -1180,7 +1199,7 @@ STATES = {
screenPrint("GOOD SHOOTING.")
screenPrint("HE HANDS YOU A TEDDY BEAR.")
OBJECTS[8].LOCATION = 0
STATE = NONE
STATE = STATE_NONE
NEXT_STATE = STATE_PARSER
end,
@ -1195,7 +1214,7 @@ STATES = {
if what == "RADIO" then
pioneer(STATE_PARSER, "FR1234SE/")
else
STATE = NONE
STATE = STATE_NONE
NEXT_STATE = STATE_PARSER
end
end
@ -1203,6 +1222,8 @@ STATES = {
if t == 0 then
screenPrint("")
screenPrint("PLEASE ANSWER WITH LAMP, POSTER, RADIO OR TOWELS.")
STATE = STATE_NONE
NEXT_STATE = STATE_CHOOSE_PRIZE
end
end,
@ -1234,6 +1255,8 @@ STATES = {
else
if V ~= "IN" and V ~= "ON" then
screenPrint("I CAN'T DO THAT.")
STATE = STATE_NONE
NEXT_STATE = STATE_PARSER
else
if N == "FLOOR" or N == "TABLE" then
STATE = STATE_PARSER
@ -1248,11 +1271,12 @@ STATES = {
screenPrint("THE " .. N .. " ISN'T HERE.")
else
screenPrint("OK.")
if (STATE_DATA == "RADIO" or STATE_DATA == "JAMMER") and N == "BATTERIES" then
if ( N == "RADIO" or N == "JAMMER") and STATE_DATA == "BATTERIES" then
B = 1
OBJECTS[11].LOCATION = -2
end
end
STATE = NONE
STATE = STATE_NONE
NEXT_STATE = STATE_PARSER
end
end
@ -1283,7 +1307,19 @@ screenClear()
NEXT_STATE = STATE_NONE
STATE = STATE_GET_NAME
--[[
NA = "SCOTT"
STATE = STATE_LOOK
L = 1
KW = 1
B = 1
OBJECTS[1].LOCATION = -1
OBJECTS[2].LOCATION = 0
OBJECTS[3].LOCATION = -2
OBJECTS[8].LOCATION = -2
OBJECTS[9].LOCATION = 0
OBJECTS[10].LOCATION = 0
OBJECTS[11].LOCATION = -2
]]--
pioneer(STATE, "FR2818SE/")