ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Wed Jun 20, 2018 4:09 am

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Mon Feb 20, 2012 12:43 am 
Offline
Loremaster

Joined: Thu Sep 23, 2010 10:18 pm
Posts: 3516
Location: London, England
Currently one cannot have background colours on tiles without having transparency enabled. I'm not sure why but it's quite annoying... ASCII just looks silly with transparency, but it can look very bland without background colours. Can this be changed? (And rather soon...?)

_________________
http://www.gamesofgrey.com - My own T-Engine games!
Roguelike Radio - A podcast about roguelikes


Top
 Profile  
 
PostPosted: Mon Feb 20, 2012 1:29 am 
Offline
Master of Eyal

Joined: Wed Jul 24, 2002 9:26 pm
Posts: 10228
Location: Angolwen
I .. I have no idea what you are asking, got an example of what you'd like ?

_________________
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)


Top
 Profile  
 
PostPosted: Mon Feb 20, 2012 2:14 am 
Offline
Loremaster

Joined: Thu Sep 23, 2010 10:18 pm
Posts: 3516
Location: London, England
Unless I understand incorrectly the way to turn off transparency is to set "Map.tiles.force_back_color". But using that prevents the use of background colours on tiles (well, allows only one colour). Am I incorrect?

Edit: Also turning this on seems to block particle effects from squares with actors on them - bug?

_________________
http://www.gamesofgrey.com - My own T-Engine games!
Roguelike Radio - A podcast about roguelikes


Top
 Profile  
 
PostPosted: Mon Feb 20, 2012 8:18 am 
Offline
Master of Eyal

Joined: Wed Jul 24, 2002 9:26 pm
Posts: 10228
Location: Angolwen
If you have setup your map to allow for back colors (like the example module does) you can set a non-transparent color on any entities by setting
Code:
back_color=colors.FOO

in the entity's definition

_________________
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)


Top
 Profile  
 
PostPosted: Sun Mar 11, 2012 4:29 pm 
Offline
Loremaster

Joined: Thu Sep 23, 2010 10:18 pm
Posts: 3516
Location: London, England
Just to repeat, this doesn't seem to work unless you have transparency enabled. As I understand it you need Map.tiles.force_back_color defined to stop the ASCII on top of ASCII look, but that prevents the game from reading any back_color definitions for tiles. If I comment out Map.tiles.force_back_color then the background colours work, but I'm stuck with ASCII on top of ASCII again.

_________________
http://www.gamesofgrey.com - My own T-Engine games!
Roguelike Radio - A podcast about roguelikes


Top
 Profile  
 
PostPosted: Mon Mar 12, 2012 7:12 pm 
Offline
Master of Eyal

Joined: Wed Jul 24, 2002 9:26 pm
Posts: 10228
Location: Angolwen
Show me your code please it should work

_________________
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)


Top
 Profile  
 
PostPosted: Mon Mar 12, 2012 8:11 pm 
Offline
Loremaster

Joined: Thu Sep 23, 2010 10:18 pm
Posts: 3516
Location: London, England
Here ya go:

https://sites.google.com/site/darrenjoh ... ects=0&d=1

