-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add blaster_BC_buttons #582
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some initial comments.
IF this things were to inherit from the blaster prop, then there will be lots of changes, so I want to get that out of the way before I review in more detail.
@@ -77,6 +77,7 @@ extern SaberBase* saberbases; | |||
DEFINE_EFFECT(UNJAM) \ | |||
DEFINE_EFFECT(PLI_ON) \ | |||
DEFINE_EFFECT(PLI_OFF) \ | |||
DEFINE_EFFECT(DESTRUCT) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self-destruct is usually an off-type rather than an effect...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is,
case NEXT_ACTION_BLOW:
Off(OFF_BLAST);
break;
But having EFFECT_DESTRUCT allows for blade animations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to add a way for TrInOut to handle EFFECT_DESTRUCT so we can have a transition from the on to the off color.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. oh, you mean like an "explosion"? Wouldn't that just be the OUT->IN transition, something like
InOutTrL<TrInstant,TrConcat<TrInstant,Blinking<White,Black,75,500>,TrFade<600>>>
That would play with boom.wav.
I'm not sure what you're saying the integration with EFFECT_DESTRUCT should be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh well that's not right. It works for Destruct, but also shows if powering off normally.
So what did you have in mind?
I glanced at styles/inout_helper.h, but do not know what should happen here.
Maybe if EFFECT_DESTRUCT happens, we somehow bypass in_tr_.begin();
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe we just have an EFFECT_BOOM that layers in the blade style on top of the InOutTrL?
Actually, my blaster styles don't even use an InOutTrL.
It's just always on not showing anything most of the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added EFFECT_BOOM, tested, works well for Boom, unless you had a different idea?
props/blaster_BC_buttons.h
Outdated
PropBase::DoMotion(Vec3(0), clear); | ||
} | ||
|
||
RefPtr<BufferedWavPlayer> wav_player; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
variables should generally go at the bottom (and be indented)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put it above Event2 where I saw it in other props, and
I just added more bools to the spot that blaster.h has them.
So should the RefPtr (and all the other declarations) be moved to the bottom of the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
It would be easier to provide guidance if I knew what the problem was... |
dual_prop doesn't account for these buttons I think was / is the issue.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dual_prop doesn't account for these buttons I think was / is the issue.
I guess the question is: what do we want it to do?
@@ -77,6 +77,7 @@ extern SaberBase* saberbases; | |||
DEFINE_EFFECT(UNJAM) \ | |||
DEFINE_EFFECT(PLI_ON) \ | |||
DEFINE_EFFECT(PLI_OFF) \ | |||
DEFINE_EFFECT(DESTRUCT) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to add a way for TrInOut to handle EFFECT_DESTRUCT so we can have a transition from the on to the off color.
props/blaster_BC_buttons.h
Outdated
return max_shots_ != -1 && shots_fired_ >= max_shots_; | ||
} | ||
|
||
void Fire() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of overrinding the whole Fire function, how about splitting Blaster::Fire into smaller functions and then overriding the ones that are actually different from the base.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Changes to blaster.h make this easier now I think. Working on it. I'll just make the RELOAD button (AUX2) have the option to be dedicated POWER and hope no one brings a 4 button blaster :) |
props/blaster.h
Outdated
@@ -87,6 +87,8 @@ mdauto Sound made when switching to AUTO mode | |||
#ifndef PROPS_BLASTER_H | |||
#define PROPS_BLASTER_H | |||
|
|||
#define PROP_HAS_GETBLASTERMODE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember what this was for. OLED maybe? Also not sure why I have it in my local copy but it's not in the master.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used here:
Line 695 in b88b82d
#ifdef PROP_HAS_GETBLASTERMODE |
which is in turn used by BlasterModeF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes I remember that. Cool. I guess it just never made it into the blaster prop?
Still making changes as I keep testing and finding things. Getting closer. |
Ok Major revamping done. I guess since all but one comment here has been addressed, I'll just overwrite these with the latest versions and go from there for review. |
I think we would need to add some code to dual_prop to handle these kind of scenarios. |
props/blaster.h
Outdated
|
||
#ifdef BLASTER_SHOTS_UNTIL_EMPTY | ||
const int max_shots_ = BLASTER_SHOTS_UNTIL_EMPTY; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constants don't usually go at the bottom with the variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't seem moved...
(It should be near the top of the class.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't seem moved... (It should be near the top of the class.)
I thought I moved that because I remember saying to myself "ok I'll just put it back where it was."
Now you're saying top, so I just put it there now, up above the first function.
EDIT - wait. I did move them? I thought so. Irrelevant now, just weird that they were on the bottom again just 20 minutes ago.
73c533c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I found what happened.
Apparently I had duplicated that part, not moved it?
Should be all good now.
props/blaster_BC_buttons.h
Outdated
uint32_t auto_time_; | ||
RefPtr<BufferedWavPlayer> auto_player_; | ||
RefPtr<BufferedWavPlayer> wav_player; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
props/blaster_BC_buttons.h
Outdated
typedef SoundLibraryV2 SoundLibrary; | ||
}; | ||
|
||
void Setup() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this global, and indented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean it's global, so fix the indent, or is it wrong to be global?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be inside the prop. (and I think you want an "override" on it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks. Not too aware of the startup routine yet.
props/blaster.h
Outdated
@@ -87,6 +87,8 @@ mdauto Sound made when switching to AUTO mode | |||
#ifndef PROPS_BLASTER_H | |||
#define PROPS_BLASTER_H | |||
|
|||
#define PROP_HAS_GETBLASTERMODE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used here:
Line 695 in b88b82d
#ifdef PROP_HAS_GETBLASTERMODE |
which is in turn used by BlasterModeF
props/blaster.h
Outdated
} | ||
|
||
virtual bool CheckJam(int percent) { | ||
int random = rand() % 100; | ||
return random < percent; | ||
} | ||
|
||
virtual void Fire() { | ||
bool DoJam() { | ||
#ifdef ENABLE_MOTION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if defined(ENABLE_MOTION) && defined(BLASTER_JAM_PERCENTAGE)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup.
Done.
props/blaster.h
Outdated
return; | ||
} | ||
} | ||
virtual int GetBulletCount() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems the same as the inherited version, so we don't need it, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anything overriding this.
Did you mean we don't need the virtual?
I think that's correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I missed what file this was in.
It shows up as new because the diff is dumb. Maybe just move it up to line 172 to make the diff nicer.
props/blaster.h
Outdated
|
||
#ifdef BLASTER_SHOTS_UNTIL_EMPTY | ||
const int max_shots_ = BLASTER_SHOTS_UNTIL_EMPTY; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't seem moved...
(It should be near the top of the class.)
No description provided.