Remapped JumpUp/JumpDown controls, replaced and/or/not, fixed typo in previous commit

This commit is contained in:
Maruno17
2021-04-25 16:38:47 +01:00
parent a42b66db68
commit 484813c592
22 changed files with 137 additions and 139 deletions

View File

@@ -1,5 +1,5 @@
class BushBitmap
def initialize(bitmap,isTile,depth)
def initialize(bitmap, isTile, depth)
@bitmaps = []
@bitmap = bitmap
@isTile = isTile
@@ -8,9 +8,7 @@ class BushBitmap
end
def dispose
for b in @bitmaps
b.dispose if b
end
@bitmaps.each { |b| b.dispose if b }
end
def bitmap
@@ -18,39 +16,39 @@ class BushBitmap
current = (@isBitmap) ? 0 : @bitmap.currentIndex
if !@bitmaps[current]
if @isTile
@bitmaps[current] = pbBushDepthTile(thisBitmap,@depth)
@bitmaps[current] = pbBushDepthTile(thisBitmap, @depth)
else
@bitmaps[current] = pbBushDepthBitmap(thisBitmap,@depth)
@bitmaps[current] = pbBushDepthBitmap(thisBitmap, @depth)
end
end
return @bitmaps[current]
end
def pbBushDepthBitmap(bitmap,depth)
ret = Bitmap.new(bitmap.width,bitmap.height)
charheight = ret.height/4
cy = charheight-depth-2
def pbBushDepthBitmap(bitmap, depth)
ret = Bitmap.new(bitmap.width, bitmap.height)
charheight = ret.height / 4
cy = charheight - depth - 2
for i in 0...4
y = i*charheight
if cy>=0
ret.blt(0,y,bitmap,Rect.new(0,y,ret.width,cy))
ret.blt(0,y+cy,bitmap,Rect.new(0,y+cy,ret.width,2),170)
y = i * charheight
if cy >= 0
ret.blt(0, y, bitmap, Rect.new(0, y, ret.width, cy))
ret.blt(0, y + cy, bitmap, Rect.new(0, y + cy, ret.width, 2), 170)
end
ret.blt(0,y+cy+2,bitmap,Rect.new(0,y+cy+2,ret.width,2),85) if cy+2>=0
ret.blt(0, y + cy + 2, bitmap, Rect.new(0, y + cy + 2, ret.width, 2), 85) if cy + 2 >= 0
end
return ret
end
def pbBushDepthTile(bitmap,depth)
ret = Bitmap.new(bitmap.width,bitmap.height)
def pbBushDepthTile(bitmap, depth)
ret = Bitmap.new(bitmap.width, bitmap.height)
charheight = ret.height
cy = charheight-depth-2
cy = charheight - depth - 2
y = charheight
if cy>=0
ret.blt(0,y,bitmap,Rect.new(0,y,ret.width,cy))
ret.blt(0,y+cy,bitmap,Rect.new(0,y+cy,ret.width,2),170)
if cy >= 0
ret.blt(0, y, bitmap, Rect.new(0, y, ret.width, cy))
ret.blt(0, y + cy, bitmap, Rect.new(0, y + cy, ret.width, 2), 170)
end
ret.blt(0,y+cy+2,bitmap,Rect.new(0,y+cy+2,ret.width,2),85) if cy+2>=0
ret.blt(0, y + cy + 2, bitmap, Rect.new(0, y + cy + 2, ret.width, 2), 85) if cy + 2 >= 0
return ret
end
end
@@ -65,10 +63,10 @@ class Sprite_Character < RPG::Sprite
@character = character
@oldbushdepth = 0
@spriteoffset = false
if !character || character==$game_player || (character.name[/reflection/i] rescue false)
@reflection = Sprite_Reflection.new(self,character,viewport)
if !character || character == $game_player || (character.name[/reflection/i] rescue false)
@reflection = Sprite_Reflection.new(self, character, viewport)
end
@surfbase = Sprite_SurfBase.new(self,character,viewport) if character==$game_player
@surfbase = Sprite_SurfBase.new(self, character, viewport) if character == $game_player
update
end
@@ -96,15 +94,15 @@ class Sprite_Character < RPG::Sprite
def update
return if @character.is_a?(Game_Event) && !@character.should_update?
super
if @tile_id!=@character.tile_id or
@character_name!=@character.character_name or
@character_hue!=@character.character_hue or
@oldbushdepth!=@character.bush_depth
if @tile_id != @character.tile_id ||
@character_name != @character.character_name ||
@character_hue != @character.character_hue ||
@oldbushdepth != @character.bush_depth
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
@oldbushdepth = @character.bush_depth
if @tile_id>=384
if @tile_id >= 384
@charbitmap.dispose if @charbitmap
@charbitmap = pbGetTileBitmap(@character.map.tileset_name, @tile_id,
@character_hue, @character.width, @character.height)
@@ -114,45 +112,45 @@ class Sprite_Character < RPG::Sprite
@spriteoffset = false
@cw = Game_Map::TILE_WIDTH * @character.width
@ch = Game_Map::TILE_HEIGHT * @character.height
self.src_rect.set(0,0,@cw,@ch)
self.ox = @cw/2
self.src_rect.set(0, 0, @cw, @ch)
self.ox = @cw / 2
self.oy = @ch
@character.sprite_size = [@cw,@ch]
@character.sprite_size = [@cw, @ch]
else
@charbitmap.dispose if @charbitmap
@charbitmap = AnimatedBitmap.new(
"Graphics/Characters/"+@character_name,@character_hue)
RPG::Cache.retain("Graphics/Characters/", @character_name, @character_hue) if @character == $game_player
'Graphics/Characters/' + @character_name, @character_hue)
RPG::Cache.retain('Graphics/Characters/', @character_name, @character_hue) if @character == $game_player
@charbitmapAnimated = true
@bushbitmap.dispose if @bushbitmap
@bushbitmap = nil
@spriteoffset = @character_name[/offset/i]
@cw = @charbitmap.width/4
@ch = @charbitmap.height/4
self.ox = @cw/2
@character.sprite_size = [@cw,@ch]
@cw = @charbitmap.width / 4
@ch = @charbitmap.height / 4
self.ox = @cw / 2
@character.sprite_size = [@cw, @ch]
end
end
@charbitmap.update if @charbitmapAnimated
bushdepth = @character.bush_depth
if bushdepth==0
if bushdepth == 0
self.bitmap = (@charbitmapAnimated) ? @charbitmap.bitmap : @charbitmap
else
@bushbitmap = BushBitmap.new(@charbitmap,(@tile_id>=384),bushdepth) if !@bushbitmap
@bushbitmap = BushBitmap.new(@charbitmap, (@tile_id >= 384), bushdepth) if !@bushbitmap
self.bitmap = @bushbitmap.bitmap
end
self.visible = !@character.transparent
if @tile_id==0
sx = @character.pattern*@cw
sy = ((@character.direction-2)/2)*@ch
self.src_rect.set(sx,sy,@cw,@ch)
self.oy = (@spriteoffset rescue false) ? @ch-16 : @ch
if @tile_id == 0
sx = @character.pattern * @cw
sy = ((@character.direction - 2) / 2) * @ch
self.src_rect.set(sx, sy, @cw, @ch)
self.oy = (@spriteoffset rescue false) ? @ch - 16 : @ch
self.oy -= @character.bob_height
end
if self.visible
if $PokemonSystem.tilemap==0 ||
if $PokemonSystem.tilemap == 0 ||
(@character.is_a?(Game_Event) && @character.name[/regulartone/i])
self.tone.set(0,0,0,0)
self.tone.set(0, 0, 0, 0)
else
pbDayNightTint(self)
end
@@ -160,14 +158,14 @@ class Sprite_Character < RPG::Sprite
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z(@ch)
# self.zoom_x = Game_Map::TILE_WIDTH/32.0
# self.zoom_y = Game_Map::TILE_HEIGHT/32.0
# self.zoom_x = Game_Map::TILE_WIDTH / 32.0
# self.zoom_y = Game_Map::TILE_HEIGHT / 32.0
self.opacity = @character.opacity
self.blend_type = @character.blend_type
# self.bush_depth = @character.bush_depth
if @character.animation_id!=0
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation,true)
animation(animation, true)
@character.animation_id = 0
end
@reflection.update if @reflection

