[Moeng-cvs] BBRpg/data/scripts Action.lua, 1.9, 1.10 ActionController.lua, 1.3, 1.4 Actor.lua, 1.9,
Status: Alpha
Brought to you by:
b_lindeijer
Update of /cvsroot/moeng/BBRpg/data/scripts In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv13247/data/scripts Modified Files: Action.lua ActionController.lua Actor.lua Animation.lua Canvas.lua ConversationWindow.lua Decoration.lua ElecDoor.lua Game.lua GuiMenu.lua InteractionMaster.lua MessPile.lua Pawn.lua Player.lua PlayerController.lua PlayerSwitcher.lua SnowyWeather.lua SubcityObjects.lua Log Message: Upgraded BBRpg to work with Lua 5.1. Index: SnowyWeather.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/SnowyWeather.lua,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SnowyWeather.lua 28 Dec 2003 20:04:34 -0000 1.2 --- SnowyWeather.lua 27 Jan 2007 02:14:47 -0000 1.3 *************** *** 69,73 **** -- Add snow particles to reach density ! while (table.getn(self.particles) < self.density) do local p = self.map:spawn(SnowParticle, 0, 0, self) p.x = math.random(minx * 24, maxx * 24) / 24; --- 69,73 ---- -- Add snow particles to reach density ! while (#self.particles < self.density) do local p = self.map:spawn(SnowParticle, 0, 0, self) p.x = math.random(minx * 24, maxx * 24) / 24; Index: GuiMenu.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/GuiMenu.lua,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GuiMenu.lua 3 Jan 2004 20:08:34 -0000 1.6 --- GuiMenu.lua 27 Jan 2007 02:14:47 -0000 1.7 *************** *** 37,41 **** local curr = 0 ! for i = 1, table.getn(self.menuItems) do local tw, th = m_text_size(self.menuItems[i].text) m_set_color(0, 0, 0) --- 37,41 ---- local curr = 0 ! for i = 1, #self.menuItems do local tw, th = m_text_size(self.menuItems[i].text) m_set_color(0, 0, 0) *************** *** 48,52 **** local curr = 0 ! for i = 1, table.getn(self.menuItems) do if (i == self.selected) then guiTheme:drawBox(self.x, self.y + curr, self.w, self.menuItems[i]:getHeight()) --- 48,52 ---- local curr = 0 ! for i = 1, #self.menuItems do if (i == self.selected) then guiTheme:drawBox(self.x, self.y + curr, self.w, self.menuItems[i]:getHeight()) *************** *** 66,75 **** if (key == "up") then self.selected = self.selected - 1 ! if (self.selected == 0) then self.selected = table.getn(self.menuItems) end m_play_sample("bbsfx_hit1.wav") return true elseif (key == "down") then self.selected = self.selected + 1 ! if (self.selected > table.getn(self.menuItems)) then self.selected = 1 end m_play_sample("bbsfx_hit1.wav") return true --- 66,75 ---- if (key == "up") then self.selected = self.selected - 1 ! if (self.selected == 0) then self.selected = #self.menuItems end m_play_sample("bbsfx_hit1.wav") return true elseif (key == "down") then self.selected = self.selected + 1 ! if (self.selected > #self.menuItems) then self.selected = 1 end m_play_sample("bbsfx_hit1.wav") return true *************** *** 100,102 **** selected = 1, } ! } \ No newline at end of file --- 100,102 ---- selected = 1, } ! } Index: Actor.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/Actor.lua,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Actor.lua 4 Jan 2004 16:42:25 -0000 1.9 --- Actor.lua 27 Jan 2007 02:14:47 -0000 1.10 *************** *** 140,144 **** local tileName, obstacle = m_get_tile_at(self.map, x - 0.5, y - 0.5) ! if (table.getn(objectsAtTile) == 0 and obstacle == 0) then table.insert(dirs, i - 1) end --- 140,144 ---- local tileName, obstacle = m_get_tile_at(self.map, x - 0.5, y - 0.5) ! if (#objectsAtTile == 0 and obstacle == 0) then table.insert(dirs, i - 1) end *************** *** 149,153 **** randomFreeTileAround = function(self) local dirs = self:freeTilesAround() ! if (table.getn(dirs) > 0) then return dirs[math.random(table.getn(dirs))] end return nil end; --- 149,153 ---- randomFreeTileAround = function(self) local dirs = self:freeTilesAround() ! if (#dirs > 0) then return dirs[math.random(#dirs)] end return nil end; Index: SubcityObjects.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/SubcityObjects.lua,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** SubcityObjects.lua 10 Dec 2004 14:15:37 -0000 1.41 --- SubcityObjects.lua 27 Jan 2007 02:14:47 -0000 1.42 *************** *** 185,189 **** elseif (not self.bOccupied) then local afterTable = lang:getConv("BedTiredAfterTable") ! local options = table.getn(afterTable) - 1 ActionController:addSequence{ --- 185,189 ---- elseif (not self.bOccupied) then local afterTable = lang:getConv("BedTiredAfterTable") ! local options = #afterTable - 1 ActionController:addSequence{ Index: Decoration.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/Decoration.lua,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Decoration.lua 4 Jan 2004 16:42:25 -0000 1.5 --- Decoration.lua 27 Jan 2007 02:14:47 -0000 1.6 *************** *** 33,37 **** if (self.convTable) then self:log("Showing conversation..."); ! n = get_new_n(self.prev_random, table.getn(self.convTable)) self.prev_random = n write_conversation(self.convTable[n]) --- 33,37 ---- if (self.convTable) then self:log("Showing conversation..."); ! n = get_new_n(self.prev_random, #self.convTable) self.prev_random = n write_conversation(self.convTable[n]) Index: Canvas.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/Canvas.lua,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Canvas.lua 2 Jan 2004 02:49:56 -0000 1.4 --- Canvas.lua 27 Jan 2007 02:14:47 -0000 1.5 *************** *** 8,62 **** Canvas = Object:subclass { ! name = "Canvas"; ! drawBitmap = function(self, bitmap, dest_w, dest_h, src_x, src_y, src_w, src_h) ! m_draw_bitmap(bitmap, dest_w, dest_h, src_x, src_y, src_w, src_h) ! end; ! drawPattern = function(self, bitmap, dest_w, dest_h, org_x, org_y, scale) ! if (scale) then ! local cur_x, cur_y = m_get_cursor() ! m_draw_bitmap(bitmap, dest_w, dest_h, (cur_x - org_x) / scale, (cur_y - org_y) / scale, dest_w / scale, dest_h / scale) ! elseif (org_x and org_y) then ! local cur_x, cur_y = m_get_cursor() ! m_draw_bitmap(bitmap, dest_w, dest_h, cur_x - org_x, cur_y - org_y, dest_w, dest_h) ! else ! m_draw_bitmap(bitmap, dest_w, dest_h, 0, 0, dest_w, dest_h) ! end ! end; ! drawIcon = function(self, bitmap, scale) ! local bitmap_w, bitmap_h = m_bitmap_size(bitmap) ! if (not scale or scale == 1) then ! m_draw_bitmap(bitmap, bitmap_w, bitmap_h, 0, 0, bitmap_w, bitmap_h) ! else ! m_draw_bitmap(bitmap, bitmap_w * scale, bitmap_h * scale, 0, 0, bitmap_w, bitmap_h) ! end ! end; ! drawRect = function(self, bitmap, rect_x, rect_y) ! local bitmap_w, bitmap_h = m_bitmap_size(bitmap) ! m_draw_bitmap(bitmap, rect_x, rect_y, 0, 0, bitmap_w, bitmap_h) ! end; ! moveCursor = function(self, dx, dy) ! local x, y = self:getCursor() ! self:setCursor(x + dx, y + dy) ! end; ! setCursor = function(self, x, y) ! m_set_cursor(x, y) ! end; ! getCursor = function(self) ! return m_get_cursor() ! end; ! setAlpha = function(self, alpha) ! return m_set_alpha(alpha) ! end; ! setDrawMode = function(self, drawMode) ! m_set_drawmode(drawMode) ! end; } --- 8,62 ---- Canvas = Object:subclass { ! name = "Canvas"; ! drawBitmap = function(self, bitmap, dest_w, dest_h, src_x, src_y, src_w, src_h) ! m_draw_bitmap(bitmap, dest_w, dest_h, src_x, src_y, src_w, src_h) ! end; ! drawPattern = function(self, bitmap, dest_w, dest_h, org_x, org_y, scale) ! if (scale) then ! local cur_x, cur_y = m_get_cursor() ! m_draw_bitmap(bitmap, dest_w, dest_h, (cur_x - org_x) / scale, (cur_y - org_y) / scale, dest_w / scale, dest_h / scale) ! elseif (org_x and org_y) then ! local cur_x, cur_y = m_get_cursor() ! m_draw_bitmap(bitmap, dest_w, dest_h, cur_x - org_x, cur_y - org_y, dest_w, dest_h) ! else ! m_draw_bitmap(bitmap, dest_w, dest_h, 0, 0, dest_w, dest_h) ! end ! end; ! drawIcon = function(self, bitmap, scale) ! local bitmap_w, bitmap_h = m_bitmap_size(bitmap) ! if (not scale or scale == 1) then ! m_draw_bitmap(bitmap, bitmap_w, bitmap_h, 0, 0, bitmap_w, bitmap_h) ! else ! m_draw_bitmap(bitmap, bitmap_w * scale, bitmap_h * scale, 0, 0, bitmap_w, bitmap_h) ! end ! end; ! drawRect = function(self, bitmap, rect_x, rect_y) ! local bitmap_w, bitmap_h = m_bitmap_size(bitmap) ! m_draw_bitmap(bitmap, rect_x, rect_y, 0, 0, bitmap_w, bitmap_h) ! end; ! moveCursor = function(self, dx, dy) ! local x, y = self:getCursor() ! self:setCursor(x + dx, y + dy) ! end; ! setCursor = function(self, x, y) ! m_set_cursor(x, y) ! end; ! getCursor = function(self) ! return m_get_cursor() ! end; ! setAlpha = function(self, alpha) ! return m_set_alpha(alpha) ! end; ! setDrawMode = function(self, drawMode) ! m_set_drawmode(drawMode) ! end; } Index: InteractionMaster.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/InteractionMaster.lua,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** InteractionMaster.lua 28 Dec 2003 15:39:20 -0000 1.4 --- InteractionMaster.lua 27 Jan 2007 02:14:47 -0000 1.5 *************** *** 30,34 **** -- Search for the Interaction iIndex = -1; ! for i = 1, table.getn(interactionArray) do if (interactionArray[i] == interaction) then iIndex = i --- 30,34 ---- -- Search for the Interaction iIndex = -1; ! for i = 1, #interactionArray do if (interactionArray[i] == interaction) then iIndex = i *************** *** 57,61 **** --end ! if (table.getn(interactionArray) == 0) then m_message("Attempt to setFocusTo with an empty interactions array."); return --- 57,61 ---- --end ! if (#interactionArray) == 0 then m_message("Attempt to setFocusTo with an empty interactions array."); return *************** *** 64,68 **** -- Search for the Interaction iIndex = -1; ! for i = 1, table.getn(interactionArray) do if (interactionArray[i] == interaction) then iIndex = i --- 64,68 ---- -- Search for the Interaction iIndex = -1; ! for i = 1, #interactionArray do if (interactionArray[i] == interaction) then iIndex = i *************** *** 96,100 **** local ia = self.globalInteractions ! for i = 1, table.getn(ia) do if (ia[i].bRequiresTick) then ia[i]:tick() --- 96,100 ---- local ia = self.globalInteractions ! for i = 1, #ia do if (ia[i].bRequiresTick) then ia[i]:tick() *************** *** 106,110 **** local ia = self.globalInteractions ! for i = 1, table.getn(ia) do if (ia[i].bVisible) then ia[i]:preRender() --- 106,110 ---- local ia = self.globalInteractions ! for i = 1, #ia do if (ia[i].bVisible) then ia[i]:preRender() *************** *** 116,120 **** local ia = self.globalInteractions ! for i = table.getn(ia), 1, -1 do if (ia[i].bVisible) then ia[i]:postRender(canvas) --- 116,120 ---- local ia = self.globalInteractions ! for i = #ia, 1, -1 do if (ia[i].bVisible) then ia[i]:postRender(canvas) *************** *** 126,130 **** local ia = self.globalInteractions ! for i = 1, table.getn(ia) do if (ia[i].bActive) then if (ia[i]:keyType(key)) then --- 126,130 ---- local ia = self.globalInteractions ! for i = 1, #ia do if (ia[i].bActive) then if (ia[i]:keyType(key)) then *************** *** 140,144 **** local ia = self.globalInteractions ! for i = 1, table.getn(ia) do ia[i]:levelChange(level) end --- 140,144 ---- local ia = self.globalInteractions ! for i = 1, #ia do ia[i]:levelChange(level) end Index: ActionController.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/ActionController.lua,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ActionController.lua 2 Jan 2004 02:49:56 -0000 1.3 --- ActionController.lua 27 Jan 2007 02:14:47 -0000 1.4 *************** *** 38,43 **** -- Execute all running actions ! for i = 1, table.getn(self.actions) do ! if (i <= table.getn(self.actions) and self.actions[i] == execEnv) then m_message("Finished executing "..self.actions[i].name .." (".. self.actions[i]._id ..")") table.remove(self.actions, i) --- 38,43 ---- -- Execute all running actions ! for i = 1, #self.actions do ! if (i <= #self.actions and self.actions[i] == execEnv) then m_message("Finished executing "..self.actions[i].name .." (".. self.actions[i]._id ..")") table.remove(self.actions, i) *************** *** 52,57 **** -- Execute all running actions ! for i = 1, table.getn(self.actions) do ! if (i <= table.getn(self.actions) and self.actions[i]:exec()) then m_message("Finished executing "..self.actions[i].name .." (".. self.actions[i]._id ..")") table.remove(self.actions, i) --- 52,57 ---- -- Execute all running actions ! for i = 1, #self.actions do ! if (i <= #self.actions and self.actions[i]:exec()) then m_message("Finished executing "..self.actions[i].name .." (".. self.actions[i]._id ..")") table.remove(self.actions, i) Index: Game.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/Game.lua,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Game.lua 2 Jan 2004 02:49:56 -0000 1.10 --- Game.lua 27 Jan 2007 02:14:47 -0000 1.11 *************** *** 187,191 **** end ! local n = table.getn(conversation) convBox.lines = {} convBox.lines_todo = {} --- 187,191 ---- end ! local n = #conversation convBox.lines = {} convBox.lines_todo = {} Index: ConversationWindow.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/ConversationWindow.lua,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ConversationWindow.lua 25 Apr 2004 16:39:52 -0000 1.6 --- ConversationWindow.lua 27 Jan 2007 02:14:47 -0000 1.7 *************** *** 25,29 **** detokenize = function(tokens) ! token_cnt = table.getn(tokens) if (token_cnt > 0) then --- 25,29 ---- detokenize = function(tokens) ! token_cnt = #tokens if (token_cnt > 0) then *************** *** 89,94 **** return ! elseif (self.state == CB_READY and table.getn(self.lines_todo) > 0) then ! if (table.getn(self.lines) < self.nr_lines) then -- There is space, start writing the line. --- 89,94 ---- return ! elseif (self.state == CB_READY and #self.lines_todo > 0) then ! if (#self.lines < self.nr_lines) then -- There is space, start writing the line. *************** *** 100,104 **** table.remove(tokens, 1) ! while (table.getn(tokens) > 0 and m_text_size(new_line.." "..tokens[1]) < self.w) do new_line = new_line.." "..tokens[1] table.remove(tokens, 1) --- 100,104 ---- table.remove(tokens, 1) ! while (#tokens > 0 and m_text_size(new_line.." "..tokens[1]) < self.w) do new_line = new_line.." "..tokens[1] table.remove(tokens, 1) *************** *** 107,111 **** -- Continue indicates if writing should continue after this line -- or if it should show a blinking square (end of sentence) ! if (table.getn(tokens) > 0) then self.continue = 1 self.lines_todo[1] = detokenize(tokens) --- 107,111 ---- -- Continue indicates if writing should continue after this line -- or if it should show a blinking square (end of sentence) ! if (#tokens > 0) then self.continue = 1 self.lines_todo[1] = detokenize(tokens) *************** *** 154,158 **** elseif (self.state == CB_WRITING) then ! local current_string = self.lines[table.getn(self.lines)] local length = string.len(current_string) --- 154,158 ---- elseif (self.state == CB_WRITING) then ! local current_string = self.lines[#self.lines] local length = string.len(current_string) *************** *** 220,227 **** -- Draw the shadow of the text m_set_clip(self.x, self.y, self.x + self.w - 1, self.y + self.h - 1) ! for n = 1, table.getn(self.lines) do m_set_color(0, 0, 0) m_set_cursor(self.x + 1, self.y + (n - 1) * self.line_height - self.scroll + 1) ! if (n == table.getn(self.lines)) then m_draw_text(string.sub(self.lines[n], 1, self.curr_char)) else --- 220,227 ---- -- Draw the shadow of the text m_set_clip(self.x, self.y, self.x + self.w - 1, self.y + self.h - 1) ! for n = 1, #self.lines do m_set_color(0, 0, 0) m_set_cursor(self.x + 1, self.y + (n - 1) * self.line_height - self.scroll + 1) ! if (n == #self.lines) then m_draw_text(string.sub(self.lines[n], 1, self.curr_char)) else *************** *** 251,258 **** -- Draw the lines of text m_set_clip(self.x, self.y, self.x + self.w - 1, self.y + self.h - 1) ! for n = 1, table.getn(self.lines) do m_set_color(guiTheme:getTextColor()) m_set_cursor(self.x, self.y + (n - 1) * self.line_height - self.scroll) ! if (n == table.getn(self.lines)) then m_draw_text(string.sub(self.lines[n], 1, self.curr_char)) else --- 251,258 ---- -- Draw the lines of text m_set_clip(self.x, self.y, self.x + self.w - 1, self.y + self.h - 1) ! for n = 1, #self.lines do m_set_color(guiTheme:getTextColor()) m_set_cursor(self.x, self.y + (n - 1) * self.line_height - self.scroll) ! if (n == #self.lines) then m_draw_text(string.sub(self.lines[n], 1, self.curr_char)) else Index: Pawn.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/Pawn.lua,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Pawn.lua 13 Jan 2004 16:32:35 -0000 1.11 --- Pawn.lua 27 Jan 2007 02:14:47 -0000 1.12 *************** *** 58,63 **** -- A scream perhaps? ! if (table.getn(self.hitSounds) > 0) then ! local sampleFile = self.hitSounds[math.random(table.getn(self.hitSounds))] m_play_sample(sampleFile) end --- 58,63 ---- -- A scream perhaps? ! if (#self.hitSounds > 0) then ! local sampleFile = self.hitSounds[math.random(#self.hitSounds)] m_play_sample(sampleFile) end Index: MessPile.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/MessPile.lua,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** MessPile.lua 13 Jan 2004 16:32:35 -0000 1.10 --- MessPile.lua 27 Jan 2007 02:14:47 -0000 1.11 *************** *** 27,31 **** activatedBy = function(self, obj) if (self.containsEngines) then ! if (table.getn(obj.inventory) >= 3) then ActionController:addSequence{ ActionConversation(lang:getConv("InventoryFullAtRockets")), --- 27,31 ---- activatedBy = function(self, obj) if (self.containsEngines) then ! if (#obj.inventory >= 3) then ActionController:addSequence{ ActionConversation(lang:getConv("InventoryFullAtRockets")), Index: PlayerController.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/PlayerController.lua,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PlayerController.lua 31 Dec 2003 17:05:55 -0000 1.6 --- PlayerController.lua 27 Jan 2007 02:14:47 -0000 1.7 *************** *** 40,44 **** local i = 1 ! while (i <= table.getn(objs) and not activated) do if (objs[i].bCanActivate) then -- By returning true, an object can indicate nothing else should be activated --- 40,44 ---- local i = 1 ! while (i <= #objs and not activated) do if (objs[i].bCanActivate) then -- By returning true, an object can indicate nothing else should be activated Index: Action.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/Action.lua,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Action.lua 3 Jan 2004 00:16:32 -0000 1.9 --- Action.lua 27 Jan 2007 02:14:47 -0000 1.10 *************** *** 63,70 **** init = function(self, seq) ! m_message("ActionSequence initializing with ".. table.getn(seq) .." actions.") self.actions = {} ! for i = 1, table.getn(seq) do local env = {} setmetatable(env, {__index = seq[i]}) --- 63,70 ---- init = function(self, seq) ! m_message("ActionSequence initializing with ".. #seq .." actions.") self.actions = {} ! for i = 1, #seq do local env = {} setmetatable(env, {__index = seq[i]}) *************** *** 76,85 **** exec = function(self) ! while (self.i <= table.getn(self.actions) and self.actions[self.i]:exec()) do m_message("ActionSequence finished executing ".. self.actions[self.i].name) self.i = self.i + 1 end ! return (self.i > table.getn(self.actions)) end; } --- 76,85 ---- exec = function(self) ! while (self.i <= #self.actions and self.actions[self.i]:exec()) do m_message("ActionSequence finished executing ".. self.actions[self.i].name) self.i = self.i + 1 end ! return (self.i > #self.actions) end; } *************** *** 90,99 **** init = function(self, actions) ! m_message("ActionParallel initializing with ".. table.getn(actions) .." actions.") self.actions = {} -- Add all actions to the list of actions to execute. local i ! for i = 1, table.getn(actions) do if (actions[i] and actions[i]:instanceOf(Action)) then -- Create an action execution environment for this action --- 90,99 ---- init = function(self, actions) ! m_message("ActionParallel initializing with ".. #actions .." actions.") self.actions = {} -- Add all actions to the list of actions to execute. local i ! for i = 1, #actions do if (actions[i] and actions[i]:instanceOf(Action)) then -- Create an action execution environment for this action *************** *** 113,118 **** -- Execute all running actions ! for i = 1, table.getn(self.actions) do ! if (i <= table.getn(self.actions) and self.actions[i]:exec()) then m_message("ActionParallel finished executing "..self.actions[i].name) table.remove(self.actions, i) --- 113,118 ---- -- Execute all running actions ! for i = 1, #self.actions do ! if (i <= #self.actions) and self.actions[i]:exec() then m_message("ActionParallel finished executing "..self.actions[i].name) table.remove(self.actions, i) *************** *** 121,125 **** end ! return table.getn(self.actions) == 0 end; } --- 121,125 ---- end ! return #self.actions == 0 end; } *************** *** 150,154 **** init = function(self, f, ...) self.f = f ! self.arg = arg end; --- 150,154 ---- init = function(self, f, ...) self.f = f ! self.arg = {...} end; *************** *** 298,302 **** self.actions = {} ! for w in string.gfind(path, "[UDLR]%d*") do local dir = string.sub(w,1,1) if (dir == "U") then dir = DIR_UP end --- 298,302 ---- self.actions = {} ! for w in string.gmatch(path, "[UDLR]%d*") do local dir = string.sub(w,1,1) if (dir == "U") then dir = DIR_UP end *************** *** 349,353 **** table.insert(exModeArray, m_get_ex_mode()) m_set_ex_mode(1) ! --m_message("Exclusive mode turned on (".. table.getn(exModeArray) ..")") return true end; --- 349,353 ---- table.insert(exModeArray, m_get_ex_mode()) m_set_ex_mode(1) ! --m_message("Exclusive mode turned on (".. #exModeArray) ..")") return true end; *************** *** 359,366 **** exec = function(self) ! if (table.getn(exModeArray) > 0) then ! m_set_ex_mode(exModeArray[table.getn(exModeArray)]) ! table.remove(exModeArray, table.getn(exModeArray)) ! --m_message("Exclusive mode turned off (".. table.getn(exModeArray) ..")") else m_set_ex_mode(0) --- 359,366 ---- exec = function(self) ! if (#exModeArray > 0) then ! m_set_ex_mode(exModeArray[#exModeArray]) ! table.remove(exModeArray, #exModeArray) ! --m_message("Exclusive mode turned off (".. #exModeArray) ..")") else m_set_ex_mode(0) Index: ElecDoor.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/ElecDoor.lua,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ElecDoor.lua 13 Jan 2004 16:32:35 -0000 1.9 --- ElecDoor.lua 27 Jan 2007 02:14:47 -0000 1.10 *************** *** 26,30 **** if (self.closeTimer <= 0) then self.closeTimer = 1 ! if (table.getn(m_get_objects_at(self.x + 0.5, self.y - 0.5, self.map)) == 1) then self.closeTimer = 0 self.toStatus = 0 --- 26,30 ---- if (self.closeTimer <= 0) then self.closeTimer = 1 ! if (#m_get_objects_at(self.x + 0.5, self.y - 0.5, self.map) == 1) then self.closeTimer = 0 self.toStatus = 0 *************** *** 55,59 **** updateBitmap = function(self) local s = math.sin(self.status * 0.5 * math.pi) ! local bi = (table.getn(self.bitmaps) - 1) * s + 1 self.bitmap = self.bitmaps[math.ceil(bi - 0.5)] --- 55,59 ---- updateBitmap = function(self) local s = math.sin(self.status * 0.5 * math.pi) ! local bi = (#self.bitmaps - 1) * s + 1 self.bitmap = self.bitmaps[math.ceil(bi - 0.5)] Index: PlayerSwitcher.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/PlayerSwitcher.lua,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PlayerSwitcher.lua 3 Jan 2004 18:50:44 -0000 1.7 --- PlayerSwitcher.lua 27 Jan 2007 02:14:47 -0000 1.8 *************** *** 47,55 **** table.remove(self.playerHosts, iIndex) if (iIndex == self.currentHost) then ! if (self.currentHost > table.getn(self.playerHosts)) then self.currentHost = 1 end ! if (table.getn(self.playerHosts) > 0) then self:selectPlayerHost(self.playerHosts[self.currentHost]) else --- 47,55 ---- table.remove(self.playerHosts, iIndex) if (iIndex == self.currentHost) then ! if (self.currentHost > #self.playerHosts) then self.currentHost = 1 end ! if #self.playerHosts > 0 then self:selectPlayerHost(self.playerHosts[self.currentHost]) else *************** *** 84,88 **** -- Search for the Interaction iIndex = -1; ! for i = 1, table.getn(self.playerHosts) do if (self.playerHosts[i] == playerHost) then iIndex = i --- 84,88 ---- -- Search for the Interaction iIndex = -1; ! for i = 1, #self.playerHosts do if (self.playerHosts[i] == playerHost) then iIndex = i *************** *** 94,98 **** keyType = function(self, key) ! if (key == "tab" and table.getn(self.playerHosts) > 0 and m_get_ex_mode() == 0) then local prevHost = self:getCurrentHost() --- 94,98 ---- keyType = function(self, key) ! if (key == "tab" and #self.playerHosts > 0 and m_get_ex_mode() == 0) then local prevHost = self:getCurrentHost() *************** *** 100,108 **** self.currentHost = self.currentHost - 1 if (self.currentHost < 1) then ! self.currentHost = table.getn(self.playerHosts) end else self.currentHost = self.currentHost + 1 ! if (self.currentHost > table.getn(self.playerHosts)) then self.currentHost = 1 end --- 100,108 ---- self.currentHost = self.currentHost - 1 if (self.currentHost < 1) then ! self.currentHost = #self.playerHosts end else self.currentHost = self.currentHost + 1 ! if (self.currentHost > #self.playerHosts) then self.currentHost = 1 end *************** *** 152,156 **** -- and highlight the selected player ! for i = 1, table.getn(self.playerHosts) do local player = self.playerHosts[i] local health_perc = player.health / player.maxHealth --- 152,156 ---- -- and highlight the selected player ! for i = 1, #self.playerHosts do local player = self.playerHosts[i] local health_perc = player.health / player.maxHealth *************** *** 160,164 **** local invHeight = 19 ! if (table.getn(player.inventory) == 0) then invHeight = 0 end --- 160,164 ---- local invHeight = 19 ! if (#player.inventory) == 0 then invHeight = 0 end Index: Player.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/Player.lua,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Player.lua 13 Jan 2004 16:32:35 -0000 1.12 --- Player.lua 27 Jan 2007 02:14:47 -0000 1.13 *************** *** 49,53 **** if (self.dir == DIR_DOWN) then ay = ay + 1 end local attacked_objs = m_get_objects_at(ax, ay, self.map) ! for index, object in attacked_objs do if (object:instanceOf(Actor)) then local damage = (self.attack_min_dam + math.random(self.attack_max_dam - self.attack_min_dam))*(self.strength/95 + 18/19) --- 49,53 ---- if (self.dir == DIR_DOWN) then ay = ay + 1 end local attacked_objs = m_get_objects_at(ax, ay, self.map) ! for index, object in ipairs(attacked_objs) do if (object:instanceOf(Actor)) then local damage = (self.attack_min_dam + math.random(self.attack_max_dam - self.attack_min_dam))*(self.strength/95 + 18/19) Index: Animation.lua =================================================================== RCS file: /cvsroot/moeng/BBRpg/data/scripts/Animation.lua,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Animation.lua 25 Dec 2003 20:50:41 -0000 1.2 --- Animation.lua 27 Jan 2007 02:14:47 -0000 1.3 *************** *** 15,19 **** init = function(self, animation) self.animSeq = animation ! self.animLength = table.getn(animation) end; --- 15,19 ---- init = function(self, animation) self.animSeq = animation ! self.animLength = #animation end; *************** *** 103,109 **** update_bitmap = function(self) ! local nr = table.getn(self.animation) ! if (self.animation and table.getn(self.animation) > 0) then self.bitmap = self.animation[self.animation_count] end --- 103,109 ---- update_bitmap = function(self) ! local nr = #self.animation ! if (self.animation and #self.animation > 0) then self.bitmap = self.animation[self.animation_count] end *************** *** 152,156 **** update_bitmap = function(self) if (self.animation) then ! local nr = table.getn(self.animation) if (nr == 1) then self.bitmap = self.animation[1] --- 152,156 ---- update_bitmap = function(self) if (self.animation) then ! local nr = #self.animation if (nr == 1) then self.bitmap = self.animation[1] *************** *** 197,206 **** update_bitmap = function(self) ! if (self.animation and table.getn(self.animation) > 0) then ! while (self.animation and table.getn(self.animation) > 0 and self.frame_count > self.animation[self.animation_count][2]) do self.frame_count = self.frame_count - self.animation[self.animation_count][2] self.animation_count = self.animation_count + 1 ! if (self.animation_count > table.getn(self.animation)) then self.animation_count = 1 --- 197,206 ---- update_bitmap = function(self) ! if (self.animation and #self.animation > 0) then ! while (self.animation and #self.animation > 0 and self.frame_count > self.animation[self.animation_count][2]) do self.frame_count = self.frame_count - self.animation[self.animation_count][2] self.animation_count = self.animation_count + 1 ! if (self.animation_count > #self.animation) then self.animation_count = 1 *************** *** 211,215 **** end ! if (self.animation and table.getn(self.animation) > 0) then self.bitmap = self.animation[self.animation_count][1] end --- 211,215 ---- end ! if (self.animation and #self.animation > 0) then self.bitmap = self.animation[self.animation_count][1] end |