(there's been some changes since then, but it has the coloured backgrounds and force_back_colour turned off - if I make a symbol on the floor grids then you get that horrible ASCII on ASCII look)

_________________
http://www.gamesofgrey.com - My own T-Engine games!
Roguelike Radio - A podcast about roguelikes


Top
 Profile  
 
PostPosted: Tue Mar 13, 2012 9:38 am 
Offline
Master of Eyal

Joined: Wed Jul 24, 2002 9:26 pm
Posts: 10228
Location: Angolwen
Ah I think I understand what you want:
Show the background color of the grid tile & its ascii symbol.
But when the player walks over it show the background color of the GRID and the ascii of the PLAYER.
Right ?

Then you have to change how the engine sends map info to the core to be displayed. Luckily I already thought about that :)
In your load.lua you want to add:
Code:
local Map = require "engine.Map"
Map.updateMapDisplay = function (self, x, y, mos)
   local g = self(x, y, self.TERRAIN)
   local gb = nil
   local o = self(x, y, self.OBJECT)
   local a = self(x, y, self.ACTOR)
   local t = self(x, y, self.TRAP)
   local p = self(x, y, self.PROJECTILE)
   if g then
      -- Update path caches from path strings
      for i = 1, #self.path_strings do
         local ps = self.path_strings[i]
         self._fovcache.path_caches[ps]:set(x, y, g:check("block_move", x, y, ps, false, true))
      end

      g:getMapObjects(self.tiles, mos, 1)
      g:setupMinimapInfo(g._mo, self)
      if g.default_tile then gb = g.default_tile end
   end
   if t then
      -- Handles trap being known
      if not self.actor_player or t:knownBy(self.actor_player) then
         t:getMapObjects(self.tiles, mos, 3)
         t:setupMinimapInfo(t._mo, self)
      else
         t = nil
      end
   end
   if o then
      o:getMapObjects(self.tiles, mos, 3)
      o:setupMinimapInfo(o._mo, self)
      if self.object_stack_count then
         local mo = o:getMapStackMO(self, x, y)
         if mo then mos[5] = mo end
      end
   end
   if a then
      -- Handles invisibility and telepathy and other such things
      if not self.actor_player or self.actor_player:canSee(a) then
         a:getMapObjects(self.tiles, mos, 3)
         a:setupMinimapInfo(a._mo, self)
      end
   end
   if p then
      p:getMapObjects(self.tiles, mos, 3)
      p:setupMinimapInfo(p._mo, self)
   end

   if gb and not p and not a and not o and not t then
      gb:getMapObjects(self.tiles, mos, 3)
   end
end


This will modify the display code to work nearly exactluy the same as before except it will place everything but the terrain on the same Z layer, so the display will show in order either: projectiles, actors, objects or traps.
It also checks for a "default_tile" property on the terrain and dislpays it if no projectiles, actors, objects or traps are found.

This means taht if you change your grids.lua to:
Code:
newEntity{
   define_as = "DOWN",
   name = "next level",
   default_tile=class.new{_noalpha=false, display = '>', color_r=130, color_g=255, color_b=30}, display='', back_color=colors.SLATE,
   notice = true,
   always_remember = true,
   change_level = 1,
}

newEntity{
   define_as = "FLOOR",
   name = "floor",
   default_tile=class.new{_noalpha=false, display = ' ', color_r=185, color_g=185, color_b=245}, display='', back_color=colors.SLATE,
   always_remember = true,
}

newEntity{
   define_as = "WALL",
   name = "wall",
   default_tile=class.new{_noalpha=false, display = '#', color_r=165, color_g=165, color_b=205}, display='', back_color=colors.DARK_SLATE_GRAY,
   always_remember = true,
   does_block_move = true,
   can_pass = {pass_wall=1},
   block_sight = true,
   air_level = -20,
   dig = "FLOOR",
}

newEntity{
   define_as = "DOWN2",
   name = "next level",
   default_tile=class.new{_noalpha=false, display = '>', color_r=230, color_g=100, color_b=100}, display='', back_color=colors.SLATE,
   notice = true,
   always_remember = true,
   change_level = 1,
   change_zone = "dungeon2",
}


It'll do what you want :)

Basically this grids.lua file defines the same grids you did but only gives them a backcolor. The ascii symbol is set in the default_tile. This way the ascii symbol is only shown if nothing is over the terrain.

_________________
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)


Top
 Profile  
 
PostPosted: Tue Mar 13, 2012 1:04 pm 
Offline
Loremaster

Joined: Thu Sep 23, 2010 10:18 pm
Posts: 3516
Location: London, England
Ah, brilliant! Sorry it took so long to make clear what I wanted - guess I should have been clearer.

Solution is a bit longer than I expected (most cool stuff in the T-Engine only takes 1 line :P) but I'll get it copied in. Thankfully don't have many grids set up yet to change.

_________________
http://www.gamesofgrey.com - My own T-Engine games!
Roguelike Radio - A podcast about roguelikes


Top
 Profile  
 
PostPosted: Tue Mar 13, 2012 2:23 pm 
Offline
Master of Eyal

Joined: Wed Jul 24, 2002 9:26 pm
Posts: 10228
Location: Angolwen
Hehe :!)

_________________
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group