View File

@@ -29,8 +29,8 @@ class Sprite_Shadow < RPG::Sprite
return
end
super
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
if @tile_id != @character.tile_id ||
@character_name != @character.character_name ||
@character_hue != @character.character_hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@@ -47,7 +47,7 @@ class Sprite_Shadow < RPG::Sprite
else
@chbitmap.dispose if @chbitmap
@chbitmap = AnimatedBitmap.new(
"Graphics/Characters/"+@character.character_name,@character.character_hue)
'Graphics/Characters/'+@character.character_name,@character.character_hue)
@cw = @chbitmap.width / 4
@ch = @chbitmap.height / 4
self.ox = @cw / 2
@@ -60,11 +60,11 @@ class Sprite_Shadow < RPG::Sprite
else
self.bitmap = @chbitmap
end
self.visible = (not @character.transparent)
self.visible = !@character.transparent
if @tile_id == 0
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
if self.angle > 90 or angle < -90
if self.angle > 90 || angle < -90
case @character.direction
when 2 then sy = (8- 2) / 2 * @ch
when 4 then sy = (6- 2) / 2 * @ch
@@ -94,12 +94,12 @@ class Sprite_Shadow < RPG::Sprite
self.angle = 57.3 * Math.atan2(@deltax, @deltay)
@angle_trigo = self.angle+90
@angle_trigo += 360 if @angle_trigo < 0
if @anglemin != 0 or @anglemax != 0
if (@angle_trigo < @anglemin or @angle_trigo > @anglemax) and @anglemin < @anglemax
if @anglemin != 0 || @anglemax != 0
if (@angle_trigo < @anglemin || @angle_trigo > @anglemax) && @anglemin < @anglemax
self.opacity = 0
return
end
if (@angle_trigo < @anglemin and @angle_trigo > @anglemax) and @anglemin > @anglemax
if @angle_trigo < @anglemin && @angle_trigo > @anglemax && @anglemin > @anglemax
self.opacity = 0
return
end
@@ -133,7 +133,7 @@ class Sprite_Character < RPG::Sprite
end
def setShadows(map,shadows)
if character.is_a?(Game_Event) and shadows.length > 0
if character.is_a?(Game_Event) && shadows.length > 0
params = XPML_read(map,"Shadow",@character,4)
if params != nil
for i in 0...shadows.size
@@ -141,7 +141,7 @@ class Sprite_Character < RPG::Sprite
end
end
end
if character.is_a?(Game_Player) and shadows.length > 0
if character.is_a?(Game_Player) && shadows.length > 0
for i in 0...shadows.size
@ombrelist.push(Sprite_Shadow.new(viewport, $game_player, shadows[i]))
end
@@ -185,9 +185,9 @@ class Spriteset_Map
map = $game_map if !map
for k in map.events.keys.sort
ev = map.events[k]
warn = true if (ev.list != nil and ev.list.length > 0 and
ev.list[0].code == 108 and
(ev.list[0].parameters == ["s"] or ev.list[0].parameters == ["o"]))
warn = true if (ev.list != nil && ev.list.length > 0 &&
ev.list[0].code == 108 &&
(ev.list[0].parameters == ["s"] || ev.list[0].parameters == ["o"]))
params = XPML_read(map,"Shadow Source", ev, 4)
@shadows.push([ev] + params) if params != nil
end
@@ -227,14 +227,14 @@ def XPML_read(map,markup,event,max_param_number=0)
parameter_list = nil
return nil if !event || event.list == nil
for i in 0...event.list.size
if event.list[i].code == 108 and
if event.list[i].code == 108 &&
event.list[i].parameters[0].downcase == "begin " + markup.downcase
parameter_list = [] if parameter_list == nil
for j in i+1...event.list.size
if event.list[j].code == 108
parts = event.list[j].parameters[0].split
if parts.size != 1 and parts[0].downcase != "begin"
if parts[1].to_i != 0 or parts[1] == "0"
if parts.size != 1 && parts[0].downcase != "begin"
if parts[1].to_i != 0 || parts[1] == "0"
parameter_list.push(parts[1].to_i)
else
parameter_list.push(parts[1])
@@ -245,7 +245,7 @@ def XPML_read(map,markup,event,max_param_number=0)
else
return parameter_list
end
return parameter_list if max_param_number != 0 and j == i + max_param_number
return parameter_list if max_param_number != 0 && j == i + max_param_number
end
end
end