diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..87e5dfe --- /dev/null +++ b/LICENSE @@ -0,0 +1,29 @@ +THE FOLLOWING LICENSE APPLIES TO ALL SOURCE CODE PRESENT IN THIS REPOSITORY + +Copyright © 2021 KikooDX + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +THE FOLLOWING LICENSE APPLIES TO ALL LEVEL ASSETS PRESENT IN THIS REPOSITORY + +Copyright © 2021 KikooDX + +This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. +To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ or +send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6f8e6d5 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# Painfull Success CG + +## License +The code is under the MIT license. +Levels and colors are under CC-BY-SA.4.0. +See LICENSE for more details. diff --git a/include/conf.h b/include/conf.h index 824bb9d..99241d8 100644 --- a/include/conf.h +++ b/include/conf.h @@ -1,3 +1,9 @@ +/* SPDX-License-Identifier: MIT + * Copyright (c) 2021 KikooDX + * This file is part of + * [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg), + * which is MIT licensed. The MIT license requires this copyright notice to be + * included in all copies and substantial portions of the software. */ #pragma once #define TARGET_UPS 60 @@ -8,3 +14,5 @@ #define LEVEL_SIZE (LEVEL_WIDTH * LEVEL_HEIGHT) #define DRAW_OFFSET_X 70 #define DRAW_OFFSET_Y 0 +#define PLAYER_WIDTH 12 +#define PLAYER_HEIGHT 12 diff --git a/include/input.h b/include/input.h index acd0228..912c8c4 100644 --- a/include/input.h +++ b/include/input.h @@ -1,3 +1,9 @@ +/* SPDX-License-Identifier: MIT + * Copyright (c) 2021 KikooDX + * This file is part of + * [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg), + * which is MIT licensed. The MIT license requires this copyright notice to be + * included in all copies and substantial portions of the software. */ #pragma once #include #include diff --git a/include/level.h b/include/level.h index 4a8ca8f..45cb45b 100644 --- a/include/level.h +++ b/include/level.h @@ -1,3 +1,9 @@ +/* SPDX-License-Identifier: MIT + * Copyright (c) 2021 KikooDX + * This file is part of + * [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg), + * which is MIT licensed. The MIT license requires this copyright notice to be + * included in all copies and substantial portions of the software. */ #pragma once #include #include "conf.h" diff --git a/include/player.h b/include/player.h index 87b5396..00ac29c 100644 --- a/include/player.h +++ b/include/player.h @@ -1,3 +1,9 @@ +/* SPDX-License-Identifier: MIT + * Copyright (c) 2021 KikooDX + * This file is part of + * [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg), + * which is MIT licensed. The MIT license requires this copyright notice to be + * included in all copies and substantial portions of the software. */ #pragma once #include #include "vec2.h" diff --git a/include/tiles.h b/include/tiles.h index d97b396..d9e6665 100644 --- a/include/tiles.h +++ b/include/tiles.h @@ -1,3 +1,9 @@ +/* SPDX-License-Identifier: MIT + * Copyright (c) 2021 KikooDX + * This file is part of + * [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg), + * which is MIT licensed. The MIT license requires this copyright notice to be + * included in all copies and substantial portions of the software. */ #pragma once typedef uint8_t tile_t; diff --git a/include/vec2.h b/include/vec2.h index c7cac25..a0a1861 100644 --- a/include/vec2.h +++ b/include/vec2.h @@ -1,3 +1,9 @@ +/* SPDX-License-Identifier: MIT + * Copyright (c) 2021 KikooDX + * This file is part of + * [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg), + * which is MIT licensed. The MIT license requires this copyright notice to be + * included in all copies and substantial portions of the software. */ #pragma once #include diff --git a/src/input.c b/src/input.c index d5c12eb..2f07907 100644 --- a/src/input.c +++ b/src/input.c @@ -1,11 +1,18 @@ +/* SPDX-License-Identifier: MIT + * Copyright (c) 2021 KikooDX + * This file is part of + * [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg), + * which is MIT licensed. The MIT license requires this copyright notice to be + * included in all copies and substantial portions of the software. */ #include +#include #include "input.h" void input_update(Input *input) { /* Read full input stream. */ clearevents(); /* For each key, update state. */ - for (int i = 0; i < KEYS_COUNT; ++i) { + for (uint8_t i = 0; i < KEYS_COUNT; ++i) { uint8_t *state = &input->states[i]; const uint8_t key = input->keys[i]; /* See if the key is pressed. */ @@ -34,7 +41,7 @@ void input_init(Input *input) { input->keys[K_JUMP] = KEY_SHIFT; input->keys[K_RESTART] = KEY_6; input->keys[K_EXIT] = KEY_EXIT; - for (int i = 0; i < KEYS_COUNT; ++i) + for (uint8_t i = 0; i < KEYS_COUNT; ++i) input->states[i] = S_UP; } diff --git a/src/level.c b/src/level.c index 686f0f5..d00209c 100644 --- a/src/level.c +++ b/src/level.c @@ -1,4 +1,11 @@ +/* SPDX-License-Identifier: MIT + * Copyright (c) 2021 KikooDX + * This file is part of + * [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg), + * which is MIT licensed. The MIT license requires this copyright notice to be + * included in all copies and substantial portions of the software. */ #include +#include #include "level.h" #include "tiles.h" @@ -7,9 +14,9 @@ void level_draw(Level level) { uint16_t x = DRAW_OFFSET_X; uint16_t y = DRAW_OFFSET_Y; /* Cursor position. */ - uint16_t cx = 0; + uint8_t cx = 0; while (cx < LEVEL_WIDTH) { - uint16_t cy = 0; + uint8_t cy = 0; while (cy < LEVEL_HEIGHT) { const tile_t tile = level.content[cy * LEVEL_WIDTH + cx]; const int color = tile_color(tile); diff --git a/src/main.c b/src/main.c index 6211d06..f050681 100644 --- a/src/main.c +++ b/src/main.c @@ -1,3 +1,9 @@ +/* SPDX-License-Identifier: MIT + * Copyright (c) 2021 KikooDX + * This file is part of + * [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg), + * which is MIT licensed. The MIT license requires this copyright notice to be + * included in all copies and substantial portions of the software. */ #include #include #include diff --git a/src/player.c b/src/player.c index 7a71554..ddf4d5c 100644 --- a/src/player.c +++ b/src/player.c @@ -1,3 +1,11 @@ +/* SPDX-License-Identifier: MIT + * Copyright (c) 2021 KikooDX + * This file is part of + * [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg), + * which is MIT licensed. The MIT license requires this copyright notice to be + * included in all copies and substantial portions of the software. */ +#include +#include #include "player.h" #include "vec2.h" diff --git a/src/tiles.c b/src/tiles.c index aaf6aec..fbd65c4 100644 --- a/src/tiles.c +++ b/src/tiles.c @@ -1,3 +1,9 @@ +/* SPDX-License-Identifier: MIT + * Copyright (c) 2021 KikooDX + * This file is part of + * [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg), + * which is MIT licensed. The MIT license requires this copyright notice to be + * included in all copies and substantial portions of the software. */ #include #include "tiles.h"