From ee3af3dadd0966add98747dd6cc2636c61f5b2cd Mon Sep 17 00:00:00 2001 From: kdx Date: Sun, 26 Mar 2023 20:04:31 +0200 Subject: game end --- map/brulez.tmj | 1610 ++++++++++++++++++++++++++++++++++++++++++++++-- res/blan.wav | Bin 0 -> 38956 bytes res/box.bmp | Bin 0 -> 16522 bytes res/box0.wav | Bin 0 -> 38956 bytes res/box1.wav | Bin 0 -> 42028 bytes res/boxdestroyed.bmp | Bin 0 -> 16522 bytes res/clock.bmp | Bin 0 -> 4234 bytes res/clockdestroyed.bmp | Bin 0 -> 4234 bytes src/alarm.c | 17 + src/box.c | 24 + src/cfg.h | 4 +- src/entity.c | 4 +- src/game.h | 2 +- src/main.c | 6 + src/player.c | 4 +- src/window.c | 1 + 16 files changed, 1602 insertions(+), 70 deletions(-) create mode 100644 res/blan.wav create mode 100644 res/box.bmp create mode 100644 res/box0.wav create mode 100644 res/box1.wav create mode 100644 res/boxdestroyed.bmp create mode 100644 res/clock.bmp create mode 100644 res/clockdestroyed.bmp create mode 100644 src/box.c diff --git a/map/brulez.tmj b/map/brulez.tmj index c846cf2..df7c6b5 100644 --- a/map/brulez.tmj +++ b/map/brulez.tmj @@ -1,29 +1,67 @@ { "compressionlevel":-1, - "height":14, + "height":30, "infinite":false, "layers":[ { - "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":30, "id":1, "name":"Tile Layer 1", "opacity":1, "type":"tilelayer", "visible":false, - "width":25, + "width":40, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "id":4, + "name":"Object Layer 3", + "objects":[ + { + "height":0, + "id":40, + "name":"alarm", + "rotation":0, + "type":"", + "visible":true, + "width":0, + "x":245, + "y":387 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, "x":0, "y":0 }, @@ -34,135 +72,1579 @@ "objects":[ { "height":64, - "id":2, + "id":2, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":445, + "y":180 + }, + { + "height":64, + "id":5, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":169, + "y":203 + }, + { + "height":64, + "id":6, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":575, + "y":131 + }, + { + "height":64, + "id":7, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":287, + "y":131 + }, + { + "height":64, + "id":8, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":22, + "y":172 + }, + { + "height":64, + "id":9, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":374, + "y":395 + }, + { + "height":64, + "id":10, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":538, + "y":325 + }, + { + "height":64, + "id":11, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":369, + "y":297 + }, + { + "height":64, + "id":12, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":51, + "y":340 + }, + { + "height":64, + "id":13, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":151, + "y":70 + }, + { + "height":64, + "id":14, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":371, + "y":56 + }, + { + "height":64, + "id":18, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":504, + "y":328 + }, + { + "height":64, + "id":19, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":101, + "y":368 + }, + { + "height":64, + "id":20, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":517, + "y":385 + }, + { + "height":64, + "id":21, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":153, + "y":337 + }, + { + "height":64, + "id":22, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":441, + "y":360 + }, + { + "height":64, + "id":23, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":308, + "y":364 + }, + { + "height":64, + "id":24, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":106, + "y":318 + }, + { + "height":64, + "id":25, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":383, + "y":324 + }, + { + "height":64, + "id":26, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":200, + "y":339 + }, + { + "height":64, + "id":27, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":75, + "y":360 + }, + { + "height":64, + "id":28, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":178, + "y":359 + }, + { + "height":64, + "id":29, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":163, + "y":416 + }, + { + "height":64, + "id":30, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":231, + "y":362 + }, + { + "height":64, + "id":31, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":231, + "y":372 + }, + { + "height":64, + "id":32, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":324, + "y":336 + }, + { + "height":64, + "id":33, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":320, + "y":332 + }, + { + "height":64, + "id":34, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":464, + "y":395 + }, + { + "height":64, + "id":35, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":451, + "y":284 + }, + { + "height":64, + "id":36, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":473, + "y":323 + }, + { + "height":64, + "id":37, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":215, + "y":379 + }, + { + "height":64, + "id":38, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":281, + "y":371 + }, + { + "height":64, + "id":39, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":285, + "y":305 + }, + { + "height":64, + "id":49, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":359, + "y":165 + }, + { + "height":64, + "id":50, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":83, + "y":188 + }, + { + "height":64, + "id":51, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":489, + "y":116 + }, + { + "height":64, + "id":52, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":201, + "y":116 + }, + { + "height":64, + "id":53, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":-34, + "y":98 + }, + { + "height":64, + "id":54, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":65, + "y":55 + }, + { + "height":64, + "id":55, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":285, + "y":41 + }, + + { + "height":64, + "id":65, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":564, + "y":174 + }, + { + "height":64, + "id":66, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":288, + "y":197 + }, + { + "height":64, + "id":67, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":577, + "y":48 + }, + { + "height":64, + "id":68, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":406, + "y":125 + }, + { + "height":64, + "id":69, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":141, + "y":166 + }, + { + "height":64, + "id":70, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":241, + "y":56 + }, + { + "height":64, + "id":71, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":490, + "y":50 + }, + { + "height":0, + "id":171, + "name":"alarm", + "rotation":0, + "type":"", + "visible":true, + "width":0, + "x":290, + "y":361 + }, + { + "height":64, + "id":172, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":490, + "y":154 + }, + { + "height":64, + "id":173, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":214, + "y":177 + }, + { + "height":64, + "id":174, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":620, + "y":105 + }, + { + "height":64, + "id":175, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":332, + "y":105 + }, + { + "height":64, + "id":176, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":67, + "y":146 + }, + { + "height":64, + "id":177, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":419, + "y":369 + }, + { + "height":64, + "id":178, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":583, + "y":299 + }, + { + "height":64, + "id":179, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":414, + "y":271 + }, + { + "height":64, + "id":180, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":96, + "y":314 + }, + { + "height":64, + "id":181, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":196, + "y":44 + }, + { + "height":64, + "id":182, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":416, + "y":30 + }, + { + "height":64, + "id":183, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":549, + "y":302 + }, + { + "height":64, + "id":184, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":146, + "y":342 + }, + { + "height":64, + "id":185, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":562, + "y":359 + }, + { + "height":64, + "id":186, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":198, + "y":311 + }, + { + "height":64, + "id":187, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":486, + "y":334 + }, + { + "height":64, + "id":188, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":353, + "y":338 + }, + { + "height":64, + "id":189, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":151, + "y":292 + }, + { + "height":64, + "id":190, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":428, + "y":298 + }, + { + "height":64, + "id":191, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":245, + "y":313 + }, + { + "height":64, + "id":192, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":120, + "y":334 + }, + { + "height":64, + "id":193, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":223, + "y":333 + }, + { + "height":64, + "id":194, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":208, + "y":390 + }, + { + "height":64, + "id":195, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":276, + "y":336 + }, + { + "height":64, + "id":196, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":276, + "y":346 + }, + { + "height":64, + "id":197, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":369, + "y":310 + }, + { + "height":64, + "id":198, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":365, + "y":306 + }, + { + "height":64, + "id":199, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":509, + "y":369 + }, + { + "height":64, + "id":200, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":496, + "y":258 + }, + { + "height":64, + "id":201, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":518, + "y":297 + }, + { + "height":64, + "id":202, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":260, + "y":353 + }, + { + "height":64, + "id":203, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":326, + "y":345 + }, + + { + "height":64, + "id":204, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":330, + "y":279 + }, + { + "height":64, + "id":205, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":404, + "y":139 + }, + { + "height":64, + "id":206, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":128, + "y":162 + }, + { + "height":64, + "id":207, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":534, + "y":90 + }, + { + "height":64, + "id":208, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":246, + "y":90 + }, + { + "height":64, + "id":209, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":11, + "y":72 + }, + { + "height":64, + "id":210, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":110, + "y":29 + }, + { + "height":64, + "id":211, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":330, + "y":15 + }, + { + "height":64, + "id":212, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":609, + "y":148 + }, + { + "height":64, + "id":213, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":333, + "y":171 + }, + { + "height":64, + "id":214, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":622, + "y":22 + }, + { + "height":64, + "id":215, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":451, + "y":99 + }, + { + "height":64, + "id":216, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":186, + "y":140 + }, + { + "height":64, + "id":217, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":286, + "y":30 + }, + { + "height":64, + "id":218, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":535, + "y":24 + }, + { + "height":0, + "id":267, + "name":"alarm", + "rotation":0, + "type":"", + "visible":true, + "width":0, + "x":172, + "y":395 + }, + { + "height":64, + "id":268, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":372, + "y":188 + }, + { + "height":64, + "id":269, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":96, + "y":211 + }, + { + "height":64, + "id":270, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":502, + "y":139 + }, + { + "height":64, + "id":271, "name":"window", "rotation":0, "type":"", "visible":true, "width":64, - "x":283, - "y":59 + "x":214, + "y":139 }, { - "height":16, - "id":4, - "name":"alarm", + "height":64, + "id":272, + "name":"window", "rotation":0, "type":"", "visible":true, - "width":16, - "x":-26, - "y":-8 + "width":64, + "x":-51, + "y":180 }, { "height":64, - "id":5, + "id":273, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":301, + "y":403 + }, + { + "height":64, + "id":274, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":465, + "y":333 + }, + { + "height":64, + "id":275, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":296, + "y":305 + }, + { + "height":64, + "id":276, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":-22, + "y":348 + }, + { + "height":64, + "id":277, "name":"window", "rotation":0, "type":"", "visible":true, "width":64, - "x":51, - "y":56 + "x":78, + "y":78 }, { "height":64, - "id":6, + "id":278, "name":"window", "rotation":0, "type":"", "visible":true, "width":64, - "x":381, - "y":58 + "x":298, + "y":64 }, { "height":64, - "id":7, + "id":279, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":431, + "y":336 + }, + { + "height":64, + "id":280, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":28, + "y":376 + }, + { + "height":64, + "id":281, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":444, + "y":393 + }, + { + "height":64, + "id":282, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":80, + "y":345 + }, + { + "height":64, + "id":283, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":368, + "y":368 + }, + { + "height":64, + "id":284, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":235, + "y":372 + }, + { + "height":64, + "id":285, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":33, + "y":326 + }, + { + "height":64, + "id":286, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":310, + "y":332 + }, + { + "height":64, + "id":287, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":127, + "y":347 + }, + { + "height":64, + "id":288, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":2, + "y":368 + }, + { + "height":64, + "id":289, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":105, + "y":367 + }, + { + "height":64, + "id":290, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":90, + "y":424 + }, + { + "height":64, + "id":291, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":158, + "y":370 + }, + + { + "height":64, + "id":292, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":158, + "y":380 + }, + { + "height":64, + "id":293, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":251, + "y":344 + }, + { + "height":64, + "id":294, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":247, + "y":340 + }, + { + "height":64, + "id":295, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":391, + "y":403 + }, + { + "height":64, + "id":296, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":378, + "y":292 + }, + { + "height":64, + "id":297, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":400, + "y":331 + }, + { + "height":64, + "id":298, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":142, + "y":387 + }, + { + "height":64, + "id":299, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":208, + "y":379 + }, + { + "height":64, + "id":300, + "name":"box", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":212, + "y":313 + }, + { + "height":64, + "id":301, "name":"window", "rotation":0, "type":"", "visible":true, "width":64, - "x":165, - "y":54 + "x":286, + "y":173 }, { "height":64, - "id":8, + "id":302, "name":"window", "rotation":0, "type":"", "visible":true, "width":64, - "x":-41, - "y":71 + "x":10, + "y":196 }, { "height":64, - "id":9, + "id":303, "name":"window", "rotation":0, "type":"", "visible":true, "width":64, - "x":81, - "y":135 + "x":416, + "y":124 }, { "height":64, - "id":10, + "id":304, "name":"window", "rotation":0, "type":"", "visible":true, "width":64, - "x":347, - "y":136 + "x":128, + "y":124 }, { "height":64, - "id":11, + "id":305, "name":"window", "rotation":0, "type":"", "visible":true, "width":64, - "x":210, - "y":142 + "x":-107, + "y":106 }, { "height":64, - "id":12, + "id":306, "name":"window", "rotation":0, "type":"", "visible":true, "width":64, - "x":-19, - "y":161 + "x":-8, + "y":63 }, { "height":64, - "id":13, + "id":307, "name":"window", "rotation":0, "type":"", "visible":true, "width":64, - "x":65, - "y":-33 + "x":212, + "y":49 }, { "height":64, - "id":14, + "id":308, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":491, + "y":182 + }, + { + "height":64, + "id":309, "name":"window", "rotation":0, "type":"", "visible":true, "width":64, "x":215, - "y":-31 + "y":205 + }, + { + "height":64, + "id":310, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":504, + "y":56 + }, + { + "height":64, + "id":311, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":333, + "y":133 + }, + { + "height":64, + "id":312, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":68, + "y":174 + }, + { + "height":64, + "id":313, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":168, + "y":64 + }, + { + "height":64, + "id":314, + "name":"window", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":417, + "y":58 }], "opacity":1, "type":"objectgroup", @@ -176,24 +1658,24 @@ "name":"Object Layer 2", "objects":[ { - "height":16, - "id":15, + "height":0, + "id":74, "name":"player", "rotation":0, "type":"", "visible":true, - "width":16, - "x":190, - "y":112 + "width":0, + "x":294, + "y":134 }], "opacity":1, "type":"objectgroup", - "visible":true, + "visible":false, "x":0, "y":0 }], - "nextlayerid":4, - "nextobjectid":16, + "nextlayerid":5, + "nextobjectid":315, "orientation":"orthogonal", "renderorder":"right-down", "tiledversion":"1.10.0", @@ -206,5 +1688,5 @@ "tilewidth":16, "type":"map", "version":"1.10", - "width":25 + "width":40 } \ No newline at end of file diff --git a/res/blan.wav b/res/blan.wav new file mode 100644 index 0000000..a4e755b Binary files /dev/null and b/res/blan.wav differ diff --git a/res/box.bmp b/res/box.bmp new file mode 100644 index 0000000..110c467 Binary files /dev/null and b/res/box.bmp differ diff --git a/res/box0.wav b/res/box0.wav new file mode 100644 index 0000000..e4927e9 Binary files /dev/null and b/res/box0.wav differ diff --git a/res/box1.wav b/res/box1.wav new file mode 100644 index 0000000..82c833a Binary files /dev/null and b/res/box1.wav differ diff --git a/res/boxdestroyed.bmp b/res/boxdestroyed.bmp new file mode 100644 index 0000000..76471e9 Binary files /dev/null and b/res/boxdestroyed.bmp differ diff --git a/res/clock.bmp b/res/clock.bmp new file mode 100644 index 0000000..03a7321 Binary files /dev/null and b/res/clock.bmp differ diff --git a/res/clockdestroyed.bmp b/res/clockdestroyed.bmp new file mode 100644 index 0000000..390209d Binary files /dev/null and b/res/clockdestroyed.bmp differ diff --git a/src/alarm.c b/src/alarm.c index 247f369..95fb6b0 100644 --- a/src/alarm.c +++ b/src/alarm.c @@ -1,6 +1,23 @@ #include "entityimpl.h" #include "lzr.h" +#include "entityimpl.h" + +IMPL(draw) { + const LZR_ImageDrawSettings stg = + {0, 0, -1, -1, 1.0, 1.0, 0.0, true, false, false}; + LZR_DrawSetColor(1, 1, 1, 1); + LZR_DrawImageEx(LZR_IMAGE(this->broken ? "res/clockdestroyed.bmp" : "res/clock.bmp"), + this->pos[0], this->pos[1], stg); +} + +IMPL(smash) { + LZR_PlaySound(4); + LZR_StopMusic(); + this->smash = NULL; + this->broken = 1; +} IMPL_INIT(alarm) { LZR_PlayMusic("res/alarm.wav", -1); + this->width = this->height = 32; } diff --git a/src/box.c b/src/box.c new file mode 100644 index 0000000..df4b9c7 --- /dev/null +++ b/src/box.c @@ -0,0 +1,24 @@ +#include "entityimpl.h" +#include "lzr.h" + +IMPL(draw) { + const LZR_ImageDrawSettings stg = + {0, 0, -1, -1, 1.0, 1.0, 0.0, true, false, false}; + LZR_DrawSetColor(1, 1, 1, 1); + LZR_DrawImageEx(LZR_IMAGE(this->broken ? "res/boxdestroyed.bmp" : "res/box.bmp"), + this->pos[0], this->pos[1], stg); +} + +IMPL(smash) { + LZR_PlaySound(2 + this->broken); + if (this->broken) { + this->type = 0; + this->smash = NULL; + } + this->broken = 1; +} + +IMPL_INIT(box) { + this->width = this->height = 64; + this->broken = 0; +} diff --git a/src/cfg.h b/src/cfg.h index c0e8f4e..b758932 100644 --- a/src/cfg.h +++ b/src/cfg.h @@ -1,8 +1,8 @@ #pragma once #include "lzr.h" -#define DWIDTH 400 -#define DHEIGHT 224 +#define DWIDTH 640 +#define DHEIGHT 480 #define TARGET_FPS 30 #define TSIZE 16 diff --git a/src/entity.c b/src/entity.c index 07bea1e..9d495d2 100644 --- a/src/entity.c +++ b/src/entity.c @@ -46,8 +46,8 @@ entity_meet(Entity *this, Entity *other) Entity * entity_place_meeting(Entity *this, struct Game *g, unsigned int type) { - for (__auto_type i = 0; i < MAX_ENTITIES; i++) - if (this != &g->entities[i] && (type == -1u || g->entities[i].type == type) && + for (__auto_type i = MAX_ENTITIES - 1; i >= 0; i--) + if (this != &g->entities[i] && ((type == -1u && g->entities[i].smash != NULL) || g->entities[i].type == type) && entity_meet(this, &g->entities[i])) return &g->entities[i]; return NULL; diff --git a/src/game.h b/src/game.h index 2d563f0..ac1455c 100644 --- a/src/game.h +++ b/src/game.h @@ -1,7 +1,7 @@ #pragma once #include "entity.h" -enum { MAX_ENTITIES = 128 }; +enum { MAX_ENTITIES = 512 }; typedef struct Game { unsigned long uuid; diff --git a/src/main.c b/src/main.c index 7aaf2a0..c8789b8 100644 --- a/src/main.c +++ b/src/main.c @@ -32,6 +32,12 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char **argv) return 1; if (LZR_SoundLoad("res/glass.wav", 10.0) < 0) return 1; + if (LZR_SoundLoad("res/box0.wav", 10.0) < 0) + return 1; + if (LZR_SoundLoad("res/box1.wav", 10.0) < 0) + return 1; + if (LZR_SoundLoad("res/blan.wav", 20.0) < 0) + return 1; while (!LZR_ShouldQuit()) { LZR_CycleEvents(); diff --git a/src/player.c b/src/player.c index de51b1c..947b218 100644 --- a/src/player.c +++ b/src/player.c @@ -13,15 +13,17 @@ IMPL(draw) { } IMPL(update) { + static int prev_mouse_l; LZR_MousePosition(&this->pos[0], &this->pos[1]); this->player.recoil *= 0.9; - if (LZR_BUTTON(MOUSE_L) && this->player.recoil < 0.1) { + if (LZR_BUTTON(MOUSE_L) && !prev_mouse_l) { this->player.recoil = 1.0; LZR_PlaySound(0); __auto_type e = entity_place_meeting(this, g, -1); if (e != NULL && e->smash != NULL) e->smash(e, g); } + prev_mouse_l = LZR_BUTTON(MOUSE_L); } IMPL_INIT(player) { diff --git a/src/window.c b/src/window.c index 9eebb36..38a92a1 100644 --- a/src/window.c +++ b/src/window.c @@ -12,6 +12,7 @@ IMPL(draw) { IMPL(smash) { LZR_PlaySound(1); this->broken = 1; + this->smash = NULL; } IMPL_INIT(window) { -- cgit v1.2.3