mirror of
https://github.com/zeldaret/ss
synced 2026-09-07 03:00:21 -04:00
Main counters file
This commit is contained in:
@@ -6,36 +6,12 @@
|
||||
class Counter {
|
||||
public:
|
||||
Counter(u16 id): counterId(id) {}
|
||||
// No vtable, this class appears to be header-only
|
||||
virtual ~Counter() {};
|
||||
/* 8016cc40 */ virtual s32 checkedAdd(s32 num) {
|
||||
s32 uncommitted = getUncommittedValue();
|
||||
s32 max = getMax();
|
||||
s32 result = uncommitted + num;
|
||||
if (result < 0) {
|
||||
setValue(0);
|
||||
} else if (result < max) {
|
||||
setValue(result);
|
||||
} else {
|
||||
setValue(max);
|
||||
}
|
||||
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return result <= max ? 0 : (result - max);
|
||||
}
|
||||
virtual u16 getCommittedValue() {
|
||||
return 0;
|
||||
}
|
||||
virtual s32 checkedAdd(s32 num);
|
||||
virtual u16 getCommittedValue();
|
||||
virtual u16 getMax() = 0;
|
||||
virtual u16 getUncommittedValue() {
|
||||
return 0;
|
||||
}
|
||||
virtual void setValue(u16 num) {
|
||||
return;
|
||||
}
|
||||
virtual u16 getUncommittedValue();
|
||||
virtual void setValue(u16 num);
|
||||
|
||||
u16 counterId;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user