all repos — hyperkaos @ 5fc726bcdb25957a1cd37c92a245b7f9f8b8d16c

lightweight modular puzzle/adventure game engine in C with SDL 1.2

working on world data interpreter
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAlxeBP8ACgkQO3+8IhRO
Y5iEWg//YYMM0pzCNz5OHnBUQhsEt9wK9va2tLZii45Y9upfUuKdnN2K5Xex6ga6
nJ3sfihCzQIx8cvXE6zrMmT+6SvuHI7xaR5nwVm2KjrvQjSOBRi6O0S43eHrrnT6
HJvfp99A5K+POBoBLbDTGvDhfmzimxUo+kxYffQ1foyiuAQgsIPb+ywXmZgjL+Vr
2lYI5icFuvQcWk1CrPO2kjDg6K6+u+Zmj5m9w2SvGG4XLD8lEfdw520bAc/Me1zy
QGNKcxJik+G+dGatOP7hCXoZ7iu5r9YDeOpsbhMlaUMiBUgmoPDNOHPlsxSZ2rgk
UvZrwsbmOl0XszjJkDpI8kXsWtVHW/kTjNRsiJGfQZQBk43Qt49tCgD6CI5JpinK
Um4prArX5x3ENbZJALifSa70csXyHDRMzQnbEnowDoOgDfuFn/HxGJrLyFNsjZiN
rQuiiToTQyDmhweIM2onJmra9xxcuMBnK8w+3CG6AzgRgVUChR6k5yCRbJHJwmZh
n8HvqtgpfhqRAkVz/5s9fvkI4o4+vBdJjInqHZWSiqA9oa52Yye8R7pkSy0gHUUb
zFdVKRmiU+q+QRWOaQVeRmyfxQfs/6gbGOxTyCtCqHh70x7DzcrTtEOmqYhtuCAN
s0GdoDjRJn9/Rs77rg74fb8XujUojs+80sRzS8agDRTl07Xzwds=
=lajF
-----END PGP SIGNATURE-----
commit

5fc726bcdb25957a1cd37c92a245b7f9f8b8d16c

parent

456cba7e6c1f00986e18f695c63050d5cccdb96f

3 files changed, 60 insertions(+), 6 deletions(-)

jump to
M WorldData.cWorldData.c

@@ -117,17 +117,19 @@ case 100: //addSigil

// buildSynergy(propsBuffer); break; case 47: //addPerson -// buildPerson(propsBuffer); + buildPerson(propsBuffer); break; case 88: //addObstruction -// buildObstruction(propsBuffer); + buildObstruction(propsBuffer); break; case 141: //addImg // buildFGImage(propsBuffer); break; case 240: //addTrigger -// buildHyper(propsBuffer); + buildHyper(propsBuffer); break; + case 148: //chainKaos + //chainKaos(propsBuffer); case 238: //addWarp buildWarp(propsBuffer); break;

@@ -144,7 +146,7 @@ int slot;

char filename[256]; int breathe; - if (sscanf(props, "slot %d, sprite %[^,], spd %d", &slot, filename, &breathe) != 3) + if (sscanf(props, "slot %u, sprite %[^,], spd %u", &slot, filename, &breathe) != 3) { return 1; }

@@ -153,15 +155,59 @@ mapBuffer[slot] = newRoom(filename, breathe);

return 0; } +int buildObstruction(char* props) +{ + int rm, x, y, w, h; + + if (sscanf(props, "room %u, x %d, y %d, w %u, h %u", + &rm, &x, &y, &w, &h) != 5) + { + return 1; + } + addObstacle(mapBuffer[rm], x, y, w, h); + return 0; +} + int buildWarp(char* props) { int r, x, y, w, h, dC, dR, dX, dY; - if (sscanf(props, "room %d, x %d, y %d, w %d, h %d, dest %d,%d, dX %d, dY %d", + if (sscanf(props, "room %u, x %d, y %d, w %u, h %u, dest %u,%u, dX %d, dY %d", &r, &x, &y, &w, &h, &dC, &dR, &dX, &dY) != 9) { return 1; } + printf("Building warp...\n"); addWarp(mapBuffer[r], x, y, w, h, dC, dR, dX, dY); + return 0; +} + +int buildHyper(char* props) +{ + int rm, id, tType, x, y, w, h; + if (sscanf(props, "room %u, id %u, type %u, x %d, y %d, w %u, h %u", + &rm, &id, &tType, &x, &y, &w, &h) != 7) + { + return 1; + } + printf("Building hyperkaos...\n"); + HyperKaos* temp = newHyperKaos(id, tType, x, y, w, h); + addTrigger(mapBuffer[rm], temp); + return 0; +} + +int buildPerson(char* props) +{ + int rm, x, y; + char filename[256]; + + if (sscanf(props, "room %u, sprite %[^,], x %d, y%d", + &rm, filename, &x, &y) != 4) + { + return 1; + } + printf("Building person...\n"); + Player* temp = newPlayer(filename, x, y); + addPerson(mapBuffer[rm], temp); return 0; }
M WorldData.hWorldData.h

@@ -7,6 +7,12 @@ int buildRoom(char* props);

int buildWarp(char* props); +int buildHyper(char* props); + +int buildPerson(char* props); + +int buildObstruction(char* props); + int countMapThings(char x, enum dataChunks chunk); void unloadData(enum dataChunks chunk);
M mapdata/1.txtmapdata/1.txt

@@ -2,4 +2,6 @@ mkRoom: slot 0, sprite assets/img/backgrounds/blueroom.png, spd 4

mkRoom: slot 1, sprite assets/img/backgrounds/darkroom.png, spd 4 addWarp: room 0, x 0, y 0, w 320, h 8, dest 1,1, dX 160, dY 164 addWarp: room 1, x 0, y 172, w 320, h 8, dest 1,0, dX 160, dY 16 -#addPerson: room 0, sprite assets/img/people/kmage.png, x 20, y 30 +addTrigger: room 1, id 0, type 0, x 0, y 0, w 320, h 180 +addPerson: room 1, sprite assets/img/characters/kmage.png, x 20, y 30 +addObstruction: room 1, x 10, y 16, w 20, h 20