2023-10-15 15:12:49 -04:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2023 - Ognjen 'xolatile' Milan Robovic
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Xabina 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.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
with core , map ;
package body item is
------------------------------------------------------------------------------------------
2023-10-15 16:17:17 -04:00
procedure generate is
y : natural := 0 ;
x : natural := 0 ;
identifier : natural := 0 ;
2023-10-15 15:12:49 -04:00
begin
2023-10-15 16:17:17 -04:00
for this in map . mark
loop
y := core . randomize ( 0 , natural ( map . height ' last ) ) ;
x := core . randomize ( 0 , natural ( map . width ' last ) ) ;
identifier := core . randomize ( 0 , natural ( list ' size ) ) ;
map . variable_data ( this ) := ( integer ( y ) , integer ( x ) , core . item , identifier ) ;
end loop ;
end generate ;
2023-10-15 15:12:49 -04:00
procedure render is
symbol : character := ' ' ;
colour : character := core . colour . white ;
effect : character := core . effect . normal ;
begin
2023-10-15 16:17:17 -04:00
for this in map . mark
loop
symbol := constant_data ( list ' val ( map . variable_data ( this ) . identifier ) ) . symbol ;
colour := constant_data ( list ' val ( map . variable_data ( this ) . identifier ) ) . colour ;
effect := constant_data ( list ' val ( map . variable_data ( this ) . identifier ) ) . effect ;
core . render_character ( symbol , colour , effect , core . screen_height ( map . variable_data ( this ) . y ) , core . screen_width ( map . variable_data ( this ) . x ) ) ;
end loop ;
2023-10-15 15:12:49 -04:00
end render ;
------------------------------------------------------------------------------------------
end item ;