summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 91283c3)
raw | patch | inline | side by side (parent: 91283c3)
author | fredboy <fredboy@protonmail.com> | |
Wed, 22 May 2024 13:03:32 +0000 (20:03 +0700) | ||
committer | fredboy <fredboy@protonmail.com> | |
Wed, 22 May 2024 13:03:32 +0000 (20:03 +0700) |
21 files changed:
diff --git a/core/build.gradle b/core/build.gradle
index ac46757aece221bb9eea06e31a2a7c99b5d44c08..bd932c35eec2bad922d71a23a6bb5e46ef337863 100644 (file)
--- a/core/build.gradle
+++ b/core/build.gradle
ksp "ru.fredboy:automultibind-ksp:1.0.0"
api "com.badlogicgames.gdx:gdx:$gdxVersion"
- api "com.google.guava:guava:$guavaVersion-android"
api "com.google.dagger:dagger:$daggerVersion"
implementation 'org.jetbrains:annotations:23.1.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
diff --git a/core/src/ru/deadsoftware/cavedroid/CaveGame.java b/core/src/ru/deadsoftware/cavedroid/CaveGame.java
index 9ca34b8e0507a5a42523accf769469847185661a..219f5b4a90f57c5c829e08aa1b893d7d2152a121 100644 (file)
import com.badlogic.gdx.Application;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
-import com.badlogic.gdx.Graphics;
+import org.jetbrains.annotations.Nullable;
import ru.deadsoftware.cavedroid.game.GameScreen;
import ru.deadsoftware.cavedroid.misc.Assets;
import ru.deadsoftware.cavedroid.misc.utils.AssetLoader;
import ru.deadsoftware.cavedroid.prefs.PreferencesStore;
-import javax.annotation.Nullable;
-
public class CaveGame extends Game {
private static final String TAG = "CaveGame";
diff --git a/core/src/ru/deadsoftware/cavedroid/MainConfig.java b/core/src/ru/deadsoftware/cavedroid/MainConfig.java
index 3ffb506285028aada2dd994cc104f772fc4ff59d..61cef0a3c858b356da7cdc7a6f850da6d86b2b02 100644 (file)
package ru.deadsoftware.cavedroid;
+import org.jetbrains.annotations.Nullable;
import ru.deadsoftware.cavedroid.game.GameUiWindow;
import ru.deadsoftware.cavedroid.game.input.Joystick;
import ru.deadsoftware.cavedroid.prefs.PreferencesStore;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.HashMap;
private final HashMap<String, String> mPreferencesCache = new HashMap<>();
- @CheckForNull
+ @Nullable
private FullscreenToggleListener mFullscreenToggleListener = null;
private final CaveGame mCaveGame;
private final PreferencesStore mPreferencesStore;
- @CheckForNull
+ @Nullable
private MainComponent mMainComponent;
- @CheckForNull
+ @Nullable
private Joystick mJoystick;
private GameUiWindow mGameUiWindow;
mAssetsPackPath = assetsPackPath;
}
- @CheckForNull
+ @Nullable
public Joystick getJoystick() {
return mJoystick;
}
- public void setJoystick(@CheckForNull Joystick joystick) {
+ public void setJoystick(@Nullable Joystick joystick) {
mJoystick = joystick;
}
- @CheckForNull
+ @Nullable
public String getPreference(String key) {
if (mPreferencesCache.containsKey(key)) {
return mPreferencesCache.get(key);
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameModule.java b/core/src/ru/deadsoftware/cavedroid/game/GameModule.java
index 29aac7df7e0f42be5364e1df21a5327fe3888697..6c71d78c4fe7441f8ab3df12617ca2f013bf8019 100644 (file)
import dagger.Module;
import dagger.Provides;
+import org.jetbrains.annotations.Nullable;
import ru.deadsoftware.cavedroid.MainConfig;
import ru.deadsoftware.cavedroid.game.mobs.MobsController;
import ru.deadsoftware.cavedroid.game.model.block.Block;
import ru.deadsoftware.cavedroid.game.ui.TooltipManager;
import ru.deadsoftware.cavedroid.game.world.GameWorld;
-import javax.annotation.CheckForNull;
-
@Module
public class GameModule {
- @CheckForNull
+ @Nullable
private static GameSaveData data;
public static boolean loaded = false;
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GamePhysics.java b/core/src/ru/deadsoftware/cavedroid/game/GamePhysics.java
index cece8e2c625ebe9e8823f9a5b347f063e5485e4b..406ee346b461859f3d436d82ab8f155cf286c8ee 100644 (file)
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
+import org.jetbrains.annotations.Nullable;
import ru.deadsoftware.cavedroid.MainConfig;
import ru.deadsoftware.cavedroid.game.mobs.Mob;
import ru.deadsoftware.cavedroid.game.mobs.MobsController;
import ru.deadsoftware.cavedroid.game.objects.drop.DropController;
import ru.deadsoftware.cavedroid.game.world.GameWorld;
-import javax.annotation.CheckForNull;
import javax.inject.Inject;
import java.util.Iterator;
/**
* @return colliding rect or null if no collision
*/
- @CheckForNull
+ @Nullable
private Rectangle checkColl(Rectangle rect) {
int minX = (int) ((rect.x + rect.width / 2) / 16) - 4;
int minY = (int) ((rect.y + rect.height / 2) / 16) - 4;
/**
* @return Rectangle representing magneting target for this drop
*/
- @CheckForNull
+ @Nullable
private Rectangle getShiftedMagnetingPlayerRect(Drop drop) {
final Player player = mMobsController.getPlayer();
return;
}
- @CheckForNull Rectangle collidingRect = checkColl(mob);
+ @Nullable Rectangle collidingRect = checkColl(mob);
if (collidingRect != null) {
if (mob.canJump() && !mob.isFlyMode() && collidingRect.y >= mob.y + mob.height - 8) {
}
private void mobYColl(Mob mob) {
- @CheckForNull final Rectangle collidingRect = checkColl(mob);
+ @Nullable final Rectangle collidingRect = checkColl(mob);
if (collidingRect != null) {
int d = -1;
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java b/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java
index 93dc8b95f233bd1abb8ac5e01c9efbece0498a30..e063e09af073cb21899d389e6613f7fae6bdcf34 100644 (file)
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.TimeUtils;
+import org.jetbrains.annotations.Nullable;
import ru.deadsoftware.cavedroid.MainConfig;
import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler;
import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler;
import ru.deadsoftware.cavedroid.misc.utils.MeasureUnitsUtilsKt;
import ru.deadsoftware.cavedroid.misc.utils.RenderingUtilsKt;
-import javax.annotation.CheckForNull;
import javax.inject.Inject;
import java.util.ArrayList;
import java.util.Comparator;
}
}
- private boolean handleMouseAction(@CheckForNull MouseInputAction action) {
+ private boolean handleMouseAction(@Nullable MouseInputAction action) {
if (action == null) {
return false;
}
}
private boolean onMouseActionEvent(int mouseX, int mouseY, int button, boolean touchUp, int pointer) {
- @CheckForNull MouseInputAction action = mMouseInputActionMapper
+ @Nullable MouseInputAction action = mMouseInputActionMapper
.map((float) mouseX, (float) mouseY, getCameraViewport(), button, touchUp, pointer);
return handleMouseAction(action);
}
return false;
}
- @CheckForNull MouseInputAction action =
+ @Nullable MouseInputAction action =
mMouseInputActionMapper.mapDragged(screenX, screenY, getCameraViewport(), pointer);
return handleMouseAction(action);
}
@Override
public boolean scrolled(float amountX, float amountY) {
- @CheckForNull MouseInputAction action = mMouseInputActionMapper
+ @Nullable MouseInputAction action = mMouseInputActionMapper
.mapScrolled(Gdx.input.getX(), Gdx.input.getY(), amountX, amountY, getCameraViewport());
return handleMouseAction(action);
}
private boolean handleKeyboardAction(int keycode, boolean isKeyDown) {
- @CheckForNull final KeyboardInputAction action = mKeyboardInputActionMapper
+ @Nullable final KeyboardInputAction action = mKeyboardInputActionMapper
.map(keycode, isKeyDown);
if (action == null) {
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameScreen.java b/core/src/ru/deadsoftware/cavedroid/game/GameScreen.java
index 749d7d4055beeee9964e8f52cb7466188b093a1e..d7546e98ad60758261240dfbd661425e92f90bc6 100644 (file)
package ru.deadsoftware.cavedroid.game;
-import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
+import org.jetbrains.annotations.Nullable;
import ru.deadsoftware.cavedroid.MainConfig;
-import javax.annotation.CheckForNull;
import javax.inject.Inject;
import javax.inject.Singleton;
private final MainConfig mMainConfig;
- @CheckForNull
+ @Nullable
private GameProc mGameProc;
- @CheckForNull
+ @Nullable
private GameItemsHolder mGameItemsHolder;
@Inject
diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/Mob.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/Mob.java
index 5d18755c590feb3ebbf9df3071cc96a32da8fa66..3ee37d37e626914cef7b41e55c151c42ec743c3b 100644 (file)
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Timer;
+import org.jetbrains.annotations.Nullable;
import ru.deadsoftware.cavedroid.game.GameItemsHolder;
import ru.deadsoftware.cavedroid.game.model.dto.SaveDataDto;
import ru.deadsoftware.cavedroid.game.model.item.InventoryItem;
import ru.deadsoftware.cavedroid.game.world.GameWorld;
import ru.deadsoftware.cavedroid.misc.Saveable;
-import javax.annotation.CheckForNull;
import java.util.Collections;
import java.util.List;
protected int mHealth;
private boolean mTakingDamage = false;
- @CheckForNull private ResetTakeDamageTask mResetTakeDamageTask = null;
+
+ @Nullable
+ private ResetTakeDamageTask mResetTakeDamageTask = null;
/**
* @param x in pixels
diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/package-info.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid.game.mobs;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/player/Player.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/player/Player.java
index f454b0c4d05a978e3a88d4387710d7535905e718..9aa503f917a1daec0fa0d92482d7bf377b06cb32 100644 (file)
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import ru.deadsoftware.cavedroid.game.GameItemsHolder;
import ru.deadsoftware.cavedroid.game.mobs.Mob;
import ru.deadsoftware.cavedroid.game.mobs.MobsController;
import ru.deadsoftware.cavedroid.misc.utils.SpriteOrigin;
import ru.deadsoftware.cavedroid.misc.utils.SpriteUtilsKt;
-import javax.annotation.CheckForNull;
-
public class Player extends Mob {
private static final int SAVE_DATA_VERSION = 1;
public int cursorX = 0;
public int cursorY = 0;
- @CheckForNull
+ @Nullable
private Vector2 spawnPoint = null;
public ControlMode controlMode = ControlMode.WALK;
final Block foregroundBlock = gameWorld.getForeMap(cursorX, cursorY);
final Block backgroundBlock = gameWorld.getBackMap(cursorX, cursorY);
- @CheckForNull final Block target;
+ @Nullable final Block target;
if (checkBlockCanBeHit(foregroundBlock)) {
target = foregroundBlock;
diff --git a/core/src/ru/deadsoftware/cavedroid/game/objects/container/Container.kt b/core/src/ru/deadsoftware/cavedroid/game/objects/container/Container.kt
index 624f5d0c16865c17984ced324d48d99576624782..3938ef70142d5b593347f4c02a820adc3f1b3775 100644 (file)
import ru.deadsoftware.cavedroid.game.model.dto.SaveDataDto
import ru.deadsoftware.cavedroid.game.model.item.InventoryItem
import ru.deadsoftware.cavedroid.misc.Saveable
-import javax.annotation.OverridingMethodsMustInvokeSuper
abstract class Container @JvmOverloads constructor(
val size: Int,
val items get() = _items.asList() as MutableList<InventoryItem>
- @OverridingMethodsMustInvokeSuper
open fun initItems(gameItemsHolder: GameItemsHolder) {
_items.forEach { it.init(gameItemsHolder) }
}
diff --git a/core/src/ru/deadsoftware/cavedroid/game/objects/package-info.java b/core/src/ru/deadsoftware/cavedroid/game/objects/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid.game.objects;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/game/package-info.java b/core/src/ru/deadsoftware/cavedroid/game/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid.game;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/game/world/GameWorld.java b/core/src/ru/deadsoftware/cavedroid/game/world/GameWorld.java
index 05a7d5f0f6aa14802eb11fc7b05dcd8b96ba95a4..b53e0a628e23f4e466bc5ea08492aecbe1c243eb 100644 (file)
import com.badlogic.gdx.math.MathUtils;
import kotlin.Pair;
+import org.jetbrains.annotations.Nullable;
import ru.deadsoftware.cavedroid.game.GameItemsHolder;
import ru.deadsoftware.cavedroid.game.GameScope;
import ru.deadsoftware.cavedroid.game.mobs.MobsController;
import ru.deadsoftware.cavedroid.game.objects.container.ContainerController;
import ru.deadsoftware.cavedroid.misc.utils.MeasureUnitsUtilsKt;
-import javax.annotation.CheckForNull;
import javax.inject.Inject;
@GameScope
MobsController mobsController,
GameItemsHolder gameItemsHolder,
ContainerController containerController,
- @CheckForNull Block[][] foreMap,
- @CheckForNull Block[][] backMap) {
+ @Nullable Block[][] foreMap,
+ @Nullable Block[][] backMap) {
mDropController = dropController;
mMobsController = mobsController;
mGameItemsHolder = gameItemsHolder;
placeToBackground(x, y, mGameItemsHolder.getFallbackBlock());
}
- @CheckForNull
+ @Nullable
private Container getContainerAt(int x, int y, int z) {
return mContainerController.getContainer(transformX(x), y, z);
}
- @CheckForNull
+ @Nullable
public Container getForegroundContainer(int x, int y) {
return getContainerAt(x, y, FOREGROUND_Z);
}
- @CheckForNull
+ @Nullable
public Container getBackgroundContainer(int x, int y) {
return getContainerAt(x, y, BACKGROUND_Z);
}
- @CheckForNull
+ @Nullable
public Furnace getForegroundFurnace(int x, int y) {
- @CheckForNull
+ @Nullable
final Container container = getForegroundContainer(x, y);
if (container instanceof Furnace) {
return null;
}
- @CheckForNull
+ @Nullable
public Furnace getBackgroundFurnace(int x, int y) {
- @CheckForNull
+ @Nullable
final Container container = getBackgroundContainer(x, y);
if (container instanceof Furnace) {
diff --git a/core/src/ru/deadsoftware/cavedroid/game/world/GameWorldGenerator.kt b/core/src/ru/deadsoftware/cavedroid/game/world/GameWorldGenerator.kt
index 004a56b01a945ec581dd084a5e26c390da3de190..9562f08b192462e95b1704b5e73a36fd20f395a4 100644 (file)
package ru.deadsoftware.cavedroid.game.world
-import com.google.common.primitives.Ints.min
import ru.deadsoftware.cavedroid.game.GameItemsHolder
import ru.deadsoftware.cavedroid.game.model.block.Block
import ru.deadsoftware.cavedroid.game.model.world.Biome
import ru.deadsoftware.cavedroid.game.model.world.generator.WorldGeneratorConfig
import kotlin.math.abs
import kotlin.math.max
+import kotlin.math.min
import kotlin.random.Random
class GameWorldGenerator(
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/objects/package-info.java b/core/src/ru/deadsoftware/cavedroid/menu/objects/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid.menu.objects;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/package-info.java b/core/src/ru/deadsoftware/cavedroid/menu/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid.menu;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/submenus/package-info.java b/core/src/ru/deadsoftware/cavedroid/menu/submenus/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid.menu.submenus;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/misc/annotations/NonnullByDefault.java b/core/src/ru/deadsoftware/cavedroid/misc/annotations/NonnullByDefault.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package ru.deadsoftware.cavedroid.misc.annotations;
-
-import javax.annotation.Nonnull;
-import javax.annotation.meta.TypeQualifierDefault;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-import static java.lang.annotation.ElementType.*;
-
-@Nonnull
-@TypeQualifierDefault({METHOD, FIELD, PARAMETER})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface NonnullByDefault {
-}
diff --git a/core/src/ru/deadsoftware/cavedroid/misc/package-info.java b/core/src/ru/deadsoftware/cavedroid/misc/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid.misc;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/package-info.java b/core/src/ru/deadsoftware/cavedroid/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file