File src/fdungeon.cpp changed (mode: 100644) (index 4b02db3..306c5ec) |
... |
... |
struct InventoryInstance { |
69 |
69 |
struct Weapon { |
struct Weapon { |
70 |
70 |
std::map<std::string,std::string> names; |
std::map<std::string,std::string> names; |
71 |
71 |
std::map<std::string,std::string> descriptions; |
std::map<std::string,std::string> descriptions; |
|
72 |
|
ParticleTemplate particleFire; |
72 |
73 |
std::string ammo; |
std::string ammo; |
73 |
|
std::string particleFire; |
|
74 |
74 |
std::string soundFire; |
std::string soundFire; |
75 |
75 |
std::string soundReload; |
std::string soundReload; |
76 |
76 |
std::string soundHit; |
std::string soundHit; |
|
... |
... |
void Dungeon::appendWeapons( std::string weaponPath, std::string filePath ){ |
1419 |
1419 |
viewToString( prop.value.getString() ); |
viewToString( prop.value.getString() ); |
1420 |
1420 |
} |
} |
1421 |
1421 |
} |
} |
|
1422 |
|
ParticleTemplate particleFire{}; |
|
1423 |
|
if( weapDef.value["particle_fire"] ){ |
|
1424 |
|
particleFire = |
|
1425 |
|
loadParticles(viewToString(weapDef.value["particle_fire"].getString())); |
|
1426 |
|
particleServers[particleFire.texture] = ParticleServer(); |
|
1427 |
|
} |
1422 |
1428 |
std::string ammo; |
std::string ammo; |
1423 |
1429 |
if( weapDef.value["ammo"] ){ |
if( weapDef.value["ammo"] ){ |
1424 |
1430 |
ammo = viewToString( weapDef.value["ammo"].getString() ); |
ammo = viewToString( weapDef.value["ammo"].getString() ); |
1425 |
1431 |
} |
} |
1426 |
|
std::string particleFire; |
|
1427 |
|
if( weapDef.value["particle_fire"] ){ |
|
1428 |
|
particleFire = |
|
1429 |
|
viewToString( weapDef.value["particle_fire"].getString() ); |
|
1430 |
|
} |
|
1431 |
1432 |
std::string soundFire; |
std::string soundFire; |
1432 |
1433 |
if( weapDef.value["sound_fire"] ){ |
if( weapDef.value["sound_fire"] ){ |
1433 |
1434 |
soundFire = |
soundFire = |
|
... |
... |
void Dungeon::appendWeapons( std::string weaponPath, std::string filePath ){ |
1596 |
1597 |
weapons[weapName] = { |
weapons[weapName] = { |
1597 |
1598 |
localizedNames, |
localizedNames, |
1598 |
1599 |
localizedBlurbs, |
localizedBlurbs, |
1599 |
|
ammo, |
|
1600 |
1600 |
particleFire, |
particleFire, |
|
1601 |
|
ammo, |
1601 |
1602 |
soundFire, |
soundFire, |
1602 |
1603 |
soundReload, |
soundReload, |
1603 |
1604 |
soundHit, |
soundHit, |
|
... |
... |
std::pair<bool,Agent*> Dungeon::agentFireWeapon( Agent *a, std::string weapon, s |
3329 |
3330 |
if( fire_it != a->avatar.bodyAnimations.end() ) |
if( fire_it != a->avatar.bodyAnimations.end() ) |
3330 |
3331 |
a->avatar.bodyFrame = fire_it->second.x; |
a->avatar.bodyFrame = fire_it->second.x; |
3331 |
3332 |
bool pitch = a != playerAgent || !thirdPerson || weap.thirdPersonPitch; |
bool pitch = a != playerAgent || !thirdPerson || weap.thirdPersonPitch; |
|
3333 |
|
auto ray = getAgentGazeRay(a, weap.range, pitch); |
|
3334 |
|
// Emit particles. |
|
3335 |
|
auto ps_it = particleServers.find(weap.particleFire.texture); |
|
3336 |
|
if(ps_it != particleServers.end()){ |
|
3337 |
|
double startScale = weap.particleFire.startScale, |
|
3338 |
|
endScale = weap.particleFire.endScale, |
|
3339 |
|
startMass = weap.particleFire.startMass, |
|
3340 |
|
endMass = weap.particleFire.endMass, |
|
3341 |
|
maxAge = weap.particleFire.maxAge; |
|
3342 |
|
double svel = (endScale - startScale) / maxAge; |
|
3343 |
|
double mvel = (endMass - startMass) / maxAge; |
|
3344 |
|
// TODO: Randomly emit weap.particleFire.num particles. |
|
3345 |
|
for(size_t i = 0; i < 1; ++i){ |
|
3346 |
|
Particle part{}; |
|
3347 |
|
part.tvel = linalg::normalize(ray.second - ray.first) |
|
3348 |
|
* weap.particleFire.vel; |
|
3349 |
|
part.translation = ray.first; |
|
3350 |
|
part.svel = svel; |
|
3351 |
|
part.scale = startScale; |
|
3352 |
|
part.mvel = mvel; |
|
3353 |
|
part.mass = startMass; |
|
3354 |
|
part.maxAge = maxAge; |
|
3355 |
|
ps_it->second.particles.push_back(part); |
|
3356 |
|
} |
|
3357 |
|
} |
3332 |
3358 |
return { |
return { |
3333 |
3359 |
true, |
true, |
3334 |
|
rayImpact(a, getAgentGazeRay(a, weap.range, pitch), weap.impact, weap.damage, defenseSkill) |
|
|
3360 |
|
rayImpact(a, ray, weap.impact, weap.damage, defenseSkill) |
3335 |
3361 |
}; |
}; |
3336 |
3362 |
} |
} |
3337 |
3363 |
|
|