Browse Source

Add monster sound

merge-requests/1/head
Miloslav Číž 3 years ago
parent
commit
b2f59297cb
  1. BIN
      assets/levelY.gif
  2. 1
      assets/sfx_monster.raw
  3. 34
      main.c
  4. 7
      settings.h
  5. 54
      sounds.h

BIN
assets/levelY.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

1
assets/sfx_monster.raw

@ -0,0 +1 @@ @@ -0,0 +1 @@
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€~≠÷~€€€€}}eп}xy|cャャyuuy€<EFBFBD><EFBFBD>€~|yx{у~{}€€<EFBFBD>}tt{ц<EFBFBD>€{pky燕<EFBFBD>b}ut~轄ёou~㊨ャメyuswi紙|v|括yns′香uvjжrr|<EFBFBD><EFBFBD>{|€€~}{~bモ||}€€€|{~ャ÷~€€}}~=メ||~|}e〟xy~<EFBFBD>}e℡~zy}~ysw<EFBFBD>獅}фvjlwl給л|{y|㊥|zヨлxz≧<EFBFBD>~f<EFBFBD><EFBFBD>{xxyz}<EFBFBD>轟[jlヤ<EFBFBD>w}{v~決€|<EFBFBD>±€zy}z|+°豪<EFBFBD>|ztsz<EFBFBD><EFBFBD>v|㍽Zy~~€<EFBFBD>мtvz<€€|<EFBFBD>~z{eム}}~=||€|{}<メ=<EFBFBD>yx}<EFBFBD>}y~煙㊥~褐{gf{掠<EFBFBD>c^v骨<EFBFBD>ZUw浚、~fhmszь拍wlxムe~ww~€}∴р≦<EFBFBD>〕^d{著撫€shn~月奄rmnw<EFBFBD>操uwv|€yv|z}居<EFBFBD>x|x|yqz件рzxtx€≠т<EFBFBD>|w{~b}z}€{|<EFBFBD>~||~|<EFBFBD>€|zy~<EFBFBD>€|z~€|}>р≦㊤<EFBFBD>yy}<EFBFBD>йx<EFBFBD>oq雌鋼sv~<EFBFBD>}~ラ€yz<EFBFBD>衡t<EFBFBD>|t㏍zш}{ユ}yыдr<EFBFBD>鉱vz><EFBFBD>spy払徒g衰zrty枚tcl侠€w曙pr葺iY{武{|㊥~≦th<EFBFBD>慾ovx<EFBFBD>格d僑<EFBFBD>]€圓婦kx粕ucn€<EFBFBD>y€{v帖yXl擱|ckwルY寺叡[t騒<EFBFBD>z∫黍dj}<EFBFBD>遅p~満€VQ~ッ殍Mc魚椢<EFBFBD>`i{髄<EFBFBD>t{刻sw♂зw~<EFBFBD>tx|且掛tz~ztyラ拷yt」ム耻シ€L7?GGU~ョコシソク・獣8)6Ng<EFBFBD>テハソア、{@!1a寛スタヒト捏K2<H[v損ルツ搖шi+J尤﨨ャ処lJ..?^粉コオシタエ塑."Ix涅ヌヤホー罵@<Yn堕鈿ネ壇K=.)Gz」タムレヒ、tH,$-R└イニフテ捐`XK:5Jz楡ルヨオ瞬`D%2mカ裼フ」粋i0 N€ヲチハフユュp@8</Gm恨チリ盪tP9*7Uwx<EFBFBD>裹ャxlgG$&Nj誠耜ォュ」p7'2Bcvクロロゥ)N63E^n~イ肅ツ敬U&,r隙<EFBFBD><EFBFBD>hkW$0d估ヘヘナー甜*1FWWkァヨ~y沾|^o庶oeヱビkm|酷】肢€轄xgm|vz燈yn汚<EFBFBD>Je炎{瀬仔h~恰yベw球rsdп}|<EFBFBD>~o[k増~n<EFBFBD><EFBFBD>@{Wm侭虫志^j}朽z≒<EFBFBD>rpt°<EFBFBD><EFBFBD>g∑渚剥<EFBFBD>yqp<EFBFBD>y鶏[e畔ナノ<EFBFBD>單K5$6Ut直゙衫産A?J36W痛聶フサ「v< 'L]k座籟ト僕QGD6;V稼<EFBFBD>隱Wc?,;Zo樟フク・宋[JJHUu。ナヤヌッ寥rE)5[w€闘セナトカE3HTLJsーユラセァ肺N(!>Yy<EFBFBD><EFBFBD>ニ、{L+'=Um尊モモオ稽[@+5\<EFBFBD>ォニヘタョ羊D,3DVk直玻サ撲P97:It。トヒハネイ胆1&<b襖ハ韜チ鈎E;>ERd独゚ヤョ<EFBFBD>P89E\€「ツヒニキ窯\SF9=`境タハトサ冤N<48Af「ミロノウ沂nQ4*=e彰ツテケョ冢A0@KUh鎮゙ント、~P/'0Hvォヘ<EFBFBD>}xuz<EFBFBD>殉icr穀柱€{~|}n炊tcey演ホx縁к|演tnyヨzn}圜遅f`iku{レ岫ァ婦edotwyz|<EFBFBD>革krz<EFBFBD>硲冬cWs霜<EFBFBD>k€н<EFBFBD>急xz~|qu€<EFBFBD>ylfs鋸哩wsv∴÷|~zxumtwz∴助曹voxтzv€<EFBFBD>€}ysry≠≦<EFBFBD>≧{ywtvkн}ヨ<EFBFBD>d}wut∴<EFBFBD>ts}ту{|<EFBFBD><EFBFBD>x~÷}{}ч合}y|c~wuy≦<EFBFBD>|powq<EFBFBD>梠~rorw|~}~ラYsye㊦<EFBFBD><EFBFBD>~€e+~}{y{<EFBFBD>泣z{}b~{y♀延~|{ywvu|樺注<EFBFBD>zux|}~g<EFBFBD>~}~|||fп€×|}ユ】y~~}ユп~~}}==ャ€|{}≠~{|<€}с€}€}|€р}}≠|€€€~~÷~~~€€÷€€€€€€€<EFBFBD>~÷~~€÷€€~~€€€€€€€€€€€€€€€€€~€€€

34
main.c

@ -261,6 +261,8 @@ struct @@ -261,6 +261,8 @@ struct
uint8_t spriteAnimationFrame;
uint8_t explosionSoundPlayed; /**< Prevents playing too many explosion sounds
at once */
uint8_t monsterSoundPlayed;
RCL_RayConstraints rayConstraints;
uint8_t keyStates[SFG_KEY_COUNT]; /**< Pressed states of keys, each value
stores the number of frames for which the
@ -448,6 +450,13 @@ void SFG_playSoundSafe(uint8_t soundIndex, uint8_t volume) @@ -448,6 +450,13 @@ void SFG_playSoundSafe(uint8_t soundIndex, uint8_t volume)
SFG_game.explosionSoundPlayed = 1;
}
else if (soundIndex == 5) // monster sound
{
if (!SFG_game.monsterSoundPlayed)
SFG_playSound(soundIndex,volume);
SFG_game.monsterSoundPlayed = 1;
}
else
SFG_playSound(soundIndex,volume);
}
@ -1717,7 +1726,9 @@ uint8_t SFG_distantSoundVolume(RCL_Unit x, RCL_Unit y, RCL_Unit z) @@ -1717,7 +1726,9 @@ uint8_t SFG_distantSoundVolume(RCL_Unit x, RCL_Unit y, RCL_Unit z)
if (distance >= SFG_SFX_MAX_DISTANCE)
return 0;
return 255 - (distance * 255) / SFG_SFX_MAX_DISTANCE;
uint32_t result = 255 - (distance * 255) / SFG_SFX_MAX_DISTANCE;
return (result * result) / 256;
}
void SFG_createExplosion(RCL_Unit x, RCL_Unit y, RCL_Unit z)
@ -2059,6 +2070,16 @@ void SFG_monsterPerformAI(SFG_MonsterRecord *monster) @@ -2059,6 +2070,16 @@ void SFG_monsterPerformAI(SFG_MonsterRecord *monster)
state == SFG_MONSTER_STATE_GOING_SW)
coordAdd[1] = add;
if ((coordAdd[0] != 0 || coordAdd[1] != 0) && SFG_random() <
SFG_MONSTER_SOUND_PROBABILITY)
SFG_playSoundSafe(5,
SFG_distantSoundVolume(
SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[0]),
SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[1]),
SFG_floorHeightAt(
SFG_MONSTER_COORD_TO_SQUARES(monster->coords[0]),
SFG_MONSTER_COORD_TO_SQUARES(monster->coords[1]))) / 2);
if (add)
state = SFG_MONSTER_STATE_IDLE;
}
@ -2455,7 +2476,15 @@ void SFG_updateLevel() @@ -2455,7 +2476,15 @@ void SFG_updateLevel()
monster->stateType = (monster->stateType & SFG_MONSTER_MASK_TYPE) |
SFG_MONSTER_STATE_DYING;
SFG_playSoundSafe(2,255);
uint8_t volume = SFG_distantSoundVolume(
SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[0]),
SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[1]),
SFG_floorHeightAt(
SFG_MONSTER_COORD_TO_SQUARES(monster->coords[0]),
SFG_MONSTER_COORD_TO_SQUARES(monster->coords[1])));
SFG_playSoundSafe(2,volume);
SFG_playSoundSafe(5,volume);
}
else if (state != SFG_MONSTER_STATE_INACTIVE)
{
@ -3132,6 +3161,7 @@ void SFG_gameStepMenu() @@ -3132,6 +3161,7 @@ void SFG_gameStepMenu()
void SFG_gameStep()
{
SFG_game.explosionSoundPlayed = 0;
SFG_game.monsterSoundPlayed = 0;
for (uint8_t i = 0; i < SFG_KEY_COUNT; ++i)
if (!SFG_keyPressed(i))

7
settings.h

@ -194,12 +194,17 @@ @@ -194,12 +194,17 @@
*/
#define SFG_BLINK_PERIOD 500
/**
Probability (0 - 255) of how often a monster makes sound during movement.
*/
#define SFG_MONSTER_SOUND_PROBABILITY 64
//------ developer/debug settings ------
/**
Developer cheat for having infinite ammo in all weapons.
*/
#define SFG_INFINITE_AMMO 0
#define SFG_INFINITE_AMMO 1
/**
Developer cheat for immortality.

54
sounds.h

@ -301,6 +301,60 @@ SFG_PROGRAM_MEMORY uint8_t SFG_sounds[][SFG_SFX_SIZE] = @@ -301,6 +301,60 @@ SFG_PROGRAM_MEMORY uint8_t SFG_sounds[][SFG_SFX_SIZE] =
136,136,136,136,136,136,136,136,136,136,135,119,119,119,119,119,119,119,119,119,
119,119,119,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136
},
{ // 5, robot/monster sound (beep)
136,120,120,120,136,136,136,136,120,120,135,136,136,136,120,136,136,119,136,
136,120,136,119,120,136,136,136,120,136,119,120,136,135,119,136,135,120,136,119,
119,136,136,119,119,120,136,136,135,119,119,136,136,136,119,119,119,136,119,120,
136,136,135,119,120,136,136,119,103,136,136,120,135,119,120,136,118,119,136,136,
136,119,119,136,136,119,120,135,103,136,136,119,136,135,119,120,136,119,120,135,
119,120,136,135,119,119,135,120,136,135,119,136,136,119,136,119,120,136,135,119,
119,119,136,136,119,120,119,136,136,119,119,119,119,137,136,120,135,102,120,136,
136,119,119,120,135,120,136,119,120,136,119,136,136,135,119,119,119,136,136,134,
104,136,136,119,119,119,136,135,120,136,120,119,119,119,135,136,136,136,119,119,
119,136,136,135,119,136,135,119,120,136,135,119,120,135,136,136,119,136,119,120,
136,135,119,120,135,119,136,135,119,136,136,136,120,119,119,136,119,120,136,135,
120,135,102,121,169,118,87,137,151,85,121,186,118,102,119,136,152,118,120,136,
135,119,120,120,136,136,136,136,101,103,153,152,135,102,120,136,135,102,120,153,
135,119,119,135,119,119,136,135,119,119,119,120,136,135,119,119,136,136,136,119,
119,119,136,119,119,135,120,135,119,119,120,135,120,136,119,119,136,136,135,119,
135,119,136,136,136,136,135,119,120,136,119,120,136,118,119,137,135,119,120,135,
119,136,135,119,120,152,119,136,119,120,135,136,119,136,119,136,135,120,152,119,
120,136,119,119,154,150,103,152,119,120,153,135,102,138,135,136,119,153,101,121,
151,120,135,136,118,137,151,103,120,152,102,138,134,88,154,151,103,153,118,104,
137,135,120,119,153,117,105,167,102,120,136,119,137,134,87,153,135,120,152,102,
103,137,151,119,153,133,87,169,100,104,153,152,102,103,153,135,119,136,119,120,
136,119,119,135,119,120,136,119,119,119,120,136,135,122,222,219,132,51,68,87,
171,187,186,134,50,52,104,172,203,186,116,33,54,139,188,204,151,67,52,87,
155,220,152,136,98,17,73,223,218,136,100,34,53,155,187,188,185,82,18,71,
155,205,203,150,65,19,86,156,238,201,100,50,36,122,205,220,167,66,34,88,
171,204,201,102,84,51,71,155,221,184,118,66,19,107,238,202,152,99,1,72,
172,204,218,116,51,36,104,172,222,183,83,35,87,120,190,234,118,100,34,70,
155,237,170,167,50,52,104,155,221,168,100,51,69,103,190,236,134,82,2,120,
138,223,199,102,82,19,105,204,204,185,82,52,85,106,216,103,153,117,104,134,
104,152,118,103,137,135,136,136,135,102,119,121,151,104,152,84,104,135,154,134,
103,136,119,135,120,135,120,135,136,119,136,118,86,153,118,137,134,137,117,105,
153,136,117,103,136,120,152,119,119,136,135,136,135,104,152,137,136,119,119,120,
119,135,86,156,204,253,150,67,35,87,155,222,200,84,52,51,89,206,236,186,
115,34,69,104,206,220,150,84,67,53,141,254,168,118,50,53,104,188,186,151,
84,68,87,172,220,169,135,66,53,120,154,188,203,116,52,84,71,189,219,169,
116,34,53,122,207,236,167,66,35,86,155,221,184,101,66,53,137,172,204,169,
116,35,69,105,190,219,150,83,51,71,172,204,203,149,49,35,104,172,238,200,
100,51,69,105,205,218,134,83,52,88,172,204,185,117,84,51,104,172,204,185,
100,51,52,106,221,203,152,101,50,54,139,204,186,150,67,68,86,156,221,202,
117,34,52,122,200,135,119,120,136,118,103,137,152,135,119,119,136,152,118,103,
136,135,119,136,135,120,135,118,120,135,103,154,151,102,102,119,136,154,169,118,
102,119,119,120,152,118,119,136,154,151,101,121,152,102,136,120,136,119,119,119,
120,136,118,103,137,152,119,119,136,136,119,119,118,119,120,136,153,135,103,136,
119,136,136,119,119,120,136,136,135,136,119,119,120,136,119,136,135,120,135,119,
120,136,135,136,119,119,136,136,119,136,135,119,136,119,120,136,135,119,136,119,
119,136,135,119,118,120,153,153,151,118,119,119,119,136,135,119,136,136,136,135,
120,136,135,119,119,119,136,136,119,120,135,119,136,136,119,119,119,119,137,152,
135,119,119,119,136,136,119,119,119,136,136,136,119,120,136,119,119,119,136,136,
119,119,119,136,136,136,135,119,136,119,120,136,119,136,135,120,119,136,135,120,
135,119,136,119,136,135,119,136,119,119,120,136,136,119,120,135,136,135,120,135,
119,136,119,136,135,136,119,120,136,120,136,120,136,119,135,119,136,119,136,135,
136,119,120,135,120
}
};

Loading…
Cancel
Save