This commit is contained in:
2025-06-07 00:57:00 +02:00
parent d4665c4e9b
commit 64cac7578d
100 changed files with 464 additions and 169 deletions

13
main.c
View File

@@ -139,6 +139,7 @@ int init() {
initAtlas(mainRenderer);
loadBackgroundTiles(mainRenderer);
loadTiles(mainRenderer);
loadItems(mainRenderer);
setupTiles();
@@ -506,6 +507,9 @@ void processKeyboardHeld() {
setActivePlayerSlot(&player, 0);
}
}
if (keyboardState[SDL_SCANCODE_F9]) {
player.inventory.slotCounts[player.inventory.activeSlotIndex]++;
}
if (keyboardState[SDL_SCANCODE_Y]) {
if (player.cursor.canReach && player.cursor.targetTile->type == TYPE_BELT &&
player.inventory.slotCounts[player.inventory.activeSlotIndex] > 0) {
@@ -586,6 +590,7 @@ int main(__attribute__((unused)) int argc, __attribute__((unused)) char *args[])
updateItems();
updatePlayer(&player);
updateTiles();
animationStep++;
status = render();
if (status) {
return status;
@@ -655,15 +660,15 @@ void genInitMap() {
// [Same as your original terrain generation logic...]
BackgroundType baseType;
if (terrain < 0.30) {
baseType = (humidity < 0.5) ? BGType_WATER0 : BGType_WATER1;
baseType = (humidity < 0.5) ? BGType_WATER_SHALLOW : BGType_WATER_DEEP;
} else if (terrain < 0.35) {
if (humidity < 0.3) baseType = BGType_SAND4;
else if (humidity < 0.6) baseType = BGType_SAND2;
else baseType = BGType_SAND7;
} else if (terrain < 0.7) {
double grassVal = (terrain - 0.35) / (0.70 - 0.35);
int idx = (int) (grassVal * 8.0);
if (idx >= 8) idx = 7;
int idx = (int) (grassVal * 3.0);
if (idx >= 4) idx = 3;
if (humidity > 0.6 && ((rand() & 0xFF) < 10)) {
int flowerIdx = rand() % 4;
baseType = (BackgroundType) (BGType_GRASS_FLOWER0 + flowerIdx);
@@ -679,7 +684,7 @@ void genInitMap() {
}
BackgroundType finalType = baseType;
if (baseType != BGType_WATER0 && baseType != BGType_WATER1) {
if (baseType != BGType_WATER_SHALLOW && baseType != BGType_WATER_DEEP) {
if (oreNrm > 0.86) {
double sub = (oreNrm - 0.86) / (1.0 - 0.86);
if (sub < 0.25) finalType = BGType_PLATINUM_ORE;