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