WME TRAVEL MENU lksxfjglk;jfsdgk;ljfsg;ljkhdfg;kljhdfsgjk;l

So far, only for barrens
This commit is contained in:
Issac332 2026-05-24 19:00:36 +03:00
parent e5e2076e41
commit da0fe12086
15 changed files with 404 additions and 47 deletions

View file

@ -64,6 +64,9 @@ module RPG
def self.windowskin(filename)
self.load_bitmap("Graphics/Windowskins/", filename)
end
#def self.minimap(zone, location)
# self.load_bitmap("Graphics/Menus/minimap/", zone + "_" + location)
#end
def self.tile(filename, tile_id, hue)
key = [filename, tile_id, hue]
if not @cache.include?(key) or @cache[key].disposed?

View file

@ -41,6 +41,7 @@ RB_METHOD(spriteInitialize){
wrapProperty(self, &s->getSrcRect(), "src_rect", RectType);
wrapProperty(self, &s->getColor(), "color", ColorType);
wrapProperty(self, &s->getTone(), "tone", ToneType);
wrapProperty(self, &s->getModulate(), "modulate", ColorType);
return self;
}
@ -49,6 +50,7 @@ DEF_PROP_OBJ_REF(Sprite, Bitmap, Bitmap, "bitmap")
DEF_PROP_OBJ_VAL(Sprite, Rect, SrcRect, "src_rect")
DEF_PROP_OBJ_VAL(Sprite, Color, Color, "color")
DEF_PROP_OBJ_VAL(Sprite, Tone, Tone, "tone")
DEF_PROP_OBJ_VAL(Sprite, Color, Modulate,"modulate")
DEF_PROP_I(Sprite, X)
DEF_PROP_I(Sprite, Y)
@ -118,6 +120,7 @@ void spriteBindingInit(){
INIT_PROP_BIND( Sprite, BlendType, "blend_type" );
INIT_PROP_BIND( Sprite, Color, "color" );
INIT_PROP_BIND( Sprite, Tone, "tone" );
INIT_PROP_BIND( Sprite, Modulate, "modulate" );
INIT_PROP_BIND( Sprite, Obscured, "obscured" );
_rb_define_method(klass, "width", spriteWidth);

View file

@ -2,9 +2,32 @@ class FastTravel
class Zone
attr_reader :name
attr_reader :maps
def initialize(name, maps)
attr_reader :locations
def initialize(name, maps, locations)
@name = name
@maps = maps
@locations = locations;
end
end
class ZoneLocations
attr_reader :x
attr_reader :y
attr_reader :niko_x
attr_reader :niko_y
attr_reader :next_top
attr_reader :next_right
attr_reader :next_bottom
attr_reader :next_left
def initialize(x, y, niko_x, niko_y, next_top, next_right, next_bottom, next_left)
@x = x
@y = y
@niko_x = niko_x
@niko_y = niko_y
@next_top = next_top
@next_right = next_right
@next_bottom = next_bottom
@next_left = next_left
end
end
@ -15,7 +38,7 @@ class FastTravel
:backalley => tr("back alley"),
:library => tr("library"),
:factory => tr("factory"),
}),
}, nil),
:red => Zone.new(tr("The Refuge"), {
:garden => tr("garden"),
:gate => tr("city gate"),
@ -24,7 +47,7 @@ class FastTravel
:cafe => tr("cafe"),
:office => tr("office"),
:obsdeck => tr("observation deck"),
}),
}, nil),
:green => Zone.new(tr("The Glen"), {
:village => tr("village"),
:ruins => tr("ruins"),
@ -34,7 +57,7 @@ class FastTravel
:courtyard => tr("courtyard"),
:research => tr("research station"),
:grave => tr("graveyard")
}),
}, nil),
:blue => Zone.new(tr("The Barrens"), {
:entrance => tr("entrance"),
:outpost => tr("outpost"),
@ -45,6 +68,17 @@ class FastTravel
:swamp => tr("shrimp swamp"),
:docks => tr("docks"),
:quarry => tr("lookout point"),
},
{
:entrance => ZoneLocations.new(-81, 22, -4, 3, :docks, :outpost, nil, nil),
:outpost => ZoneLocations.new(-52, 42, 6, -3, nil, :cliffs, nil, :entrance),
:cliffs => ZoneLocations.new(4, -3, 21, 38, :factory, :quarry, nil, :outpost),
:mineshaft => ZoneLocations.new(88, -3, 5, 0, nil, nil, nil, :quarry),
:factory => ZoneLocations.new(15, -42, 13, 2, nil, nil, :cliffs, :dorms),
:dorms => ZoneLocations.new(-46, -49, 20, 4, nil, :factory, nil, :swamp),
:swamp => ZoneLocations.new(-98, -44, 10, 7, nil, :dorms, :docks, nil),
:docks => ZoneLocations.new(-82, -9, -4, -2, :swamp, nil, :entrance, nil),
:quarry => ZoneLocations.new(52, -4, 17, -3, nil, :mineshaft, nil, :cliffs),
}),
}
end

