reimplemented all the potions, having another swing at romfs tommorow
This commit is contained in:
parent
f748519d3e
commit
4120d4b8ec
3 changed files with 57 additions and 16 deletions
|
@ -90,6 +90,9 @@ void startGame(bool load, char *filename) {
|
||||||
for(int i=0; i<playerCount; i++) {
|
for(int i=0; i<playerCount; i++) {
|
||||||
initPlayer(players+i);
|
initPlayer(players+i);
|
||||||
}
|
}
|
||||||
|
if (playerCount > 1) {
|
||||||
|
shouldRenderDebug = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!load) {
|
if (!load) {
|
||||||
initNewMap();
|
initNewMap();
|
||||||
|
|
|
@ -64,7 +64,7 @@ void playerInitInventory(PlayerData *pd) {
|
||||||
addItemToInventory(newItem(ITEM_WORKBENCH,0), &(pd->inventory));
|
addItemToInventory(newItem(ITEM_WORKBENCH,0), &(pd->inventory));
|
||||||
addItemToInventory(newItem(ITEM_POWGLOVE,0), &(pd->inventory));
|
addItemToInventory(newItem(ITEM_POWGLOVE,0), &(pd->inventory));
|
||||||
|
|
||||||
if(shouldRenderDebug) {
|
if(shouldRenderDebug && playerCount < 1) {
|
||||||
addItemToInventory(newItem(ITEM_GOLD_APPLE,1), &(pd->inventory));
|
addItemToInventory(newItem(ITEM_GOLD_APPLE,1), &(pd->inventory));
|
||||||
addItemToInventory(newItem(ITEM_STRENGTH_POTION,1), &(pd->inventory));
|
addItemToInventory(newItem(ITEM_STRENGTH_POTION,1), &(pd->inventory));
|
||||||
addItemToInventory(newItem(ITEM_REGEN_POTION,1), &(pd->inventory));
|
addItemToInventory(newItem(ITEM_REGEN_POTION,1), &(pd->inventory));
|
||||||
|
@ -441,24 +441,52 @@ void tickPlayer(PlayerData *pd, bool inmenu) {
|
||||||
pd->entity.p.ay = 0;
|
pd->entity.p.ay = 0;
|
||||||
|
|
||||||
if (pd->inputs.k_left.down){
|
if (pd->inputs.k_left.down){
|
||||||
pd->entity.p.ax -= 1;
|
if(UnderSpeedEffect) {
|
||||||
pd->entity.p.dir = 2;
|
pd->entity.p.ax -= 2;
|
||||||
++pd->entity.p.walkDist;
|
pd->entity.p.dir = 2;
|
||||||
|
++pd->entity.p.walkDist;
|
||||||
|
++pd->entity.p.walkDist;
|
||||||
|
} else {
|
||||||
|
pd->entity.p.ax -= 1;
|
||||||
|
pd->entity.p.dir = 2;
|
||||||
|
++pd->entity.p.walkDist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (pd->inputs.k_right.down){
|
if (pd->inputs.k_right.down){
|
||||||
pd->entity.p.ax += 1;
|
if(UnderSpeedEffect) {
|
||||||
pd->entity.p.dir = 3;
|
pd->entity.p.ax += 2;
|
||||||
++pd->entity.p.walkDist;
|
pd->entity.p.dir = 3;
|
||||||
|
++pd->entity.p.walkDist;
|
||||||
|
++pd->entity.p.walkDist;
|
||||||
|
} else {
|
||||||
|
pd->entity.p.ax += 1;
|
||||||
|
pd->entity.p.dir = 3;
|
||||||
|
++pd->entity.p.walkDist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (pd->inputs.k_up.down){
|
if (pd->inputs.k_up.down){
|
||||||
pd->entity.p.ay -= 1;
|
if(UnderSpeedEffect) {
|
||||||
pd->entity.p.dir = 1;
|
pd->entity.p.ay -= 2;
|
||||||
++pd->entity.p.walkDist;
|
pd->entity.p.dir = 1;
|
||||||
|
++pd->entity.p.walkDist;
|
||||||
|
++pd->entity.p.walkDist;
|
||||||
|
} else {
|
||||||
|
pd->entity.p.ay -= 1;
|
||||||
|
pd->entity.p.dir = 1;
|
||||||
|
++pd->entity.p.walkDist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (pd->inputs.k_down.down){
|
if (pd->inputs.k_down.down){
|
||||||
pd->entity.p.ay += 1;
|
if(UnderSpeedEffect) {
|
||||||
pd->entity.p.dir = 0;
|
pd->entity.p.ay += 2;
|
||||||
++pd->entity.p.walkDist;
|
pd->entity.p.dir = 0;
|
||||||
|
++pd->entity.p.walkDist;
|
||||||
|
++pd->entity.p.walkDist;
|
||||||
|
} else {
|
||||||
|
pd->entity.p.ay += 1;
|
||||||
|
pd->entity.p.dir = 0;
|
||||||
|
++pd->entity.p.walkDist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (pd->entity.p.staminaRechargeDelay % 2 == 0) moveMob(&(pd->entity), pd->entity.p.ax, pd->entity.p.ay);
|
if (pd->entity.p.staminaRechargeDelay % 2 == 0) moveMob(&(pd->entity), pd->entity.p.ax, pd->entity.p.ay);
|
||||||
|
|
||||||
|
@ -485,15 +513,24 @@ void tickPlayer(PlayerData *pd, bool inmenu) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//swimming stamina and drowning
|
//swimming stamina and drowning
|
||||||
if (swimming && pd->entity.p.swimTimer % 60 == 0) {
|
if (swimming && pd->entity.p.swimTimer % 60 == 0 && UnderSwimBreathEffect != true) {
|
||||||
if (pd->entity.p.stamina > 0) {
|
if (pd->entity.p.stamina > 0) {
|
||||||
if(!shouldRenderDebug) --pd->entity.p.stamina;
|
if(!shouldRenderDebug) --pd->entity.p.stamina;
|
||||||
} else {
|
} else {
|
||||||
hurtEntity(&(pd->entity), 1, -1, 0xFFAF00FF, NULL);
|
hurtEntity(&(pd->entity), 1, -1, 0xFFAF00FF, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Regen healing
|
||||||
|
if (regening && pd->entity.p.regenTimer % 75 == 0) {
|
||||||
|
playerHeal(pd, 1);
|
||||||
|
}
|
||||||
|
|
||||||
if(isWater(pd->entity.level, pd->entity.x>>4, pd->entity.y>>4)) ++pd->entity.p.swimTimer;
|
if(isWater(pd->entity.level, pd->entity.x>>4, pd->entity.y>>4)) ++pd->entity.p.swimTimer;
|
||||||
|
if(regening) ++pd->entity.p.regenTimer;
|
||||||
|
if(UnderSpeedEffect) ++pd->entity.p.speedTimer;
|
||||||
|
if(UnderStrengthEffect) ++pd->entity.p.strengthTimer;
|
||||||
|
if(UnderSwimBreathEffect) ++pd->entity.p.swimBreathTimer;
|
||||||
if(pd->entity.p.attackTimer > 0) --pd->entity.p.attackTimer;
|
if(pd->entity.p.attackTimer > 0) --pd->entity.p.attackTimer;
|
||||||
|
|
||||||
//TODO - maybe move to own function
|
//TODO - maybe move to own function
|
||||||
|
|
|
@ -70,7 +70,8 @@ void updateMusic(int lvl, int time) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadSounds() {
|
void loadSounds() {
|
||||||
loadSound(&snd_playerHurt, "resources/playerhurt.raw");
|
Result rc = romfsInit();
|
||||||
|
loadSound(&snd_playerHurt, "romfs:/resources/playerhurt.raw");
|
||||||
loadSound(&snd_playerDeath, "resources/playerdeath.raw");
|
loadSound(&snd_playerDeath, "resources/playerdeath.raw");
|
||||||
loadSound(&snd_monsterHurt, "resources/monsterhurt.raw");
|
loadSound(&snd_monsterHurt, "resources/monsterhurt.raw");
|
||||||
loadSound(&snd_test, "resources/test.raw");
|
loadSound(&snd_test, "resources/test.raw");
|
||||||
|
@ -78,7 +79,7 @@ void loadSounds() {
|
||||||
loadSound(&snd_bossdeath, "resources/bossdeath.raw");
|
loadSound(&snd_bossdeath, "resources/bossdeath.raw");
|
||||||
loadSound(&snd_craft, "resources/craft.raw");
|
loadSound(&snd_craft, "resources/craft.raw");
|
||||||
|
|
||||||
loadSound(&music_menu, "resources/music/menu.raw");
|
loadSound(&music_menu, "romfs:/resources/music/menu.raw");
|
||||||
loadSound(&music_floor0, "resources/music/floor0.raw");
|
loadSound(&music_floor0, "resources/music/floor0.raw");
|
||||||
loadSound(&music_floor1, "resources/music/floor1.raw");
|
loadSound(&music_floor1, "resources/music/floor1.raw");
|
||||||
loadSound(&music_floor1_night, "resources/music/floor1_night.raw");
|
loadSound(&music_floor1_night, "resources/music/floor1_night.raw");
|
||||||
|
|
Loading…
Add table
Reference in a new issue