@ -264,82 +264,6 @@ pub struct CharacterMaterials {
pub tp : u32 ,
}
#[ derive(Clone, Debug) ]
pub struct CharacterKeyboardConfig {
pub keyboard_config : [ u8 ; 0x16C ] ,
}
impl Default for CharacterKeyboardConfig {
fn default ( ) -> CharacterKeyboardConfig {
CharacterKeyboardConfig {
keyboard_config : DEFAULT_KEYBOARD_CONFIG1 ,
}
}
}
impl CharacterKeyboardConfig {
fn new ( preset : usize ) -> CharacterKeyboardConfig {
match preset {
1 = > {
CharacterKeyboardConfig {
keyboard_config : DEFAULT_KEYBOARD_CONFIG1 ,
}
} ,
2 = > {
CharacterKeyboardConfig {
keyboard_config : DEFAULT_KEYBOARD_CONFIG2 ,
}
} ,
3 = > {
CharacterKeyboardConfig {
keyboard_config : DEFAULT_KEYBOARD_CONFIG3 ,
}
} ,
4 = > {
CharacterKeyboardConfig {
keyboard_config : DEFAULT_KEYBOARD_CONFIG4 ,
}
} ,
_ = > {
CharacterKeyboardConfig {
keyboard_config : DEFAULT_KEYBOARD_CONFIG1 ,
}
} ,
}
}
pub fn update ( & mut self , new_config : & KeyboardConfig ) {
self . keyboard_config = new_config . keyboard_config ;
}
pub fn as_bytes ( & self ) -> [ u8 ; 0x16C ] {
self . keyboard_config
}
}
#[ derive(Clone, Debug) ]
pub struct CharacterGamepadConfig {
pub gamepad_config : [ u8 ; 0x38 ] ,
}
impl Default for CharacterGamepadConfig {
fn default ( ) -> CharacterGamepadConfig {
CharacterGamepadConfig {
gamepad_config : DEFAULT_GAMEPAD_CONFIG ,
}
}
}
impl CharacterGamepadConfig {
pub fn update ( & mut self , new_config : & GamepadConfig ) {
self . gamepad_config = new_config . gamepad_config ;
}
pub fn as_bytes ( & self ) -> [ u8 ; 0x38 ] {
self . gamepad_config
}
}
#[ derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, Default, derive_more::Display) ]
pub struct CharacterEntityId ( pub u32 ) ;
@ -363,12 +287,10 @@ pub struct NewCharacterEntity {
pub tech_menu : CharacterTechMenu ,
pub option_flags : u32 ,
pub keyboard_config : CharacterKeyboardConfig ,
pub gamepad_config : CharacterGamepadConfig ,
}
impl NewCharacterEntity {
pub fn new ( user : UserAccountId , keyboard_config_preset : usize , ) -> NewCharacterEntity {
pub fn new ( user : UserAccountId ) -> NewCharacterEntity {
NewCharacterEntity {
user_id : user ,
slot : 0 ,
@ -384,8 +306,6 @@ impl NewCharacterEntity {
materials : CharacterMaterials ::default ( ) ,
tech_menu : CharacterTechMenu ::default ( ) ,
option_flags : 0 ,
keyboard_config : CharacterKeyboardConfig ::new ( keyboard_config_preset ) ,
gamepad_config : CharacterGamepadConfig ::default ( ) ,
}
}
}
@ -411,8 +331,6 @@ pub struct CharacterEntity {
pub tech_menu : CharacterTechMenu ,
pub option_flags : u32 ,
pub keyboard_config : CharacterKeyboardConfig ,
pub gamepad_config : CharacterGamepadConfig ,
pub playtime : u32 ,
}