diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index a147ec61daf7c7bb513da8b6627a4a35d8fa677b..844a95f4177f0f38d9a7cdeefc1171835a9725a1 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -348,6 +348,8 @@ function _M:act() if self.on_act then self:on_act() end + if self.never_act then return false end + return true end diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index 2c8b8b3dcb04711032a37cc746f7e12d0f98b9fb..e518c67bc17b43b9c388153fdad8c03ff4836791 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -762,8 +762,7 @@ function _M:setupCommands() self.nicer_tiles:replaceAll(self.level) end end, [{"_g","ctrl"}] = function() if config.settings.cheat then --- self.nicer_tiles:postProcessLevelTiles(self.level) - game.level.map:particleEmitter(self.player.x, self.player.y, 1, "breath_fire_navier") + self.nicer_tiles:postProcessLevelTiles(self.level) end end, } diff --git a/game/modules/tome/data/autolevel_schemes.lua b/game/modules/tome/data/autolevel_schemes.lua index 6801ffeb54372b32c288a59f21715a4d4778c603..86ad1a62e5d7ceb6921a977bd4bfa4d426a60238 100644 --- a/game/modules/tome/data/autolevel_schemes.lua +++ b/game/modules/tome/data/autolevel_schemes.lua @@ -54,6 +54,10 @@ Autolevel:registerScheme{ name = "warriormage", levelup = function(self) self:learnStats{ self.STAT_MAG, self.STAT_MAG, self.STAT_WIL, self.STAT_STR, self.STAT_STR, self.STAT_DEX } end} +Autolevel:registerScheme{ name = "roguemage", levelup = function(self) + self:learnStats{ self.STAT_CUN, self.STAT_DEX, self.STAT_CUN, self.STAT_MAG } +end} + Autolevel:registerScheme{ name = "dexmage", levelup = function(self) self:learnStats{ self.STAT_MAG, self.STAT_MAG, self.STAT_DEX, self.STAT_DEX } end} diff --git a/game/modules/tome/data/birth/races/yeek.lua b/game/modules/tome/data/birth/races/yeek.lua index 3e58512e641eafbf7a02702ab06638e6c317f425..8133d5e207bb747c5df2464b2d189ddda3ca4aa1 100644 --- a/game/modules/tome/data/birth/races/yeek.lua +++ b/game/modules/tome/data/birth/races/yeek.lua @@ -67,15 +67,17 @@ newBirthDescriptor "#GOLD#Stat modifiers:", "#LIGHT_BLUE# * -3 Strength, -2 Dexterity, -5 Constitution", "#LIGHT_BLUE# * +0 Magic, +6 Willpower, +4 Cunning", - "#GOLD#Life per level:#LIGHT_BLUE# 8", + "#GOLD#Life per level:#LIGHT_BLUE# 7", "#GOLD#Experience penalty:#LIGHT_BLUE# -15%", + "#GOLD#Confusion resistance:#LIGHT_BLUE# 35%", }, inc_stats = { str=-3, con=-5, cun=4, wil=6, mag=0, dex=-2 }, talents = { [ActorTalents.T_YEEK_WILL]=1, }, copy = { - life_rating=8, + life_rating=7, + confusion_immune = 0.35, max_air = 200, }, experience = 0.85, diff --git a/game/modules/tome/data/chats/yeek-wayist.lua b/game/modules/tome/data/chats/yeek-wayist.lua new file mode 100644 index 0000000000000000000000000000000000000000..9fa02f6f884fae2c3acff5c93776e8c251af6841 --- /dev/null +++ b/game/modules/tome/data/chats/yeek-wayist.lua @@ -0,0 +1,69 @@ +-- ToME - Tales of Maj'Eyal +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +newChat{ id="welcome", + text = [[#LIGHT_GREEN#*Before you stands a creature about as tall as a halfling, covered in small white fur and with a disproportionate head. +You also notice he does not wield its greatsword, it seems to float in the air - bound to his will.*#WHITE# +Why did you save me stranger? You are not of the Way.]], + answers = { + {"So I could rip your throat myself!", action=function(npc, player) npc:checkAngered(player, false, -200) end}, + {"Well, you seemed to need help.", jump="kindness"}, + } +} + +newChat{ id="kindness", + text = [[#LIGHT_GREEN#*The greatsword floats to a less aggresive stance. He seems surprised.*#WHITE# +Then, on behalf of the Way, I thank you.]], + answers = { + {"What is the way, and what are you?", jump="what"}, + } +} + +newChat{ id="what", + text = [[The Way is enlightenment, peace and protection. I am a Yeek, I come through this tunnel to explore this part of the world that was closed to us for centuries.]], + answers = { + {"Can you tell me more about the way?", jump="way", action=function(npc, player) + player.combat_mentalresist = player.combat_mentalresist + 15 + player:attr("confusion_immune", 0.10) + game.logPlayer(player, "The contact with the Wayist mind has improved your mental shields. (+15 mental save, +10%% confusion resistance)") + end}, + {"So you will wander the land alone?", jump="done"}, + } +} + +newChat{ id="done", + text = [[I am never alone, I have the Way.]], + answers = { + {"Farewell then.", action=function(npc, player) npc:disappear() end}, + } +} + +newChat{ id="way", + text = [[I can not, but I may show you a glimpse. +#LIGHT_GREEN#*He leans toward you. Your mind is suddenly filled with feelings of peace and happiness.*#WHITE# +This is the way.]], + answers = { + {"Thank you for this vision. Farewell my friend.", action=function(npc, player) + npc:disappear() + game:setAllowedBuild("yeek", true) + end}, + } +} + +return "welcome" diff --git a/game/modules/tome/data/general/objects/boss-artifacts.lua b/game/modules/tome/data/general/objects/boss-artifacts.lua index 2f91b0b9ddc3b20026c269887020f41a3ec95e81..ced3f9fd5f1431472faa3a9e7f31a0e1c4adc6ac 100644 --- a/game/modules/tome/data/general/objects/boss-artifacts.lua +++ b/game/modules/tome/data/general/objects/boss-artifacts.lua @@ -229,6 +229,31 @@ newEntity{ base = "BASE_RING", }, } +newEntity{ base = "BASE_RING", + define_as = "NIGHT_SONG", rarity=false, + name = "Nightsong", unique=true, image="object/artifact/nightsong.png", + desc = [[A pitch black ring, unadorned. It seems as though tendrils of darkness crept upon it.]], + unided_name = "obsidian ring", + level_range = {15, 23}, + rarity = 250, + cost = 500, + material_level = 4, + wielder = { + max_stamina = 25, + combat_def = 6, + fatigue = -7, + inc_stats = { [Stats.STAT_CUN] = 6 }, + combat_mentalresist = 13, + talent_cd_reduction={ + [Talents.T_SHADOWSTEP]=1, + }, + inc_damage={ [DamageType.PHYSICAL] = 5, }, + }, + + max_power = 50, power_regen = 1, + use_talent = { id = Talents.T_DARK_TENDRILS, level=2, power = 40 }, +} + newEntity{ base = "BASE_HELM", define_as = "HELM_OF_GARKUL", unided_name = "tribal helm", diff --git a/game/modules/tome/data/general/objects/world-artifacts.lua b/game/modules/tome/data/general/objects/world-artifacts.lua index 50d164a7a301a0aeadb9342026cb7622462a2d28..0bdc904611932721858e0990e990ef43fe3ab552 100644 --- a/game/modules/tome/data/general/objects/world-artifacts.lua +++ b/game/modules/tome/data/general/objects/world-artifacts.lua @@ -685,7 +685,7 @@ local activate_pair = function(moon, star, who) star.paired._special1 = {who, "lite", who:addTemporaryValue("lite", 1)} star.paired._special2 = {star, "combat", star:addTemporaryValue("combat", {melee_project={[DamageType.RANDOM_BLINDPHYSICAL]=3}})} star.paired._special3 = {who, "inc_damage", who:addTemporaryValue("inc_damage", {[DamageType.LIGHT]=10}) } - game.log("The two blades glow brightly as they are brought close together.") + game.logPlayer(who, "The two blades glow brightly as they are brought close together.") end local deactivate_pair = function(moon, star, who) @@ -698,7 +698,7 @@ local deactivate_pair = function(moon, star, who) end moon.paired = nil star.paired = nil - game.log("The light from the two blades fades as they are separated.") + game.logPlayer(who, "The light from the two blades fades as they are separated.") end newEntity{ base = "BASE_KNIFE", define_as = "ART_PAIR_MOON", diff --git a/game/modules/tome/data/gfx/particles/breath_fire_navier.lua b/game/modules/tome/data/gfx/particles/breath_fire_navier.lua index 7c816a6c06dafda05a16115a10e465f66b6ce7b9..4d042532b0ada10a389370859360e9423fc79ffb 100644 --- a/game/modules/tome/data/gfx/particles/breath_fire_navier.lua +++ b/game/modules/tome/data/gfx/particles/breath_fire_navier.lua @@ -24,7 +24,7 @@ generator = function() if nb < 10 then nb = nb + 1 return { ---[[ + { sx = 3, sy = 29, dx = 3, dy = -3 }, { sx = 3, sy = 30, dx = 3, dy = 0 }, { sx = 3, sy = 31, dx = 3, dy = 3 }, @@ -32,7 +32,7 @@ generator = function() { sx = 4, sy = 29, dx = 3, dy = -3 }, { sx = 4, sy = 30, dx = 3, dy = 0 }, { sx = 4, sy = 31, dx = 3, dy = 3 }, -]] +--[[ { sx = 29, sy = 29, dx = -3, dy = -3 }, { sx = 31, sy = 29, dx = 3, dy = -3 }, { sx = 29, sy = 31, dx = -3, dy = 3 }, @@ -42,6 +42,7 @@ generator = function() { sx = 30, sy = 31, dx = 0, dy = 3 }, { sx = 29, sy = 30, dx = -3, dy = 0 }, { sx = 31, sy = 30, dx = 3, dy = 0 }, +--]] } else return {} end diff --git a/game/modules/tome/data/maps/zones/halfling-ruins-last.lua b/game/modules/tome/data/maps/zones/halfling-ruins-last.lua index 2346716b2b47a03490784579b0b02eaabfc43b07..9af02369c54f49aee9e3f1cea09a26cc1c38255a 100644 --- a/game/modules/tome/data/maps/zones/halfling-ruins-last.lua +++ b/game/modules/tome/data/maps/zones/halfling-ruins-last.lua @@ -116,9 +116,9 @@ return { [[ ]], [[#########################+########################]], [[##..............................................##]], -[[#................................................#]], -[[#..............Z................Y...............>#]], -[[#................................................#]], +[[#........................Z.......................#]], +[[#...............................................>#]], +[[#........................Y.......................#]], [[##..............................................##]], [[##################################################]] } diff --git a/game/modules/tome/data/talents/divine/star-fury.lua b/game/modules/tome/data/talents/divine/star-fury.lua index d542d332203b717f0456be29fc0229dce60d8f42..1c19afb59a2690c89e24f461fb801f064dfe3689 100644 --- a/game/modules/tome/data/talents/divine/star-fury.lua +++ b/game/modules/tome/data/talents/divine/star-fury.lua @@ -86,7 +86,7 @@ newTalent{ return true end, info = function(self, t) - local damage = t.getDuration(self, t) + local damage = t.getDamage(self, t) local damageonspot = t.getDamageOnSpot(self, t) local duration = t.getDuration(self, t) return ([[Invokes a blast of shadows dealing %0.2f darkness damage and leaving a field that does %0.2f darkness damage per turn for %d turns. diff --git a/game/modules/tome/data/talents/psionic/focus.lua b/game/modules/tome/data/talents/psionic/focus.lua index 09d44cb98cb0453f2e25343f295a0c8bf036ca49..9ecb450747ff93b670ddb64ff22cfc1a56255c04 100644 --- a/game/modules/tome/data/talents/psionic/focus.lua +++ b/game/modules/tome/data/talents/psionic/focus.lua @@ -104,7 +104,7 @@ newTalent{ return self:combatTalentIntervalDamage(t, "wil", 21, 281)*(1 + 0.3*gem_level) end, action = function(self, t) - --local gem_level = getGemLevel(self) + local gem_level = getGemLevel(self) --local dam = (20 + self:getTalentLevel(t) * self:getWil(40))*(1 + 0.3*gem_level) local dam = t.getDamage(self, t) local tgts = {} diff --git a/game/modules/tome/data/texts/unlock-yeek.lua b/game/modules/tome/data/texts/unlock-yeek.lua new file mode 100644 index 0000000000000000000000000000000000000000..c708e20e459d688bff3bbb865b5452eb53ac2efa --- /dev/null +++ b/game/modules/tome/data/texts/unlock-yeek.lua @@ -0,0 +1,34 @@ +-- ToME - Tales of Maj'Eyal +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +return "New Race: #LIGHT_GREEN#Yeek", +[[ +Yeeks are a mysterious race of small humanoids native to the tropical island of Rel. +Their body is covered with white fur and their disproportionate head gives them a ridiculous look, yet they are a cunning and willful race. +Although they are now nearly unheard of in Maj'Eyal, they spent many centuries as secret slaves to the halfling nation of Nargol. +They gained their freedom during the Age of Pyre and have since then followed 'The Way' - a unity of minds enforced by their powerful psionics. + +You have helped a yeek wayist and can now create a new character with the #LIGHT_GREEN#Yeek race#WHITE#. + +Race features:#YELLOW# +- Mental domination racial power +- Confusion resistance +- Fast leveling +- Frail body#WHITE# +]] diff --git a/game/modules/tome/data/zones/crypt-kryl-feijan/npcs.lua b/game/modules/tome/data/zones/crypt-kryl-feijan/npcs.lua index 258a789c516846574024fd2af846423fcfceff30..e027c1d451cfb41b5320268d3ae276022bb98a96 100644 --- a/game/modules/tome/data/zones/crypt-kryl-feijan/npcs.lua +++ b/game/modules/tome/data/zones/crypt-kryl-feijan/npcs.lua @@ -74,7 +74,7 @@ newEntity{ define_as = "MELINDA", name = "Melinda", type = "humanoid", subtype = "human", female=true, display = "@", color=colors.LIGHT_BLUE, - desc = [[A female Human with twisted sigils scored into her naked flesh. Her wrists and ankles are sore and hurt by ropes and chains. You can discern great beauty beyond the stains of blood covering her skin.]], + desc = [[A female human with twisted sigils scored into her naked flesh. Her wrists and ankles are sore and hurt by ropes and chains. You can discern great beauty beyond the stains of blood covering her skin.]], autolevel = "tank", ai = "summoned", ai_real = "move_dmap", ai_state = { ai_target="target_player", talent_in=4, }, stats = { str=8, dex=7, mag=8, con=12 }, diff --git a/game/modules/tome/data/zones/halfling-ruins/npcs.lua b/game/modules/tome/data/zones/halfling-ruins/npcs.lua index 5cc40455c734b7f6ed6e54337ca09ecb1305c529..cec0fad62aed2d862d7f8fb282fefb435c020e42 100644 --- a/game/modules/tome/data/zones/halfling-ruins/npcs.lua +++ b/game/modules/tome/data/zones/halfling-ruins/npcs.lua @@ -23,3 +23,114 @@ load("/data/general/npcs/bone-giant.lua", rarity(8)) local Talents = require("engine.interface.ActorTalents") +newEntity{ define_as="SUBJECT_Z", + name = "Subject Z", color=colors.VIOLET, display = "p", + desc = "This seems to be the 'subject Z' the notes spoke about. He looks human, but this can not be, he would be about five thousands years old!", + type = "humanoid", subtype = "human", + level_range = {10, nil}, exp_worth = 2, + rank = 4, + autolevel = "roguemage", + max_life = 100, life_rating = 14, + combat_armor = 0, combat_def = 15, + open_door = 1, + never_act = true, + + ai = "tactical", ai_state = { talent_in=1, ai_move="move_astar", }, + + body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1, QUIVER=1, FINGER=1 }, + + see_invisible = 20, + + resolvers.equip{ + {type="weapon", subtype="dagger", autoreq=true, ego_chance=100}, + {type="weapon", subtype="dagger", autoreq=true, ego_chance=100}, + {type="armor", subtype="light", autoreq=true, ego_chance=100}, + {defined="NIGHT_SONG", random_art_replace={chance=65}, autoreq=true}, + }, + + resolvers.talents{ + [Talents.T_DUAL_WEAPON_DEFENSE]=3, + [Talents.T_DUAL_WEAPON_TRAINING]=3, + [Talents.T_FLURRY]=3, + [Talents.T_DIRTY_FIGHTING]=3, + [Talents.T_LETHALITY]=3, + [Talents.T_WEAPON_COMBAT]=2, + [Talents.T_KNIFE_MASTERY]=6, + [Talents.T_SHADOW_COMBAT]=5, + [Talents.T_SHADOWSTEP]=1, + [Talents.T_PHASE_DOOR]=3, + [Talents.T_SECOND_WIND]=4, + [Talents.T_DARK_TENDRILS]=2, + }, + resolvers.inscriptions(1, {"manasurge rune"}), + resolvers.inscriptions(1, "infusion"), + + resolvers.sustains_at_birth(), + + seen_by = function(self, who) + if not game.party:hasMember(who) then return end + self.seen_by = nil + self.never_act = nil + + local wayist = nil + for uid, e in pairs(game.level.entities) do if e.define_as == "YEEK_WAYIST" then wayist = e break end end + if not wayist then return end + wayist.never_act = nil + + wayist:setTarget(self) + self:setTarget(wayist) + wayist:doEmote("Sacrifice for the Way!", 60) + end, + + on_die = function(self, who) + local wayist = nil + for uid, e in pairs(game.level.entities) do if e.define_as == "YEEK_WAYIST" then wayist = e break end end + if not wayist then return end + + local p = game.party:findMember{main=true} + -- Yeeks really, really, really, hate halflings + if p.descriptor.race == "Halfling" then + wayist:doEmote("Halfling?! DIE!!!!!", 70) + wayist:checkAngered(p, false, -200) + else + wayist:doEmote("You.. saved me?", 70) + wayist.can_talk = "yeek-wayist" + end + end, +} + +newEntity{ define_as="YEEK_WAYIST", + name = "Yeek Wayist", color=colors.VIOLET, display = "y", + desc = "This seems to be the 'subject Z' the notes spoke about. He looks human, but this can not be, he would be about five thousands years old!", + type = "humanoid", subtype = "yeek", + level_range = {10, nil}, + rank = 3, + autolevel = "wildcaster", + max_life = 100, life_rating = 8, + faction = "the-way", + combat_armor = 0, combat_def = 0, + psi_regen = 5, + open_door = 1, + never_act = true, + + ai = "tactical", ai_state = { talent_in=1, ai_move="move_astar", }, + + body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1, PSIONIC_FOCUS=1 }, + + resolvers.equip{ + {type="weapon", subtype="greatsword", autoreq=true}, + }, + + resolvers.talents{ + [Talents.T_KINETIC_SHIELD]=3, + [Talents.T_MINDHOOK]=1, + [Talents.T_PYROKINESIS]=3, + [Talents.T_MINDLASH]=2, + [Talents.T_REACH]=4, + [Talents.T_CHARGED_AURA]=2, + [Talents.T_TELEKINETIC_SMASH]=2, + }, + resolvers.inscriptions(1, "infusion"), + + resolvers.sustains_at_birth(), +} diff --git a/ideas/DLCs.ods b/ideas/DLCs.ods index 57dfeffa4b93cb462c6cbe1a352455c3794f05ae..ea4e54edd314e4e1feb2cff486d2f0a662656cb8 100644 Binary files a/ideas/DLCs.ods and b/ideas/DLCs.ods differ diff --git a/src/particles_gas.c b/src/particles_gas.c index d0e4b36df7960cafa100378d44c05d1f89cc77a0..c010bf7cb9ec46cc6275471bb4e69a1151efd73f 100644 --- a/src/particles_gas.c +++ b/src/particles_gas.c @@ -357,15 +357,16 @@ static int gas_to_screen(lua_State *L) float zoom = luaL_checknumber(L, 5); int w = 0; int i, j, dx, dy; - bool alive = FALSE; + int vert_idx = 0, col_idx = 0; - glBindTexture(GL_TEXTURE_2D, gz->texture); - - if (gz->last_tick == -1) gz->last_tick = ((float)SDL_GetTicks()) / 1000.0f - 1; + GLfloat vertices[2*4*1000]; + GLfloat colors[4*4*1000]; + GLshort texcoords[2*4*1000]; - float now = ((float)SDL_GetTicks()) / 1000.0f; - update(gz, now - gz->last_tick); - gz->last_tick = now; + glBindTexture(GL_TEXTURE_2D, gz->texture); + glTexCoordPointer(2, GL_SHORT, 0, texcoords); + glColorPointer(4, GL_FLOAT, 0, colors); + glVertexPointer(2, GL_FLOAT, 0, vertices); for (dx=0; dx <= gz->n; dx++) { @@ -375,22 +376,55 @@ static int gas_to_screen(lua_State *L) coef = CLAMP(0.0f, 1.0f, coef); if (coef > 0.1) { - tglColor4f(coef, 0, 0, coef); - - glBegin(GL_QUADS); i = x + dx * 4; j = y + dy * 4; - glTexCoord2f(0,0); glVertex3f(0 + i, 0 + j, -97); - glTexCoord2f(1,0); glVertex3f(10 + i, 0 + j, -97); - glTexCoord2f(1,1); glVertex3f(10 + i, 10 + j, -97); - glTexCoord2f(0,1); glVertex3f(0 + i, 10 + j, -97); - glEnd(); + + vertices[vert_idx+0] = i; vertices[vert_idx+1] = j; + vertices[vert_idx+2] = i + 10; vertices[vert_idx+3] = j; + vertices[vert_idx+4] = i + 10; vertices[vert_idx+5] = j + 10; + vertices[vert_idx+6] = i; vertices[vert_idx+7] = j + 10; + + /* Setup texture coords */ + texcoords[vert_idx] = 0; texcoords[vert_idx+1] = 0; + texcoords[vert_idx+2] = 1; texcoords[vert_idx+3] = 0; + texcoords[vert_idx+4] = 1; texcoords[vert_idx+5] = 1; + texcoords[vert_idx+6] = 0; texcoords[vert_idx+7] = 1; + + /* Setup color */ + colors[col_idx] = coef; colors[col_idx+1] = 0; colors[col_idx+2] = 0; colors[col_idx+3] = coef; + colors[col_idx+4] = coef; colors[col_idx+5] = 0; colors[col_idx+6] = 0; colors[col_idx+7] = coef; + colors[col_idx+8] = coef; colors[col_idx+9] = 0; colors[col_idx+10] = 0; colors[col_idx+11] = coef; + colors[col_idx+12] = coef; colors[col_idx+13] = 0; colors[col_idx+14] = 0; colors[col_idx+15] = coef; + + /* Draw if over PARTICLES_PER_ARRAY particles */ + vert_idx += 8; + col_idx += 16; + if (vert_idx >= 2*4*1000) { + // Draw them all in one fell swoop + glDrawArrays(GL_QUADS, 0, vert_idx / 2); + vert_idx = 0; + col_idx = 0; + } } } } - // Restore normal display - tglColor4f(1, 1, 1, 1); + // Draw them all in one fell swoop + if (vert_idx) glDrawArrays(GL_QUADS, 0, vert_idx / 2); + + lua_pushboolean(L, 1); + return 1; +} + +static int gas_update(lua_State *L) +{ + gaszone_type *gz = (gaszone_type*)auxiliar_checkclass(L, "core{gas}", 1); + + if (gz->last_tick == -1) gz->last_tick = ((float)SDL_GetTicks()) / 1000.0f - 1; + + float now = ((float)SDL_GetTicks()) / 1000.0f; + update(gz, now - gz->last_tick); + gz->last_tick = now; lua_pushboolean(L, 1); return 1; @@ -407,6 +441,7 @@ static const struct luaL_reg gas_reg[] = {"__gc", gas_free}, {"close", gas_free}, {"emit", gas_emit}, + {"update", gas_update}, {"toScreen", gas_to_screen}, {NULL, NULL}, };