Skip to content

Commit 6206de8

Browse files
Dmytro Lysaipingw33n
authored andcommitted
[game,inventory] Add weapon loading
1 parent c53c41d commit 6206de8

File tree

14 files changed

+424
-158
lines changed

14 files changed

+424
-158
lines changed

src/asset/frame/id/consts.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@ impl FrameId {
192192
pub const SEXOFF: FrameId = FrameId::Generic(Generic(0x6000_0bc));
193193
pub const SEXON: FrameId = FrameId::Generic(Generic(0x6000_0bd));
194194
pub const SLIDER: FrameId = FrameId::Generic(Generic(0x6000_0be));
195-
pub const SNEGOFF: FrameId = FrameId::Generic(Generic(0x6000_0bf));
196-
pub const SNEGON: FrameId = FrameId::Generic(Generic(0x6000_0c0));
197-
pub const SPLSOFF: FrameId = FrameId::Generic(Generic(0x6000_0c1));
198-
pub const SPLSON: FrameId = FrameId::Generic(Generic(0x6000_0c2));
195+
pub const BUTTON_MINUS_UP: FrameId = FrameId::Generic(Generic(0x6000_0bf));
196+
pub const BUTTON_MINUS_DOWN: FrameId = FrameId::Generic(Generic(0x6000_0c0));
197+
pub const BUTTON_PLUS_UP: FrameId = FrameId::Generic(Generic(0x6000_0c1));
198+
pub const BUTTON_PLUS_DOWN: FrameId = FrameId::Generic(Generic(0x6000_0c2));
199199
pub const STNEGOFF: FrameId = FrameId::Generic(Generic(0x6000_0c3));
200200
pub const STNEGON: FrameId = FrameId::Generic(Generic(0x6000_0c4));
201201
pub const STPLSOFF: FrameId = FrameId::Generic(Generic(0x6000_0c5));
@@ -306,10 +306,10 @@ impl FrameId {
306306
pub const UNLOADN: FrameId = FrameId::Generic(Generic(0x6000_12e));
307307
pub const SKILLH: FrameId = FrameId::Generic(Generic(0x6000_12f));
308308
pub const SKILLN: FrameId = FrameId::Generic(Generic(0x6000_130));
309-
pub const MOVEMULT: FrameId = FrameId::Generic(Generic(0x6000_131));
309+
pub const INVENTORY_MOVE_MULTIPLE_WINDOW: FrameId = FrameId::Generic(Generic(0x6000_131));
310310
pub const TIMER: FrameId = FrameId::Generic(Generic(0x6000_132));
311-
pub const ALLBON: FrameId = FrameId::Generic(Generic(0x6000_133));
312-
pub const ALLBOFF: FrameId = FrameId::Generic(Generic(0x6000_134));
311+
pub const BUTTON_ALL_UP: FrameId = FrameId::Generic(Generic(0x6000_133));
312+
pub const BUTTON_ALL_DOWN: FrameId = FrameId::Generic(Generic(0x6000_134));
313313
pub const DEATH: FrameId = FrameId::Generic(Generic(0x6000_135));
314314
pub const WATCH: FrameId = FrameId::Generic(Generic(0x6000_136));
315315
pub const SEQ2AD: FrameId = FrameId::Generic(Generic(0x6000_137));

src/asset/proto.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ pub struct Weapon {
270270
// Number of bullets per burst shot.
271271
pub burst_bullet_count: i32,
272272
// proto.msg:300
273-
pub caliber: i32,
273+
pub caliber: u32,
274274
pub ammo_proto_id: Option<ProtoId>,
275275
/// Magazine capacity.
276276
pub max_ammo_count: u32,
@@ -279,7 +279,7 @@ pub struct Weapon {
279279

280280
#[derive(Debug)]
281281
pub struct Ammo {
282-
pub caliber: i32,
282+
pub caliber: u32,
283283
pub max_ammo_count: u32,
284284
pub ac_modifier: i32,
285285
pub dr_modifier: i32,

src/asset/proto/db.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ impl ProtoDb {
345345
let crit_failure_table = rd.read_i32::<BigEndian>()?;
346346
let perk = read_opt_enum(rd, "invalid weapon perk")?;
347347
let burst_bullet_count = rd.read_i32::<BigEndian>()?;
348-
let caliber = rd.read_i32::<BigEndian>()?;
348+
let caliber = rd.read_u32::<BigEndian>()?;
349349
let ammo_proto_id = ProtoId::read_opt(rd)?;
350350
let max_ammo_count = rd.read_i32::<BigEndian>()?.try_into().unwrap();
351351
let sound_id = rd.read_u8()?;
@@ -370,7 +370,7 @@ impl ProtoDb {
370370
}
371371

372372
fn read_ammo(rd: &mut impl Read) -> io::Result<Ammo> {
373-
let caliber = rd.read_i32::<BigEndian>()?;
373+
let caliber = rd.read_u32::<BigEndian>()?;
374374
let max_ammo_count = rd.read_i32::<BigEndian>()?.try_into().unwrap();
375375
let ac_modifier = rd.read_i32::<BigEndian>()?;
376376
let dr_modifier = rd.read_i32::<BigEndian>()?;

src/asset/proto/id.rs

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,59 +5,6 @@ use std::io::{self, Error, ErrorKind, prelude::*};
55

66
use crate::asset::EntityKind;
77

8-
/* PID_ROCK = 0x13,
9-
PID_SMALL_ENERGY_CELL = 0x26,
10-
PID_MICRO_FUSION_CELL = 0x27,
11-
PID_STIMPAK = 0x28,
12-
PID_BOTTLE_CAPS = 0x29,
13-
PID_FIRST_AID_KIT = 0x2F,
14-
PID_ANTIDOTE = 0x31,
15-
PID_DYNAMITE = 0x33,
16-
PID_GEIGER_COUNTER = 0x34,
17-
PID_MENTATS = 0x35,
18-
PID_STEALTH_BOY = 0x36,
19-
PID_WATER_CHIP = 0x37,
20-
PID_HOLODISK = 0x3A,
21-
PID_MOTION_SENSOR = 0x3B,
22-
PID_MUTATED_FRUIT = 0x47,
23-
PID_BIG_BOOK_OF_SCIENCE = 0x49,
24-
PID_DEANS_ELECTRONICS = 0x4C,
25-
PID_FLARE = 0x4F,
26-
PID_FIRST_AID_BOOK = 0x50,
27-
PID_PLASTIC_EXPLOSIVES = 0x55,
28-
PID_SCOUT_HANDBOOK = 0x56,
29-
PID_BUFFOUT = 0x57,
30-
PID_DOCTORS_BAG = 0x5B,
31-
PID_PUMP_PARTS = 0x62,
32-
PID_GUNS_AND_BULLETS = 0x66,
33-
PID_NUKA_COLA = 0x6A,
34-
PID_RAD_X = 0x6D,
35-
PID_PSYCHO = 0x6E,
36-
PID_SUPER_STIMPAK = 0x90,
37-
PID_ACTIVE_FLARE = 0xCD,
38-
PID_ACTIVE_DYNAMITE = 0xCE,
39-
PID_ACTIVE_GEIGER_COUNTER = 0xCF,
40-
PID_ACTIVE_MOTION_SENSOR = 0xD0,
41-
PID_ACTIVE_PLASTIC_EXPLOSIVE = 0xD1,
42-
PID_ACTIVE_STEALTH_BOY = 0xD2,
43-
PID_TECHNICAL_MANUAL = 0xE4,
44-
PID_CHEMISTRY_MANUAL = 0xED,
45-
PID_JET = 0x103,
46-
PID_JET_ANTIDOTE = 0x104,
47-
PID_GECK = 0x16E,
48-
PID_CAR_TRUNK = 0x1C7,
49-
PID_JESSE_CONTAINER = 0x1D3,
50-
PID_DUDE = 0x1000000,
51-
PID_DRIVABLE_CAR = 0x20003F1,
52-
PID_NULL = 0xFFFFFFFF,
53-
54-
PID_HARDENED_POWER_ARMOR = 0xE8,
55-
PID_ADVANCED_POWER_ARMOR = 0x15C,
56-
PID_ADVANCED_POWER_ARMOR_MK2 = 0x15D,
57-
PID_POWER_ARMOR = 0x3,
58-
PID_MIRRORED_SHADES = 0x1B1,
59-
PID_SCROLL_BLOCKER = 0x500000C,*/
60-
618
#[derive(Clone, Copy, Eq, Hash, PartialEq, Ord, PartialOrd)]
629
pub struct ProtoId(u32);
6310

@@ -78,6 +25,7 @@ impl ProtoId {
7825
pub const ACTIVE_PLASTIC_EXPLOSIVE: Self = unsafe { Self::from_packed_unchecked(0xD1) };
7926
pub const SCROLL_BLOCKER: Self = unsafe { Self::from_packed_unchecked(0x0500000c) };
8027
pub const BOTTLE_CAPS: Self = unsafe { Self::from_packed_unchecked(0x29) };
28+
pub const SOLAR_SCORCHER: Self = unsafe { Self::from_packed_unchecked(390) };
8129

8230
pub fn new(kind: EntityKind, id: u32) -> Option<Self> {
8331
if id <= 0xffffff {

0 commit comments

Comments
 (0)