File: init.lua

package info (click to toggle)
scummvm 2.9.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 450,580 kB
  • sloc: cpp: 4,299,825; asm: 28,322; python: 12,901; sh: 11,302; java: 9,289; xml: 7,895; perl: 2,639; ansic: 2,465; yacc: 1,670; javascript: 1,020; makefile: 933; lex: 578; awk: 275; objc: 82; sed: 11; php: 1
file content (193 lines) | stat: -rw-r--r-- 4,328 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
local lua_file = nil

--load common functions
lua_file = nuvie_load("common/common.lua"); lua_file();

function dbg(msg_string)
	--io.stderr:write(msg_string)
end

function load_game()
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
}

function is_container_obj(obj_num)
   if g_container_obj_tbl[obj_num] ~= nil then
      return true
   end
   return false
end

function search(obj)
   if obj.on_map == false then
      return
   end

   local found_obj = false
   local child
   local first_loop = true
   local prev_obj = nil
   for child in container_objs(obj) do
      if prev_obj ~= nil then
         printfl("SEARCH_NEXT_OBJ", prev_obj.look_string)
         Obj.moveToMap(prev_obj, obj.x, obj.y, obj.z)
      end

      if first_loop == true then
         found_obj = true
         printfl("SEARCHING_HERE_YOU_FIND", child.look_string)
         Obj.moveToMap(child, obj.x, obj.y, obj.z)
      else
         prev_obj = child
      end

      script_wait(50)
      first_loop = false
   end

   if prev_obj ~= nil then
      printfl("SEARCH_LAST_OBJ", prev_obj.look_string)
      Obj.moveToMap(prev_obj, obj.x, obj.y, obj.z)
   end

   if found_obj == false then
      printl("SEARCHING_HERE_YOU_FIND_NOTHING")
   else
      print(".\n")
   end

end

--tile_num, readied location
local g_readiable_objs_tbl = {
-- 0 = head
-- 1 = neck
[630] = 1, --tooth necklace
[631] = 1, --jade necklace
[696] = 1, --lei
-- 3 = 1 handed
[512] = 3, --spear of shamap
[541] = 3, --black staff
[545] = 3, --club
[546] = 3, --obsidian knife
[547] = 3, --spear
[548] = 3, --throwing axe
[549] = 3, --axe
[550] = 3, --rock hammer
[554] = 3, --obsidian sword
[558] = 3, --atl atl
[560] = 3, --boomerang
[565] = 3, --knife
[574] = 3, --scissors
[677] = 3, --metal hammer
[700] = 3, --grenade
[701] = 3, --lit grenade
[900] = 3, --torch
[901] = 3, --lit torch
[1028] = 3, --device
[1029] = 3, --activated device
-- 2 = torso
[518] = 2, --cloth armor
[519] = 2, --leather armour
[520] = 2, --bark armor
-- 3 = shield hand
[513] = 3, --shield of krukk
[524] = 3, --bark shield
[525] = 3, --leather shield
[526] = 3, --stegosaurus shield
[606] = 3, --kotl shield
-- 7 = feet
-- 4 = two handed - FIXME: guns (561, 571, 572) can't be equipped by natives
[552] = 4, --bow
[553] = 4, --blowgun
[553] = 4, --two handed hammer
[561] = 4, --modern rifle
[571] = 4, --bamboo flintlock
[572] = 4, --loaded bamboo flintlock
[640] = 4, --fire extinguisher
[676] = 4, --fire axe
[689] = 4, --bamboo pole
[692] = 4, --digging stick
[904] = 4, --fishing pole
-- 9 = finger
[600] = 9, --ring (not equipable in original)
}

function obj_is_readiable(obj)
	if g_readiable_objs_tbl[obj.tile_num] ~= nil then
		return true
	end

	return false
end

function obj_get_readiable_location(obj)
	if g_readiable_objs_tbl[obj.tile_num] ~= nil then
		return g_readiable_objs_tbl[obj.tile_num]
	end

	return -1
end

function create_object_needs_quan(obj_n)
-- obj.stackable is already checked
	return false
end

function talk_to_obj(obj)
   printl("NOTHING")
   return false
end

--load actor functions
local actor_load = nuvie_load("se/actor.lua");
if type(actor_load) == "function" then
	actor_load()
else
	if type(actor_load) == "string" then
		--io.stderr:write(actor_load);
	end
end

look_init = nuvie_load("se/look.lua"); look_init();

-- init usecode
usecode_init = nuvie_load("se/usecode.lua"); usecode_init();

player_init = nuvie_load("se/player.lua"); player_init();