[Scummvm-git-logs] scummvm master -> 77034aa487df213c87f19faca847e0c29e830214
dreammaster
paulfgilbert at gmail.com
Tue Mar 24 01:19:56 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
77034aa487 NUVIE: Add correct up to date Lua scripts
Commit: 77034aa487df213c87f19faca847e0c29e830214
https://github.com/scummvm/scummvm/commit/77034aa487df213c87f19faca847e0c29e830214
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-03-23T18:19:44-07:00
Commit Message:
NUVIE: Add correct up to date Lua scripts
For now I'm holding off regenerating the ultima.dat file, since I'll
likely do it in the near future once the xu4 project is merged in
Changed paths:
A devtools/create_ultima/files/ultima6/scripts/se/ending.lua
devtools/create_ultima/files/ultima6/scripts/common/common.lua
devtools/create_ultima/files/ultima6/scripts/md/ending.lua
devtools/create_ultima/files/ultima6/scripts/md/intro.lua
devtools/create_ultima/files/ultima6/scripts/md/look.lua
devtools/create_ultima/files/ultima6/scripts/se/actor.lua
devtools/create_ultima/files/ultima6/scripts/se/init.lua
devtools/create_ultima/files/ultima6/scripts/se/lang/en/game.lua
devtools/create_ultima/files/ultima6/scripts/se/usecode.lua
diff --git a/devtools/create_ultima/files/ultima6/scripts/common/common.lua b/devtools/create_ultima/files/ultima6/scripts/common/common.lua
index f78b506393..880435dc30 100644
--- a/devtools/create_ultima/files/ultima6/scripts/common/common.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/common/common.lua
@@ -157,11 +157,11 @@ function play_midgame_sequence(seq_num)
else
--[[
text_sprite_bg = sprite_new(nil, 8, 160, true)
- text_sprite_bg.text_align_centre = true
+ text_sprite_bg.text_align = 2
text_sprite_bg.text_color = 14
--]]
text_sprite = sprite_new(nil, 8, 160, true)
- text_sprite.text_align_centre = true
+ text_sprite.text_align = 2
text_sprite.text_color = 15
bg.x = 80
bg.y = 12
diff --git a/devtools/create_ultima/files/ultima6/scripts/md/ending.lua b/devtools/create_ultima/files/ultima6/scripts/md/ending.lua
index afed3d11ca..1db65c7e8e 100644
--- a/devtools/create_ultima/files/ultima6/scripts/md/ending.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/md/ending.lua
@@ -10,7 +10,7 @@ function play()
local text = sprite_new(nil, 0, 160, true)
text.text_color = 4
text.text = text_tbl[0]
- text.text_align_centre = true
+ text.text_align = 2
local bg = sprite_new(g_img_tbl[0][0], 0, 24, true)
local jack = sprite_new(g_img_tbl[0][gender+1], 155, 151, true)
diff --git a/devtools/create_ultima/files/ultima6/scripts/md/intro.lua b/devtools/create_ultima/files/ultima6/scripts/md/intro.lua
index 2cf2fdb361..e074d370a1 100644
--- a/devtools/create_ultima/files/ultima6/scripts/md/intro.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/md/intro.lua
@@ -455,7 +455,7 @@ function show_home()
local text = sprite_new(nil, 0, 160, true)
text.text = text_tbl[1]
text.text_color = 14
- text.text_align_centre = true
+ text.text_align = 2
fade_in()
music_play("mdd_mus.lzc", 8)
@@ -673,7 +673,7 @@ function show_lab_present_day()
local text = sprite_new(nil, 0, 160, true)
text.text = text_tbl[1]
text.text_color = 2
- text.text_align_centre = true
+ text.text_align = 2
local moongate_tbl = image_load_all("moongate.lzc")
@@ -792,7 +792,7 @@ function show_lab_1895()
local text = sprite_new(nil, 0, 160, true)
text.text = text_tbl[1]
text.text_color = 6
- text.text_align_centre = true
+ text.text_align = 2
local bg = sprite_new(scene4a_tbl[0], 0, 24, true)
@@ -1812,7 +1812,7 @@ function create_character()
local text = sprite_new(nil, 0, 160, true)
text.text = text_tbl[0]
text.text_color = 2
- text.text_align_centre = true
+ text.text_align = 2
local bg = sprite_new(create_tbl[0][0], 0, 24, true)
local eyes_sprite = sprite_new(create_tbl[0][4], 0, 24, true)
diff --git a/devtools/create_ultima/files/ultima6/scripts/md/look.lua b/devtools/create_ultima/files/ultima6/scripts/md/look.lua
index 8465ddaa58..e9e6a36e99 100644
--- a/devtools/create_ultima/files/ultima6/scripts/md/look.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/md/look.lua
@@ -323,7 +323,7 @@ function look_obelisk(obj)
canvas_set_solid_bg(false)
else
text_sprite = sprite_new(nil, 8, 164, true)
- text_sprite.text_align_centre = true
+ text_sprite.text_align = 2
text_sprite.text_color = 15
text_sprite.text = "Obelisk."
obelisk.x = 96
diff --git a/devtools/create_ultima/files/ultima6/scripts/se/actor.lua b/devtools/create_ultima/files/ultima6/scripts/se/actor.lua
index fed1e93180..920d11b1bd 100644
--- a/devtools/create_ultima/files/ultima6/scripts/se/actor.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/se/actor.lua
@@ -263,7 +263,9 @@ function advance_time(num_turns)
end
end
---function can_get_obj_override(obj)
+function can_get_obj_override(obj)
+ return false
+end
function actor_get_obj(actor, obj) -- FIXME need to limit inventory slots
diff --git a/devtools/create_ultima/files/ultima6/scripts/se/ending.lua b/devtools/create_ultima/files/ultima6/scripts/se/ending.lua
new file mode 100644
index 0000000000..0e664924d5
--- /dev/null
+++ b/devtools/create_ultima/files/ultima6/scripts/se/ending.lua
@@ -0,0 +1,68 @@
+local lua_file = nil
+
+lua_file = nuvie_load("common/intro_common.lua"); lua_file();
+
+function play()
+ local g_img_tbl = image_load_all("endgame.lzc")
+ -- 0,0 Party
+ -- 0,1 Lord British
+ -- 0,2 Aiela
+ -- 0,3 Tristia
+ -- 0,4 Leaving Savage Empire
+
+ local bg = sprite_new(g_img_tbl[0][0], 0, 0, true)
+ canvas_set_palette("savage.pal", 1)
+ canvas_set_opacity(0xff);
+ mouse_cursor_visible(false)
+ canvas_set_update_interval(25)
+
+ local txt = sprite_new(nil, 28, 135, true)
+ txt.text_color = 0
+ txt.text = i18n("IMG1_TXT1_END")
+ txt.text_align = 1
+ fade_in()
+ wait_for_input()
+ txt.text = i18n("IMG1_TXT2_END")
+ wait_for_input()
+ txt.text = i18n("IMG1_TXT3_END")
+ wait_for_input()
+
+ bg.image = g_img_tbl[0][1]
+ txt.text = i18n("IMG2_TXT1_END")
+ wait_for_input()
+ txt.text = i18n("IMG2_TXT2_END")
+ wait_for_input()
+
+-- TODO: Add Check for Love with Aiela
+ bg.image = g_img_tbl[0][2]
+ txt.text = i18n("IMG3_TXT1_END")
+ wait_for_input()
+ txt.text = i18n("IMG3_TXT2_END")
+ wait_for_input()
+ txt.text = i18n("IMG3_TXT3_END")
+ wait_for_input()
+
+-- TODO: Add Check for Love with Tristia
+ bg.image = g_img_tbl[0][3]
+ txt.text = i18n("IMG4_TXT1_END")
+ wait_for_input()
+ txt.text = i18n("IMG4_TXT2_END")
+ wait_for_input()
+
+ bg.image = g_img_tbl[0][4]
+ txt.text = i18n("IMG5_TXT1_END")
+ wait_for_input()
+ txt.text = i18n("IMG5_TXT2_END")
+ wait_for_input()
+ txt.text = i18n("IMG5_TXT3_END")
+ wait_for_input()
+ txt.text = i18n("IMG5_TXT4_END")
+ wait_for_input()
+
+ bg.image = g_img_tbl[0][1]
+ txt.text = i18n("IMG2_TXT3_END")
+-- TODO - Add Years, Months, Days to String
+ wait_for_input()
+end
+
+play()
diff --git a/devtools/create_ultima/files/ultima6/scripts/se/init.lua b/devtools/create_ultima/files/ultima6/scripts/se/init.lua
index 664d93401a..5856147d27 100644
--- a/devtools/create_ultima/files/ultima6/scripts/se/init.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/se/init.lua
@@ -13,6 +13,35 @@ end
function save_game()
end
+local g_tile_to_object_map = {
+-- Trees
+[50] = 5000, [51] = 5000, [64] = 5000, [65] = 5000, [66] = 5000,
+[67] = 5000, [68] = 5000, [69] = 5000, [70] = 5000, [71] = 5000,
+[72] = 5000, [192] = 5000, [193] = 5000, [194] = 5000, [195] = 5000,
+[198] = 5000, [179] = 5000, [180] = 5000, [130] = 5000,
+-- Oven Fire
+[16] = 5001, [17] = 5001, [18] = 5001, [19] = 5001, [20] = 5001,
+[21] = 5001, [22] = 5001, [23] = 5001, [24] = 5001, [25] = 5001,
+[26] = 5001, [27] = 5001, [170] = 5001, [171] = 5001,
+-- Yucca Plant
+[52] = 5002,
+}
+
+function get_tile_to_object_mapping(tile_num)
+ return g_tile_to_object_map[tile_num]
+end
+
+local g_is_object_a_tile = {
+[5000] = true, [5001] = true, [5002] = true
+}
+
+function is_tile_object(obj_num)
+ if g_is_object_a_tile[obj_num] ~= nil then
+ return true
+ end
+ return false
+end
+
local g_container_obj_tbl = {
[59] = 1, [60] = 1, [97] = 1,
[182] = 1, [183] = 1, [184] = 1
diff --git a/devtools/create_ultima/files/ultima6/scripts/se/lang/en/game.lua b/devtools/create_ultima/files/ultima6/scripts/se/lang/en/game.lua
index f00c513153..92928b4391 100644
--- a/devtools/create_ultima/files/ultima6/scripts/se/lang/en/game.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/se/lang/en/game.lua
@@ -6,4 +6,31 @@ SEARCHING_HERE_YOU_FIND="Searching here, you find %s",
SEARCHING_HERE_YOU_FIND_NOTHING="Searching here, you find nothing.\n",
SEARCH_NEXT_OBJ=", %s",
SEARCH_LAST_OBJ=" and %s",
+OUT_OF_RANGE="Out of Range!\n",
+BLAH="Blah",
+CARRY_TOO_MUCH="You are carrying too much already.\n",
+GOT_CORN="You got some corn from the plant.\n",
+USE_CLAY="You shaped a small, soft pot from the clay.\n",
+USE_FISHING_POLE_NO_WATER="You need to stand next to deep water.\n",
+USE_FISHING_POLE_FAIL="You didn't get a fish.\n",
+USE_FISHING_POLE_SUCCESS="You caught a fish!\n",
+USE_DIGGING_STICK_NO_WATER="There is nothing to dig!\n",
+USE_DIGGING_STICK="You get some clay.\n",
+USE_YUCCA_PLANT="You got some flax from the yucca plant.\n",
+USE_TREE="You pulled a branch from the tree.\n",
+IMG1_TXT1_END="Members of all the tribes come for the feast... the largest and most important feast ever held in the Valley of Eodon.",
+IMG1_TXT2_END="Kurak sits beside Yolaru, Pindiro beside Barako, Haakur beside Sakkhra, and peace is sworn between the tribes.",
+IMG1_TXT3_END="You know this peace isn't for you. Soon enough, you will hear the call to action again. But tonight, there is time for music and dance, friendship and love.",
+IMG2_TXT1_END="At dawn, your past catches up with you... and your future beckons. A vision of Lord British appears before you.",
+IMG2_TXT2_END="\"You have done well,\" he says. \"But now I must take you where you are needed. For the sake of the friends you leave behind, I am sorry. Prepare yourself.\"",
+IMG3_TXT1_END="You say farewell to Aiela. \"Aiela does not know your world. Take her there,\" she pleads. \"Teach her of your world.",
+IMG3_TXT2_END="You shake your head. \"My world would strangle you. You must stay. My heart remains with you. But my duty is elsewhere... with him.\"",
+IMG3_TXT3_END="Tears roll down her cheeks. \"Abandon duty, and you will not be warrior Aiela loves. Choose duty, and you must leave. Either way, Aiela loses all... Farewell.\"",
+IMG4_TXT1_END="You say farewell to Tristia. \"I must go with Lord British,\" you say. \"My duty lies with him, though it breaks my heart.\"",
+IMG4_TXT2_END="Tristia laughs sweetly. \"Tristia does not mind,\" she says. \"Tristia has found another loves: handsome Botorok. Botorok is so much better than you. Go with your chief. Go.\"",
+IMG5_TXT1_END="You are joined by Spector's former assistant, Fritz, who came out of hiding to fight the Myrmidex, and bears their scars.",
+IMG5_TXT2_END="The moongate appears, summoned by the shade of Lord British. Jimmy, Spector and Fritz gather their belongs...",
+IMG5_TXT3_END="But Rafkin does not. \"I'm staying, my friend,\" he says, \"Someone must. I will stay here... and hope other scientists come. Farewell.\"",
+IMG5_TXT4_END="Saddened, you follow your friends and allies into the moongate, leaving the Valley of Eodon. Perhaps someday you will return to those you have left behind.",
+IMG2_TXT3_END="CONGRATULATIONS. You have completed THE SAVAGE EMPIRE in XXTIMESTRXX. Communicate your success to Lord British at Origin!",
}
diff --git a/devtools/create_ultima/files/ultima6/scripts/se/usecode.lua b/devtools/create_ultima/files/ultima6/scripts/se/usecode.lua
index c5dde0f4b7..43166923ed 100644
--- a/devtools/create_ultima/files/ultima6/scripts/se/usecode.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/se/usecode.lua
@@ -1,49 +1,250 @@
local USE_EVENT_USE = 0x01
-local usecode_table = {--[[
-[86]={["func"]=use_container},
-[87]={["func"]=use_container},
-[102]={["on"]={[86]=use_crate,[427]=use_prybar_on_hatch}},
-[104]={["func"]=use_container},
-[152]={["func"]=use_door},
-[222]={["func"]=use_door},
-[273]={["on"]={[86]=use_crate}}, --Hammer needs more codes
-[284]={["func"]=use_container},
-[421]={["func"]=use_door},
-[427]={["func"]=use_hatch},
---]]
+-- Returns true if the actor has the item or a container with the item
+function actor_has_item(actor, obj)
+ local tobj = obj
+ while tobj.in_container do
+ tobj = tobj.parent
+ end
+ if tobj.on_map == false and
+ tobj.parent.luatype == "actor" and
+ tobj.parent.actor_num == actor.actor_num then
+ return true
+ end
+ return false
+end
+
+-- Check Reachable
+-- A) Next to actor passed in
+-- B) In inventory of any party member
+-- Return actor that can reach object or nil
+-- Optionally automatically print "Out of Range!" message
+function check_can_reach(obj, actor, print_msg)
+ if math.abs(obj.x - actor.x) <= 1 and
+ math.abs(obj.y - actor.y) <= 1 and
+ obj.z == actor.z then
+ return actor
+ end
+
+ for party_member in party_members() do
+ if actor_has_item(party_member, obj) == true then
+ return party_member
+ end
+ end
+
+ if print_msg then
+ printl("OUT_OF_RANGE")
+ end
+ return nil
+end
+
+-- delete an object from inventory or remove it from the map
+function delete_or_remove_object(actor, obj, qty)
+ -- FIXME: Remove the exact object from the Actor
+ if Actor.inv_has_obj_n(actor, obj.obj_n) then
+ if qty ~= nil then
+ Actor.inv_remove_obj_qty(actor, obj.obj_n, qty)
+ else
+ Actor.inv_remove_obj(actor, obj)
+ end
+ -- Remove the object from the map
+ else
+ if qty ~= nil then
+ map_remove_obj(obj, qty)
+ else
+ map_remove_obj(obj)
+ end
+ end
+end
+
+-- create and add item to actor, qty if stackable, drop if required to create the item,
+-- obj_n: Item Code to Create
+-- actor: actor to get the object
+-- qty: how many (or nil)
+-- drop_if_fail: if true, object gets put on the map on failure
+-- print_msg: if true, prints the carry too much message on failure
+function add_item_to_actor(obj_n, actor, qty, drop_if_fail, print_msg)
+ local new_obj = Obj.new(obj_n)
+ if qty ~= nil then
+ new_obj.qty = qty
+ else
+ new_obj.qty = 1
+ end
+
+ if Actor.can_carry_obj(actor, new_obj) then
+ if qty ~= nil then
+ Actor.inv_add_obj(actor, new_obj, STACK_OBJECT_QTY)
+ else
+ Actor.inv_add_obj(actor, new_obj, false)
+ end
+ else
+ if print_msg then
+ printl("CARRY_TOO_MUCH")
+ end
+ return false
+ end
+ return true
+end
+
+function use_corn_stalk(obj, actor)
+ local use_actor = check_can_reach(obj, actor, true)
+ if use_actor == nil then
+ return
+ end
+
+ if add_item_to_actor(108, use_actor, 1, false, true) == true then
+ printl("GOT_CORN")
+ end
+end
+
+function use_tree(obj, actor)
+ local use_actor = check_can_reach(obj, actor, true)
+ if use_actor == nil then
+ return
+ end
+
+ if add_item_to_actor(206, use_actor, 1, false, true) == true then
+ printl("USE_TREE")
+ end
+end
+
+function use_yucca_plant(obj, actor)
+ local use_actor = check_can_reach(obj, actor, true)
+ if use_actor == nil then
+ return
+ end
+
+ if add_item_to_actor(210, use_actor, 1, false, true) == true then
+ printl("USE_YUCCA_PLANT")
+ end
+end
+
+function use_clay(obj, actor)
+ local use_actor = check_can_reach(obj, actor, true)
+ if use_actor == nil then
+ return
+ end
+
+ -- delete clay
+ local location_code = delete_or_remove_object(use_actor, obj, nil)
+ if add_item_to_actor(132, use_actor, nil, false, false) == true then
+ printl("USE_CLAY")
+ end
+ -- TODO: IF ADD FAILED, PUT CLAY BACK WHERE IT WAS
+end
+
+function use_fishing_pole(obj, actor)
+ local use_actor = check_can_reach(obj, actor, true)
+ if use_actor == nil then
+ return
+ end
+
+ -- Check Deep Water
+-- if <<Standing Next to Deep Water>> then
+ printl("USE_FISHING_POLE_NO_WATER")
+-- end
+ -- Check Success
+-- if random() == SUCCESS then
+ if add_item_to_actor(192, use_actor, nil, false, false) == true then
+-- add_item without print
+-- if SUCCESS then
+ printl("USE_FISHING_POLE_SUCCESS")
+ end
+-- end
+ printl("USE_FISHING_POLE_FAIL")
+end
+
+function use_digging_stick(obj, actor)
+ local use_actor = check_can_reach(obj, actor, true)
+ if use_actor == nil then
+ return
+ end
+
+ -- Check Water
+-- if <<Standing Next to Water>> then
+ printl("USE_DIGGING_STICK_NO_WATER")
+-- end
+ if add_item_to_actor(192, use_actor, 1, false, true) == true then
+ printl("USE_DIGGING_STICK")
+ end
+end
+
+local usecode_table = {
+[61]=use_corn_stalk,
+[131]=use_digging_stick,
+[192]=use_clay,
+[212]=use_fishing_pole,
+[5000]=use_tree,
+[108]=use_tree,
+[5001]=use_oven_or_fire,
+[5002]=use_yucca_plant,
+--[[
+[62]=use_bean_stalk,
+--[127]=use_bamboo_plant, -- confirmed
+[132]=use_soft_clay_pot, -- confirmed
+[133]=use_fired_clay_pot, -- confirmed
+[134]=use_cloth_strip, -- confirmed
+[191]=use_tarred_cloth_strip, -- confirmed
+[210]=use_flax, -- confirmed
+]]--
+--[[
+[10]=use_magnesium_ribbon, -- confirmed
+[12]=use_paddle, -- confirmed
+[20]={["on"]=use_rope},
+[25]={["on"]=use_cutting_tool}, -- confirmed (obsidian knife)
+[29]=use_rock_hammer, -- confirmed (rock hammer)
+[42]=use_vine, -- confirmed (vine)
+[44]={["on"]=use_cutting_tool}, -- confirmed (knife)
+[47]=use_turtle_bait,
+[51]=use_camera,
+[52]={["on"]=use_cutting_tool}, -- confirmed (scissors)
+[54]={["on"]=use_chocolatl}, --Original required using totem on reagent
+[55]={["on"]=use_pinde}, -- confirmed
+[56]={["on"]=use_yopo}, -- confirmed
+[59]=use_grinding_stone, -- confirmed (mortar)
+[60]=use_grinding_stone, -- confirmed (grinding stone)
+[63]=use_jug_of_platcha,
+[64]=use_torch,
+[75]=standing_torch, -- confirmed (almost certainly can't use)
+[86]=use_heluzz, -- confirmed
+[87]=use_motazz, -- confirmed
+[88]=use_aphazz, -- confirmed
+[93]=use_corn_meal,
+[94]=use_fire_extinguisher, -- confirmed
+[102]=use_tortilla, -- confirmed
+[108]=use_corn, -- confirmed
+[118]=use_fire_axe, -- confirmed
+[119]=use_metal_hammer, -- confirmed
+[128]=use_bamboo_pole, -- confirmed
+[136]=use_metal_bucket, -- confirmed
+[137]=use_grenade, -- confirmed
+[153]=use_vine(corn_stalk)???, -- confirmed
+[206]=use_tree_branch, -- confirmed
+[208]=use_torch,
+[240]=use_device, -- confirmed Explosive Device
+[267]=use_device2 -- confirmed Compass Device? USE?
+]]--
}
function has_usecode(obj, usecode_type)
- if usecode_type == USE_EVENT_USE and usecode_table[obj.obj_n] ~= nil then
- return true
- end
+ if usecode_type == USE_EVENT_USE and usecode_table[obj.obj_n] ~= nil then
+ return true
+ end
- return false
+ return false
end
function use_obj(obj, actor)
- if usecode_table[obj.obj_n].on ~= nil then
-
- local target_obj = get_target_obj("On - ")
- if target_obj ~= nil then
- print(target_obj.name .. "\n")
- local func = usecode_table[obj.obj_n].on[target_obj.obj_n]
- if func ~= nil then
- func(obj, target_obj, actor)
- else
- print("\nNo effect\n")
- end
- else
- print("nothing!\n")
- end
- else
- local func = usecode_table[obj.obj_n].func
- if func ~= nil then
- func(obj, actor)
- end
- end
+ if type(usecode_table[obj.obj_n]) == "function" then
+ local func = usecode_table[obj.obj_n]
+ if func ~= nil then
+ print("\n")
+ func(obj, actor)
+ end
+ else
+ use_obj_on(obj, actor, usecode_table[obj.obj_n])
+ end
end
function move_obj(obj, rel_x, rel_y)
More information about the Scummvm-git-logs
mailing list