use new names in games

This commit is contained in:
Corwin 2023-04-04 17:38:57 +01:00
parent d6006c7808
commit e7caff3776
No known key found for this signature in database
7 changed files with 58 additions and 58 deletions

View file

@ -1,4 +1,4 @@
use agb::display::object::{OAMManager, Object};
use agb::display::object::{OamManager, Object};
use agb::rng;
use alloc::vec;
use alloc::vec::Vec;
@ -39,7 +39,7 @@ pub struct BattleScreenDisplay<'a> {
const HEALTH_BAR_WIDTH: usize = 48;
impl<'a> BattleScreenDisplay<'a> {
pub fn new(obj: &'a OAMManager, current_battle_state: &CurrentBattleState) -> Self {
pub fn new(obj: &'a OamManager, current_battle_state: &CurrentBattleState) -> Self {
let mut misc_sprites = vec![];
let player_x = 12;
let player_y = 8;
@ -189,7 +189,7 @@ impl<'a> BattleScreenDisplay<'a> {
pub fn update(
&mut self,
obj: &'a OAMManager,
obj: &'a OamManager,
current_battle_state: &CurrentBattleState,
) -> Vec<Action> {
for (i, player_shield) in self.objs.player_shield.iter_mut().enumerate() {
@ -279,7 +279,7 @@ impl<'a> BattleScreenDisplay<'a> {
actions_to_apply
}
pub fn add_action(&mut self, action: Action, obj: &'a OAMManager, sfx: &mut Sfx) {
pub fn add_action(&mut self, action: Action, obj: &'a OamManager, sfx: &mut Sfx) {
play_sound_for_action_start(&action, sfx);
self.animations
@ -309,7 +309,7 @@ impl<'a> EnemyAttackDisplay<'a> {
}
}
pub fn update(&mut self, attack: &Option<EnemyAttackState>, obj: &'a OAMManager) {
pub fn update(&mut self, attack: &Option<EnemyAttackState>, obj: &'a OamManager) {
if let Some(attack) = attack {
self.face.show().set_sprite(
obj.get_vram_sprite(ENEMY_ATTACK_SPRITES.sprite_for_attack(attack.attack_type())),
@ -350,7 +350,7 @@ enum AnimationUpdateState {
}
impl<'a> AnimationStateHolder<'a> {
fn for_action(a: Action, obj: &'a OAMManager) -> Self {
fn for_action(a: Action, obj: &'a OamManager) -> Self {
let state = match a {
Action::PlayerActivateShield { amount, .. } => {
AnimationState::PlayerActivateShield { amount, frame: 0 }
@ -383,7 +383,7 @@ impl<'a> AnimationStateHolder<'a> {
fn update(
&mut self,
objs: &mut BattleScreenDisplayObjects<'a>,
obj: &'a OAMManager,
obj: &'a OamManager,
current_battle_state: &CurrentBattleState,
) -> AnimationUpdateState {
match &mut self.state {

View file

@ -1,6 +1,6 @@
use agb::{
display::{
object::{OAMManager, Object},
object::{OamManager, Object},
tiled::{RegularMap, TiledMap},
HEIGHT, WIDTH,
},
@ -91,7 +91,7 @@ fn move_net_position_ud(idx: usize, direction: Tri) -> usize {
}
}
fn create_dice_display<'a>(gfx: &'a OAMManager, dice: &'_ PlayerDice) -> Vec<Object<'a>> {
fn create_dice_display<'a>(gfx: &'a OamManager, dice: &'_ PlayerDice) -> Vec<Object<'a>> {
let mut objects = Vec::new();
for (idx, dice) in dice.dice.iter().enumerate() {
let mut obj = gfx.add_object_static_sprite(FACE_SPRITES.sprite_for_face(dice.faces[1]));
@ -105,7 +105,7 @@ fn create_dice_display<'a>(gfx: &'a OAMManager, dice: &'_ PlayerDice) -> Vec<Obj
objects
}
fn create_net<'a>(gfx: &'a OAMManager, die: &'_ Die, modified: &[usize]) -> Vec<Object<'a>> {
fn create_net<'a>(gfx: &'a OamManager, die: &'_ Die, modified: &[usize]) -> Vec<Object<'a>> {
let mut objects = Vec::new();
for (idx, &face) in die.faces.iter().enumerate() {
let mut obj = gfx.add_object_static_sprite(FACE_SPRITES.sprite_for_face(face));
@ -139,7 +139,7 @@ fn upgrade_position(idx: usize) -> (u32, u32) {
)
}
fn create_upgrade_objects<'a>(gfx: &'a OAMManager, upgrades: &[Face]) -> Vec<Object<'a>> {
fn create_upgrade_objects<'a>(gfx: &'a OamManager, upgrades: &[Face]) -> Vec<Object<'a>> {
let mut objects = Vec::new();
for (idx, &upgrade) in upgrades.iter().enumerate() {
let mut obj = gfx.add_object_static_sprite(FACE_SPRITES.sprite_for_face(upgrade));

View file

@ -1,5 +1,5 @@
use agb::{
display::object::{OAMManager, Object, Sprite, Tag},
display::object::{OamManager, Object, Sprite, Tag},
fixnum::Vector2D,
};
use alloc::vec::Vec;
@ -141,7 +141,7 @@ pub struct HealthBar<'a> {
}
impl<'a> HealthBar<'a> {
pub fn new(pos: Vector2D<i32>, max: usize, obj: &'a OAMManager) -> Self {
pub fn new(pos: Vector2D<i32>, max: usize, obj: &'a OamManager) -> Self {
assert_eq!(max % 8, 0);
let sprites = (0..(max / 8))
@ -157,7 +157,7 @@ impl<'a> HealthBar<'a> {
Self { max, sprites }
}
pub fn set_value(&mut self, new_value: usize, obj: &'a OAMManager) {
pub fn set_value(&mut self, new_value: usize, obj: &'a OamManager) {
assert!(new_value <= self.max);
for (i, sprite) in self.sprites.iter_mut().enumerate() {
@ -195,7 +195,7 @@ pub struct FractionDisplay<'a> {
}
impl<'a> FractionDisplay<'a> {
pub fn new(pos: Vector2D<i32>, digits: usize, obj: &'a OAMManager) -> Self {
pub fn new(pos: Vector2D<i32>, digits: usize, obj: &'a OamManager) -> Self {
let mut sprites = Vec::with_capacity(digits * 2 + 1);
for i in 0..digits {
@ -222,7 +222,7 @@ impl<'a> FractionDisplay<'a> {
}
}
pub fn set_value(&mut self, current: usize, max: usize, obj: &'a OAMManager) {
pub fn set_value(&mut self, current: usize, max: usize, obj: &'a OamManager) {
if self.current_current == current && self.current_max == max {
return;
}
@ -261,7 +261,7 @@ impl<'a> NumberDisplay<'a> {
}
}
pub fn set_value(&mut self, new_value: Option<u32>, obj: &'a OAMManager) {
pub fn set_value(&mut self, new_value: Option<u32>, obj: &'a OamManager) {
if self.value == new_value {
return;
}

View file

@ -12,7 +12,7 @@
#![cfg_attr(test, reexport_test_harness_main = "test_main")]
#![cfg_attr(test, test_runner(agb::test_runner::test_runner))]
use agb::display::object::OAMManager;
use agb::display::object::OamManager;
use agb::display::tiled::{TileFormat, TiledMap, VRamManager};
use agb::display::Priority;
use agb::interrupt::VBlank;
@ -90,7 +90,7 @@ pub struct PlayerDice {
}
struct Agb<'a> {
obj: OAMManager<'a>,
obj: OamManager<'a>,
vblank: VBlank,
star_background: StarBackground<'a>,
vram: VRamManager,

View file

@ -2,7 +2,7 @@ use crate::TAG_MAP;
use super::{sfx::SfxPlayer, Entity, FixedNumberType, HatState, Level};
use agb::{
display::object::{OAMManager, Tag},
display::object::{OamManager, Tag},
fixnum::Vector2D,
};
@ -35,11 +35,11 @@ pub enum EnemyUpdateState {
}
impl<'a> Enemy<'a> {
pub fn new_slime(object: &'a OAMManager, start_pos: Vector2D<FixedNumberType>) -> Self {
pub fn new_slime(object: &'a OamManager, start_pos: Vector2D<FixedNumberType>) -> Self {
Enemy::Slime(Slime::new(object, start_pos + (0, 1).into()))
}
pub fn new_snail(object: &'a OAMManager, start_pos: Vector2D<FixedNumberType>) -> Self {
pub fn new_snail(object: &'a OamManager, start_pos: Vector2D<FixedNumberType>) -> Self {
Enemy::Snail(Snail::new(object, start_pos))
}
@ -52,7 +52,7 @@ impl<'a> Enemy<'a> {
pub fn update(
&mut self,
controller: &'a OAMManager,
controller: &'a OamManager,
level: &Level,
player_pos: Vector2D<FixedNumberType>,
hat_state: HatState,
@ -94,7 +94,7 @@ struct EnemyInfo<'a> {
impl<'a> EnemyInfo<'a> {
fn new(
object: &'a OAMManager,
object: &'a OamManager,
start_pos: Vector2D<FixedNumberType>,
collision: Vector2D<u16>,
) -> Self {
@ -135,7 +135,7 @@ pub struct Slime<'a> {
}
impl<'a> Slime<'a> {
fn new(object: &'a OAMManager, start_pos: Vector2D<FixedNumberType>) -> Self {
fn new(object: &'a OamManager, start_pos: Vector2D<FixedNumberType>) -> Self {
let slime = Slime {
enemy_info: EnemyInfo::new(object, start_pos, (14u16, 14u16).into()),
state: SlimeState::Idle,
@ -146,7 +146,7 @@ impl<'a> Slime<'a> {
fn update(
&mut self,
controller: &'a OAMManager,
controller: &'a OamManager,
level: &Level,
player_pos: Vector2D<FixedNumberType>,
hat_state: HatState,
@ -257,7 +257,7 @@ pub struct Snail<'a> {
}
impl<'a> Snail<'a> {
fn new(object: &'a OAMManager, start_pos: Vector2D<FixedNumberType>) -> Self {
fn new(object: &'a OamManager, start_pos: Vector2D<FixedNumberType>) -> Self {
let snail = Snail {
enemy_info: EnemyInfo::new(object, start_pos, (16u16, 16u16).into()),
state: SnailState::Idle(0),
@ -272,7 +272,7 @@ impl<'a> Snail<'a> {
fn update(
&mut self,
controller: &'a OAMManager,
controller: &'a OamManager,
level: &Level,
player_pos: Vector2D<FixedNumberType>,
hat_state: HatState,

View file

@ -8,7 +8,7 @@ extern crate alloc;
use agb::{
display::{
object::{Graphics, OAMManager, Object, Tag, TagMap},
object::{Graphics, OamManager, Object, Tag, TagMap},
tiled::{
InfiniteScrolledMap, PartialUpdateStatus, RegularBackgroundSize, TileFormat, TileSet,
TileSetting, TiledMap, VRamManager,
@ -124,7 +124,7 @@ pub struct Entity<'a> {
}
impl<'a> Entity<'a> {
pub fn new(object: &'a OAMManager, collision_mask: Vector2D<u16>) -> Self {
pub fn new(object: &'a OamManager, collision_mask: Vector2D<u16>) -> Self {
let mut dummy_object = object.add_object_static_sprite(WALKING.sprite(0));
dummy_object.set_priority(Priority::P1);
Entity {
@ -347,7 +347,7 @@ fn ping_pong(i: i32, n: i32) -> i32 {
}
impl<'a> Player<'a> {
fn new(controller: &'a OAMManager, start_position: Vector2D<FixedNumberType>) -> Self {
fn new(controller: &'a OamManager, start_position: Vector2D<FixedNumberType>) -> Self {
let mut wizard = Entity::new(controller, (6_u16, 14_u16).into());
let mut hat = Entity::new(controller, (6_u16, 6_u16).into());
@ -381,7 +381,7 @@ impl<'a> Player<'a> {
fn update_frame(
&mut self,
input: &ButtonController,
controller: &'a OAMManager,
controller: &'a OamManager,
timer: i32,
level: &Level,
enemies: &[enemies::Enemy],
@ -615,7 +615,7 @@ enum UpdateState {
impl<'a, 'b> PlayingLevel<'a, 'b> {
fn open_level(
level: &'a Level,
object_control: &'a OAMManager,
object_control: &'a OamManager,
background: &'a mut InfiniteScrolledMap<'b>,
foreground: &'a mut InfiniteScrolledMap<'b>,
input: ButtonController,
@ -676,7 +676,7 @@ impl<'a, 'b> PlayingLevel<'a, 'b> {
self.player.wizard.sprite.set_priority(Priority::P0);
}
fn dead_update(&mut self, controller: &'a OAMManager) -> bool {
fn dead_update(&mut self, controller: &'a OamManager) -> bool {
self.timer += 1;
let frame = PLAYER_DEATH.animation_sprite(self.timer as usize / 8);
@ -695,7 +695,7 @@ impl<'a, 'b> PlayingLevel<'a, 'b> {
&mut self,
sfx_player: &mut SfxPlayer,
vram: &mut VRamManager,
controller: &'a OAMManager,
controller: &'a OamManager,
) -> UpdateState {
self.timer += 1;
self.input.update();

View file

@ -14,7 +14,7 @@ use alloc::{boxed::Box, vec::Vec};
use agb::{
display::{
object::{Graphics, OAMManager, Object, Sprite, Tag, TagMap},
object::{Graphics, OamManager, Object, Sprite, Tag, TagMap},
tiled::{
InfiniteScrolledMap, RegularBackgroundSize, TileFormat, TileSet, TileSetting,
VRamManager,
@ -164,7 +164,7 @@ struct Entity<'a> {
}
impl<'a> Entity<'a> {
fn new(object_controller: &'a OAMManager, collision_mask: Rect<u16>) -> Self {
fn new(object_controller: &'a OamManager, collision_mask: Rect<u16>) -> Self {
let mut sprite = object_controller.add_object_static_sprite(LONG_SWORD_IDLE.sprite(0));
sprite.set_priority(Priority::P1);
Entity {
@ -532,7 +532,7 @@ struct Player<'a> {
}
impl<'a> Player<'a> {
fn new(object_controller: &'a OAMManager<'a>) -> Player {
fn new(object_controller: &'a OamManager<'a>) -> Player {
let mut entity = Entity::new(
object_controller,
Rect::new((0_u16, 0_u16).into(), (4_u16, 12_u16).into()),
@ -558,7 +558,7 @@ impl<'a> Player<'a> {
fn update(
&mut self,
controller: &'a OAMManager,
controller: &'a OamManager,
buttons: &ButtonController,
level: &Level,
sfx: &mut sfx::Sfx,
@ -814,7 +814,7 @@ impl BatData {
fn update<'a>(
&mut self,
controller: &'a OAMManager,
controller: &'a OamManager,
entity: &mut Entity<'a>,
player: &Player,
level: &Level,
@ -947,7 +947,7 @@ impl SlimeData {
fn update<'a>(
&mut self,
controller: &'a OAMManager,
controller: &'a OamManager,
entity: &mut Entity<'a>,
player: &Player,
level: &Level,
@ -1076,7 +1076,7 @@ impl MiniFlameData {
fn update<'a>(
&mut self,
controller: &'a OAMManager,
controller: &'a OamManager,
entity: &mut Entity<'a>,
player: &Player,
_level: &Level,
@ -1205,7 +1205,7 @@ impl EmuData {
fn update<'a>(
&mut self,
controller: &'a OAMManager,
controller: &'a OamManager,
entity: &mut Entity<'a>,
player: &Player,
level: &Level,
@ -1378,7 +1378,7 @@ impl EnemyData {
fn update<'a>(
&mut self,
controller: &'a OAMManager,
controller: &'a OamManager,
entity: &mut Entity<'a>,
player: &Player,
level: &Level,
@ -1399,7 +1399,7 @@ struct Enemy<'a> {
}
impl<'a> Enemy<'a> {
fn new(object_controller: &'a OAMManager, enemy_data: EnemyData) -> Self {
fn new(object_controller: &'a OamManager, enemy_data: EnemyData) -> Self {
let mut entity = Entity::new(object_controller, enemy_data.collision_mask());
let sprite = enemy_data.sprite();
@ -1413,7 +1413,7 @@ impl<'a> Enemy<'a> {
fn update(
&mut self,
controller: &'a OAMManager,
controller: &'a OamManager,
player: &Player,
level: &Level,
sfx: &mut sfx::Sfx,
@ -1444,7 +1444,7 @@ impl ParticleData {
fn update<'a>(
&mut self,
controller: &'a OAMManager,
controller: &'a OamManager,
entity: &mut Entity<'a>,
player: &Player,
_level: &Level,
@ -1532,7 +1532,7 @@ struct Particle<'a> {
impl<'a> Particle<'a> {
fn new(
object_controller: &'a OAMManager,
object_controller: &'a OamManager,
particle_data: ParticleData,
position: Vector2D<Number>,
) -> Self {
@ -1551,7 +1551,7 @@ impl<'a> Particle<'a> {
fn update(
&mut self,
controller: &'a OAMManager,
controller: &'a OamManager,
player: &Player,
level: &Level,
) -> UpdateInstruction {
@ -1578,7 +1578,7 @@ impl<'a> BossState<'a> {
fn update(
&mut self,
enemies: &mut Arena<Enemy<'a>>,
object_controller: &'a OAMManager,
object_controller: &'a OamManager,
player: &Player,
sfx: &mut sfx::Sfx,
) -> BossInstruction {
@ -1613,7 +1613,7 @@ struct FollowingBoss<'a> {
}
impl<'a> FollowingBoss<'a> {
fn new(object_controller: &'a OAMManager, position: Vector2D<Number>) -> Self {
fn new(object_controller: &'a OamManager, position: Vector2D<Number>) -> Self {
let mut entity = Entity::new(
object_controller,
Rect::new((0_u16, 0_u16).into(), (0_u16, 0_u16).into()),
@ -1628,7 +1628,7 @@ impl<'a> FollowingBoss<'a> {
gone: false,
}
}
fn update(&mut self, controller: &'a OAMManager, player: &Player) {
fn update(&mut self, controller: &'a OamManager, player: &Player) {
let difference = player.entity.position - self.entity.position;
self.timer += 1;
@ -1697,7 +1697,7 @@ enum BossInstruction {
}
impl<'a> Boss<'a> {
fn new(object_controller: &'a OAMManager, screen_coords: Vector2D<Number>) -> Self {
fn new(object_controller: &'a OamManager, screen_coords: Vector2D<Number>) -> Self {
let mut entity = Entity::new(
object_controller,
Rect::new((0_u16, 0_u16).into(), (28_u16, 28_u16).into()),
@ -1716,7 +1716,7 @@ impl<'a> Boss<'a> {
fn update(
&mut self,
enemies: &mut Arena<Enemy<'a>>,
object_controller: &'a OAMManager,
object_controller: &'a OamManager,
player: &Player,
sfx: &mut sfx::Sfx,
) -> BossInstruction {
@ -1820,7 +1820,7 @@ impl<'a> Boss<'a> {
self.entity
.commit_with_size(offset + shake, (32, 32).into());
}
fn explode(&self, enemies: &mut Arena<Enemy<'a>>, object_controller: &'a OAMManager) {
fn explode(&self, enemies: &mut Arena<Enemy<'a>>, object_controller: &'a OamManager) {
for _ in 0..(6 - self.health) {
let x_offset: Number = Number::from_raw(rng::gen()).rem_euclid(2.into()) - 1;
let y_offset: Number = Number::from_raw(rng::gen()).rem_euclid(2.into()) - 1;
@ -1894,7 +1894,7 @@ impl<'a> Game<'a> {
fn advance_frame(
&mut self,
object_controller: &'a OAMManager,
object_controller: &'a OamManager,
vram: &mut VRamManager,
sfx: &mut sfx::Sfx,
) -> GameStatus {
@ -2108,7 +2108,7 @@ impl<'a> Game<'a> {
}
}
fn load_enemies(&mut self, object_controller: &'a OAMManager) {
fn load_enemies(&mut self, object_controller: &'a OamManager) {
if self.slime_load < self.level.slime_spawns.len() {
for (idx, slime_spawn) in self
.level
@ -2178,7 +2178,7 @@ impl<'a> Game<'a> {
vram.set_background_palettes(&modified_palettes);
}
fn new(object: &'a OAMManager, level: Level<'a>, start_at_boss: bool) -> Self {
fn new(object: &'a OamManager<'a>, level: Level<'a>, start_at_boss: bool) -> Self {
let mut player = Player::new(object);
let mut offset = (8, 8).into();
if start_at_boss {