View file

@ -1,11 +1,17 @@
class FastTravel
MARGIN = 30
TITLE_TOP_MARGIN = 32
TITLE_TOP_MARGIN = -16
TITLE_MARGIN = 100
ITEM_SPACING = 28
ACTIVE_MARGIN = MARGIN * 2 + 20
attr_accessor :legacy_ui
def initialize
@legacy_ui = false
@scale_multiplier = Graphics.height > 600 ? 3.0 : 2.0
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@bg = Sprite.new(@viewport)
@bg.bitmap = Bitmap.new(Graphics.width, Graphics.height)
@ -13,10 +19,70 @@ class FastTravel
@title = Sprite.new(@viewport)
Language.register_text_sprite(self.class.name + "_title", @title)
@title.bitmap = Bitmap.new(Graphics.width / 2, TITLE_MARGIN)
@title.bitmap.font.size = 40
@title.bitmap.font.size = 20
@title.y = TITLE_TOP_MARGIN
@title.x = MARGIN
@title.zoom_x = @title.zoom_y = 2
# WME Location name
@location_name_text = Sprite.new(@viewport)
@location_name_text.bitmap = Bitmap.new(Graphics.width, 30)
@location_name_text.y = Graphics.height - 64
@location_name_text.bitmap.font.size = 20
@location_name_text.opacity = 0
# WME Niko Icon
@niko_icon = Sprite.new(@viewport)
@niko_icon.bitmap = RPG::Cache.load_bitmap("Graphics/Menus/Minimap/", "niko_icon")
@niko_icon.zoom_x = @niko_icon.zoom_y = @scale_multiplier
@niko_icon.z = 10
@niko_icon.opacity = 0
@niko_pos_x = 0.0
@niko_pos_y = 0.0
@niko_target_pos_x = 0.0
@niko_target_pos_y = 0.0
# WME Niko arrows
arrows_bitmap = RPG::Cache.load_bitmap("Graphics/Menus/Minimap/", "small_arrows")
@arrow_top = Sprite.new(@viewport)
@arrow_top.bitmap = Bitmap.new(16, 16)
@arrow_top.bitmap.stretch_blt(Rect.new(0, 0, 16, 16), arrows_bitmap, Rect.new(0, 0, 16, 16))
@arrow_bottom = Sprite.new(@viewport)
@arrow_bottom.bitmap = Bitmap.new(16, 16)
@arrow_bottom.bitmap.stretch_blt(Rect.new(0, 0, 16, 16), arrows_bitmap, Rect.new(16, 0, 16, 16))
@arrow_left = Sprite.new(@viewport)
@arrow_left.bitmap = Bitmap.new(16, 16)
@arrow_left.bitmap.stretch_blt(Rect.new(0, 0, 16, 16), arrows_bitmap, Rect.new(32, 0, 16, 16))
@arrow_right = Sprite.new(@viewport)
@arrow_right.bitmap = Bitmap.new(16, 16)
@arrow_right.bitmap.stretch_blt(Rect.new(0, 0, 16, 16), arrows_bitmap, Rect.new(48, 0, 16, 16))
@arrow_top.zoom_x = @arrow_top.zoom_y =
@arrow_bottom.zoom_x = @arrow_bottom.zoom_y =
@arrow_left.zoom_x = @arrow_left.zoom_y =
@arrow_right.zoom_x = @arrow_right.zoom_y = @scale_multiplier
@arrow_top.opacity = @arrow_bottom.opacity =
@arrow_left.opacity = @arrow_right.opacity = 0
@arrow_top.z = @arrow_bottom.z =
@arrow_left.z = @arrow_right.z = 11
@arrows_timer = 0
@arrows_offset = 0
# WME data
@data_locations = {}
@selected_location = nil
# legacy
@data_sprites = []
#other
@viewport.z = 9998
self.visible = false
@ -26,31 +92,90 @@ class FastTravel
@transfer_player = nil
end
#WME
def update_location_name_text
if ZONES[$game_fasttravel.zone].locations == nil || @legacy_ui
return
end
@location_name_text.bitmap.clear
@location_name_text.bitmap.draw_text(0, 0, Graphics.width, 30, ZONES[$game_fasttravel.zone].maps[@selected_location], 1)
end
def set_color(location_name)
if @selected_location == location_name
@data_locations[location_name].modulate.set(255, 255, 255)
return
end
case $game_fasttravel.zone
when :blue
@data_locations[location_name].modulate.set(84, 76, 209)
when :green
@data_locations[location_name].modulate.set(63, 213, 100)
when :red, :red_ground
@data_locations[location_name].modulate.set(213, 33, 106)
end
end
def update_arrows_positions
@arrow_left.y = @arrow_right.y = @niko_icon.y
@arrow_top.x = @arrow_bottom.x = @niko_icon.x + 4 * @scale_multiplier
@arrow_top.y = @niko_icon.y - (12 + @arrows_offset) * @scale_multiplier
@arrow_bottom.y = @niko_icon.y + @niko_icon.bitmap.height + (6 + @arrows_offset) * @scale_multiplier
@arrow_left.x = @niko_icon.x - (8 + @arrows_offset) * @scale_multiplier
@arrow_right.x = @niko_icon.x + @niko_icon.bitmap.width + (7 + @arrows_offset) * @scale_multiplier
end
#Not WME
def dispose
@bg.dispose
@title.dispose
@data_sprites.each do |spr|
spr.dispose
end
#WME
@data_locations.each do |name, spr|
spr.dispose
end
@location_name_text.dispose
@niko_icon.dispose
@arrow_top.dispose
@arrow_bottom.dispose
@arrow_left.dispose
@arrow_right.dispose
#Not WME
@viewport.dispose
end
def open
self.visible = true
self.opacity = 0
#WME
if !@legacy_ui
@niko_icon.opacity = @location_name_text.opacity =
@arrow_top.opacity = @arrow_bottom.opacity =
@arrow_left.opacity = @arrow_right.opacity = 0
end
#Not WME
@fade_in = true
@data = $game_fasttravel.unlocked_maps.keys.sort
zone = ZONES[$game_fasttravel.zone]
# Set cursor to current map
@data.each_with_index do |map, i|
if $game_fasttravel.unlocked_maps[map].id == $game_map.map_id
@index = i
@selected_location = map
break
end
end
zone = ZONES[$game_fasttravel.zone]
# Create title
@title.bitmap.clear
@ -58,25 +183,85 @@ class FastTravel
# Create menu options
@data.each_with_index do |item, i|
spr = Sprite.new(@viewport)
spr.bitmap = Bitmap.new(320, ITEM_SPACING)
spr.x = MARGIN
spr.y = TITLE_MARGIN + TITLE_TOP_MARGIN + ITEM_SPACING * i
spr.opacity = 0
spr.bitmap.draw_text(0, 0, spr.bitmap.width, spr.bitmap.height, zone.maps[item])
@data_sprites << spr
if zone.locations != nil && !@legacy_ui
#WME
spr = Sprite.new(@viewport)
spr.bitmap = RPG::Cache.load_bitmap("Graphics/Menus/Minimap/", "#{$game_fasttravel.zone}_#{item}")
spr.zoom_x = spr.zoom_y = @scale_multiplier
spr.x = Graphics.width / 2 + zone.locations[item].x * @scale_multiplier
spr.y = Graphics.height / 2 + zone.locations[item].y * @scale_multiplier
spr.opacity = 0
@data_locations[item] = spr
set_color(item)
else
#Legacy
spr = Sprite.new(@viewport)
spr.bitmap = Bitmap.new(320, ITEM_SPACING)
spr.x = MARGIN
spr.y = TITLE_MARGIN + TITLE_TOP_MARGIN + ITEM_SPACING * i + 32
spr.opacity = 0
spr.bitmap.draw_text(0, 0, spr.bitmap.width, spr.bitmap.height, zone.maps[item])
@data_sprites << spr
end
end
if @legacy_ui
return
end
#WME
if @data_locations.has_key?(@selected_location)
@niko_pos_x = (zone.locations[@selected_location].x.to_f + zone.locations[@selected_location].niko_x.to_f)
@niko_pos_y = (zone.locations[@selected_location].y.to_f + zone.locations[@selected_location].niko_y.to_f)
@niko_icon.x = @niko_pos_x.to_i * @scale_multiplier + Graphics.width / 2
@niko_icon.y = @niko_pos_y.to_i * @scale_multiplier + Graphics.height / 2
end
update_location_name_text
update_arrows_positions
end
def update
zone = ZONES[$game_fasttravel.zone]
if zone.locations != nil && !@legacy_ui
@arrows_timer += 1
if @arrows_timer >= 30
@arrows_timer = 0
@arrows_offset = @arrows_offset == 1 ? 0 : 1
end
end
if @fade_in
self.opacity += 20
if zone.locations != nil && !@legacy_ui
#WME
@niko_icon.opacity += 20
@location_name_text.opacity += 20
location = zone.locations[@selected_location]
@arrow_top.opacity += @data.include?(location.next_top) ? 20 : 0
@arrow_bottom.opacity += @data.include?(location.next_bottom) ? 20 : 0
@arrow_left.opacity += @data.include?(location.next_left) ? 20 : 0
@arrow_right.opacity += @data.include?(location.next_right) ? 20 : 0
end
active_spr = nil
@data_sprites.each do |spr|
spr.opacity += 10
spr.opacity = 128 if spr.opacity > 128
active_spr = spr if !active_spr && spr.x < MARGIN * 2
end
#WME
if !@legacy_ui
@data_locations.each do |name, spr|
spr.opacity += 20
spr.opacity = 255 if spr.opacity > 255
end
end
#Not WME
if active_spr
active_spr.x += 6
active_spr.x = MARGIN * 2 if active_spr.x > MARGIN * 2
@ -88,15 +273,47 @@ class FastTravel
if @fade_out
self.opacity -= 20
if zone.locations != nil && !@legacy_ui
#WME
@niko_icon.opacity -= 20
@location_name_text.opacity -= 20
location = zone.locations[@selected_location]
@arrow_top.opacity -= @data.include?(location.next_top) ? 20 : 0
@arrow_bottom.opacity -= @data.include?(location.next_bottom) ? 20 : 0
@arrow_left.opacity -= @data.include?(location.next_left) ? 20 : 0
@arrow_right.opacity -= @data.include?(location.next_right) ? 20 : 0
end
@data_sprites.each do |spr|
spr.opacity -= 10
end
#WME
if !@legacy_ui
@data_locations.each do |name, spr|
spr.opacity -= 20
end
end
#Not WME
if self.opacity == 0
@fade_out = false
self.visible = false
@data_sprites.each do |spr|
spr.dispose
end
#WME
if !@legacy_ui
@data_locations.each do |name, spr|
spr.dispose
end
@data_locations = {}
end
#Not WME
@data_sprites = []
if @transfer_player
@ -116,6 +333,35 @@ class FastTravel
return if !self.visible
#WME noik
if zone.locations != nil && !@legacy_ui
@niko_target_pos_x = (zone.locations[@selected_location].x.to_f + zone.locations[@selected_location].niko_x.to_f)
@niko_target_pos_y = (zone.locations[@selected_location].y.to_f + zone.locations[@selected_location].niko_y.to_f)
if @data_locations.has_key?(@selected_location)
@niko_pos_x = (@niko_target_pos_x * 0.25 + @niko_pos_x * 0.75)
@niko_pos_y = (@niko_target_pos_y * 0.25 + @niko_pos_y * 0.75)
end
@niko_pos_x = (@niko_pos_x - @niko_target_pos_x).abs < 0.5 ? @niko_target_pos_x : @niko_pos_x
@niko_pos_y = (@niko_pos_y - @niko_target_pos_y).abs < 0.5 ? @niko_target_pos_y : @niko_pos_y
@niko_icon.x = @niko_pos_x.to_i * @scale_multiplier + Graphics.width / 2
@niko_icon.y = @niko_pos_y.to_i * @scale_multiplier + Graphics.height / 2
update_arrows_positions
location = zone.locations[@selected_location]
@arrow_top.opacity += @data.include?(location.next_top) ? 40 : -40
@arrow_bottom.opacity += @data.include?(location.next_bottom) ? 40 : -40
@arrow_left.opacity += @data.include?(location.next_left) ? 40 : -40
@arrow_right.opacity += @data.include?(location.next_right) ? 40 : -40
elsif !@legacy_ui
@niko_icon.opacity =
@arrow_top.opacity = @arrow_bottom.opacity =
@arrow_left.opacity = @arrow_right.opacity = 0
end
# Adjust position and visibility
@data_sprites.each_with_index do |spr, i|
if i == @index
@ -134,18 +380,67 @@ class FastTravel
end
end
if !@legacy_ui
#WME
@data_locations.each do |name, spr|
set_color(name)
end
end
if Input.trigger?(Input::UP)
@index = (@index - 1) % @data.size
$game_system.se_play($data_system.cursor_se)
if zone.locations != nil && !@legacy_ui
next_location = zone.locations[@selected_location].next_top
if @data_locations.has_key?(next_location)
@selected_location = next_location
$game_system.se_play($data_system.cursor_se)
update_location_name_text
end
else
@index = (@index - 1) % @data.size
$game_system.se_play($data_system.cursor_se)
end
end
if Input.trigger?(Input::DOWN)
@index = (@index + 1) % @data.size
$game_system.se_play($data_system.cursor_se)
if zone.locations != nil && !@legacy_ui
next_location = zone.locations[@selected_location].next_bottom
if @data_locations.has_key?(next_location)
@selected_location = next_location
$game_system.se_play($data_system.cursor_se)
update_location_name_text
end
else
@index = (@index + 1) % @data.size
$game_system.se_play($data_system.cursor_se)
end
end
if Input.trigger?(Input::LEFT)
if zone.locations != nil && !@legacy_ui
next_location = zone.locations[@selected_location].next_left
if @data_locations.has_key?(next_location)
@selected_location = next_location
$game_system.se_play($data_system.cursor_se)
update_location_name_text
end
end
end
if Input.trigger?(Input::RIGHT)
if zone.locations != nil && !@legacy_ui
next_location = zone.locations[@selected_location].next_right
if @data_locations.has_key?(next_location)
@selected_location = next_location
$game_system.se_play($data_system.cursor_se)
update_location_name_text
end
end
end
if Input.trigger?(Input::ACTION)
$game_system.se_play($data_system.decision_se)
choice = $game_fasttravel.unlocked_maps[@data[@index]]
choice = $game_fasttravel.unlocked_maps[@selected_location]
if zone.locations == nil || @legacy_ui
choice = $game_fasttravel.unlocked_maps[@data[@index]]
end
if choice.id != $game_map.map_id
@transfer_player = choice
end

View file

@ -5,7 +5,7 @@ class Window_MainMenu < Window_Selectable
# Set up menu options
@commands = Array.new
@commands << 'Travel'
@commands << 'Fast Travel'
@commands << 'Notes'
@commands << 'Settings'
@ -53,6 +53,9 @@ class Window_MainMenu < Window_Selectable
# Update item
rect = Rect.new(w * index, 0, w - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
if index == 0 && !$game_fasttravel.enabled? # 0 - Fast Travel
self.contents.font.color.set(127, 127, 127, 255)
end
self.contents.draw_text(rect, tr(@commands[index]), 1)
end
#--------------------------------------------------------------------------
@ -152,15 +155,15 @@ class Window_MainMenu < Window_Selectable
id = File.read("imstupidcheater.txt").strip.to_i
x = File.read("imstupidcheater.x").strip.to_i
y = File.read("imstupidcheater.y").strip.to_i
$game_temp.player_transferring = true
$game_temp.player_new_map_id = id
$game_temp.player_new_x = x
$game_temp.player_new_y = y
$game_temp.player_new_direction = 0
Graphics.freeze
$game_temp.transition_processing = true
$game_temp.transition_name = ""
@fade_out = true
$game_temp.player_transferring = true
$game_temp.player_new_map_id = id
$game_temp.player_new_x = x
$game_temp.player_new_y = y
$game_temp.player_new_direction = 0
Graphics.freeze
$game_temp.transition_processing = true
$game_temp.transition_name = ""
@fade_out = true
end
end
return

View file

@ -169,6 +169,7 @@ class Window_Message < Window_Selectable
if $game_temp.message_face != nil
if $game_temp.message_face.start_with?("en")
$game_system.windowskin_name = "en_normal"
self.y = 16;
else
$game_system.windowskin_name = "normal"
end
@ -250,12 +251,12 @@ class Window_Message < Window_Selectable
face_name = @text.slice!(/^[^\s]+ */).strip()
self.contents.fill_rect(self.contents.width - 96, 0, 96, 96, Color.new(0,0,0,0))
$game_temp.message_face = face_name
if $game_player.character_name == "niko_gasmask" || $game_player.character_name == "niko_bulb_gasmask" \
|| $game_player.character_name == "en_gasmask" || $game_player.character_name == "en_bulb_gasmask"
if $game_player.character_name == "niko_gasmask" || $game_player.character_name == "niko_bulb_gasmask" \
|| $game_player.character_name == "en_gasmask" || $game_player.character_name == "en_bulb_gasmask"
if $game_temp.message_face.start_with?("niko")
$game_temp.message_face = "niko_gasmask"
end
if $game_temp.message_face.start_with?("en")
if $game_temp.message_face.start_with?("en")
$game_temp.message_face = "en_gasmask"
end
end
@ -392,14 +393,14 @@ class Window_Message < Window_Selectable
@text_pause -= 1
else
if @blip >= BLIP_TIME
#april fools
if $game_temp.message_face != nil && CTime.month == 4 && CTime.day == 1 && $game_temp.message_face.start_with?("niko")
niko_sounds = [ "cat_2"]
@blipsound = niko_sounds[rand(niko_sounds.length)]
#april fools
if $game_temp.message_face != nil && CTime.month == 4 && CTime.day == 1 && $game_temp.message_face.start_with?("niko")
niko_sounds = [ "cat_2"]
@blipsound = niko_sounds[rand(niko_sounds.length)]
Audio.se_play("Audio/SE/#{@blipsound}.wav", 50, rand(100..125)) unless @text.empty?
else
else
Audio.se_play("Audio/SE/#{@blipsound}.wav", 50) unless @text.empty?
end
end
@blip = 0
else
@blip += 1

View file

@ -5,6 +5,7 @@ uniform lowp vec4 tone;
uniform lowp float opacity;
uniform lowp vec4 color;
uniform lowp vec4 modulate;
uniform float bushDepth;
uniform lowp float bushOpacity;
@ -30,6 +31,9 @@ void main(){
/* Apply color */
frag.rgb = mix(frag.rgb, color.rgb, color.a);
/* Apply modulation */
frag *= modulate;
/* Apply bush alpha by mathematical if */
lowp float underBush = float(v_texCoord.y < bushDepth);
frag.a *= clamp(bushOpacity + underBush, 0.0, 1.0);

View file

@ -211,6 +211,7 @@ struct EtcTemps{
Color color;
Tone tone;
Rect rect;
Color modulate;
};
#endif // ETC_H

View file

@ -398,7 +398,7 @@ int main(int argc, char *argv[]){
Sound_Quit();
TTF_Quit();
SDL_Quit(); // i got "Thread 1 received signal ?, Unknown signal" here on windows after closing game
+ SDL_Quit(); // i got "Thread 1 received signal ?, Unknown signal" here on windows after closing game
#ifdef STEAM
STEAMSHIM_deinit();

View file

@ -40,7 +40,7 @@
#include <algorithm>
#include <assert.h>
const Vec2i winSize(700, 500);
const Vec2i winSize(700, 600);
const uint8_t cBgNorm = 50;
const uint8_t cBgDark = 20;

View file

@ -374,6 +374,7 @@ SpriteShader::SpriteShader(){
GET_U(spriteMat);
GET_U(tone);
GET_U(color);
GET_U(modulate);
GET_U(opacity);
GET_U(bushDepth);
GET_U(bushOpacity);
@ -391,6 +392,10 @@ void SpriteShader::setColor(const Vec4 &color){
setVec4Uniform(u_color, color);
}
void SpriteShader::setModulate(const Vec4 &color){
setVec4Uniform(u_modulate, color);
}
void SpriteShader::setOpacity(float value){
gl.Uniform1f(u_opacity, value);
}

View file

@ -167,12 +167,13 @@ public:
void setSpriteMat(const float value[16]);
void setTone(const Vec4 &value);
void setColor(const Vec4 &value);
void setModulate(const Vec4 &value);
void setOpacity(float value);
void setBushDepth(float value);
void setBushOpacity(float value);
private:
GLint u_spriteMat, u_tone, u_opacity, u_color, u_bushDepth, u_bushOpacity;
GLint u_spriteMat, u_tone, u_opacity, u_color, u_modulate, u_bushDepth, u_bushOpacity;
};
class PlaneShader : public ShaderBase{

View file

@ -69,6 +69,7 @@ struct SpritePrivate{
Color *color;
Tone *tone;
Color *modulate;
struct{
int amp;
@ -99,7 +100,8 @@ struct SpritePrivate{
isVisible(false),
obscured(false),
color(&tmp.color),
tone(&tmp.tone)
tone(&tmp.tone),
modulate(&tmp.modulate)
{
sceneRect.x = sceneRect.y = 0;
@ -313,6 +315,7 @@ DEF_ATTR_SIMPLE(Sprite, Opacity, int, p->opacity)
DEF_ATTR_SIMPLE(Sprite, SrcRect, Rect&, *p->srcRect)
DEF_ATTR_SIMPLE(Sprite, Color, Color&, *p->color)
DEF_ATTR_SIMPLE(Sprite, Tone, Tone&, *p->tone)
DEF_ATTR_SIMPLE(Sprite, Modulate, Color&, *p->modulate)
DEF_ATTR_SIMPLE(Sprite, Obscured, bool, p->obscured)
void Sprite::setBitmap(Bitmap *bitmap){
@ -465,6 +468,7 @@ void Sprite::initDynAttribs(){
p->srcRect = new Rect;
p->color = new Color;
p->tone = new Tone;
p->modulate = new Color(255, 255, 255);
p->updateSrcRectCon();
}
@ -489,9 +493,10 @@ void Sprite::draw(){
ShaderBase *base;
bool renderEffect = p->color->hasEffect() ||
p->tone->hasEffect() ||
flashing ||
bool renderEffect = p->color->hasEffect() ||
p->tone->hasEffect() ||
p->modulate->hasEffect() ||
flashing ||
p->bushDepth != 0;
if (p->obscured){
@ -519,6 +524,7 @@ void Sprite::draw(){
&flashColor : &p->color->norm;
shader.setColor(*blend);
shader.setModulate(p->modulate->norm);
base = &shader;
}

View file

@ -60,6 +60,7 @@ public:
DECL_ATTR( Opacity, int )
DECL_ATTR( BlendType, int )
DECL_ATTR( Color, Color& )
DECL_ATTR( Modulate, Color& )
DECL_ATTR( Tone, Tone& )
DECL_ATTR( WaveAmp, int )
DECL_ATTR( WaveLength, int )

View file

@ -50,4 +50,4 @@
#define TRSTR_KEYBIND_DEACTIVATE 49
#define TRSTR_KEYBIND_ITEMS 50
#define TRSTR_KEYBIND_R 51
#define TRSTR_KEYBIND_DEBUGACTION 50
#define TRSTR_KEYBIND_DEBUGACTION 52