can see camera working but not the actor gravity

This commit is contained in:
minjaesong
2017-06-28 22:15:42 +09:00
parent b0031c8a67
commit 299dec1476
55 changed files with 279 additions and 101 deletions

View File

@@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" />
<version value="1.0" />
</settings>
</component>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/jopus.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/kotlin-stdlib.jar Normal file

Binary file not shown.

BIN
lib/libjopus.so Normal file

Binary file not shown.

View File

@@ -0,0 +1,17 @@
package net.torvald.gdx.backends.lwjgl.audio
import com.badlogic.gdx.backends.lwjgl.audio.OggInputStream
import com.badlogic.gdx.backends.lwjgl.audio.OpenALAudio
import com.badlogic.gdx.backends.lwjgl.audio.OpenALMusic
import com.badlogic.gdx.backends.lwjgl.audio.OpenALSound
import com.badlogic.gdx.files.FileHandle
import com.badlogic.gdx.utils.StreamUtils
import java.io.ByteArrayOutputStream
/**
* Created by minjaesong on 2017-06-26.
*/
class Opus {
}

View File

@@ -0,0 +1,60 @@
package net.torvald.gdx.backends.lwjgl.audio;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
import java.io.InputStream;
/**
* Created by minjaesong on 2017-06-26.
*/
public class OpusInputStream extends InputStream {
public OpusInputStream() {
super();
}
@Override
public int read(@NotNull byte[] b) throws IOException {
return super.read(b);
}
@Override
public int read(@NotNull byte[] b, int off, int len) throws IOException {
return super.read(b, off, len);
}
@Override
public long skip(long n) throws IOException {
return super.skip(n);
}
@Override
public int available() throws IOException {
return super.available();
}
@Override
public void close() throws IOException {
super.close();
}
@Override
public synchronized void mark(int readlimit) {
super.mark(readlimit);
}
@Override
public synchronized void reset() throws IOException {
super.reset();
}
@Override
public boolean markSupported() {
return super.markSupported();
}
@Override
public int read() throws IOException {
return 0;
}
}

View File

@@ -93,7 +93,6 @@ class SpriteAnimation(val parentActor: ActorWithPhysics) {
if (visible) {
val region = textureRegion.get(currentRow, currentFrame)
region.flip(flipHorizontal, !flipVertical)
batch.color = colorFilter
batch.draw(region,

View File

@@ -158,10 +158,10 @@ class StateInGameGDX(val batch: SpriteBatch) : Screen {
}
// Create camera with the desired resolution
camera = OrthographicCamera(width, height)
//camera = OrthographicCamera(width, height)
// Move camera center to push 0,0 into the corner
camera.translate(width / 2, height / 2)
//camera.translate(width / 2, height / 2)
// Set Y to point downwards
camera.setToOrtho(true, width, height)
@@ -181,6 +181,9 @@ class StateInGameGDX(val batch: SpriteBatch) : Screen {
fun enter() {
initViewPort(Gdx.graphics.width, Gdx.graphics.height, Gdx.graphics.width.toFloat() / Gdx.graphics.height.toFloat())
// load things when the game entered this "state"
// load necessary shaders
//shader12BitCol = Shader.makeShader("./assets/4096.vert", "./assets/4096.frag")
@@ -414,27 +417,47 @@ class StateInGameGDX(val batch: SpriteBatch) : Screen {
blendNormal()
camera.position.set(0f, 0f, 0f) // make camara work
batch.projectionMatrix = camera.combined
batch.inUse {
camera.position.set(WorldCamera.gdxCamX, WorldCamera.gdxCamY, 0f) // make camara work
camera.update()
batch.projectionMatrix = camera.combined
WeatherMixer.render(batch) // drawing to gwin so that any lights from lamp wont "leak" to the skybox
// e.g. Bright blue light on sunset
LightmapRenderer.renderLightMap()
BlocksDrawer.renderWall(batch)
BlocksDrawer.renderTerrain(batch)
batch.color = Color.WHITE
player?.drawBody(batch)
}
println("Player: (${player?.hitbox?.centeredX}, ${player?.hitbox?.centeredY})")
/////////////////////////////
// draw map related stuffs //
/////////////////////////////
worldDrawFrameBuffer.inAction {
/*worldDrawFrameBuffer.inAction {
// FIXME wrong and flipped coord; one camera code does not concern other
camera.position.set(-WorldCamera.x.toFloat(), -WorldCamera.y.toFloat(), 0f) // make camara work
batch.projectionMatrix = camera.combined
batch.inUse {
camera.position.set(WorldCamera.x.toFloat(), WorldCamera.y.toFloat(), 0f) // make camara work
camera.update()
batch.projectionMatrix = camera.combined
batch.color = Color.WHITE
batch.fillRect(WorldCamera.x.toFloat(), WorldCamera.y.toFloat(), 16f, 16f)
BlocksDrawer.renderWall(batch)
actorsRenderBehind.forEach { it.drawBody(batch) }
actorsRenderBehind.forEach { it.drawGlow(batch) }
@@ -540,7 +563,7 @@ class StateInGameGDX(val batch: SpriteBatch) : Screen {
batch.inUse {
val tex = backDrawFrameBuffer.colorBufferTexture // TODO zoom!
batch.draw(tex, 0f, 0f)
}
}*/
//backG.drawImage(worldDrawFrameBuffer.getScaledCopy(screenZoom), 0f, 0f)
//backG.flush()

View File

@@ -599,12 +599,6 @@ infix fun Color.minus(other: Color) = Color( // don't turn into an operator!
)
fun Int.toHex() = this.toLong().and(0xFFFFFFFF).toString(16).padStart(8, '0').toUpperCase()
fun Long.toHex() = {
val sb = StringBuilder()
(0..16).forEach {
}
}

View File

@@ -323,6 +323,10 @@ open class ActorWithPhysics(renderOrder: RenderOrder, val immobileBody: Boolean
override fun update(delta: Float) {
if (isUpdate && !flagDespawn) {
hitbox.translate(0.0, 2.0)
if (!assertPrinted) assertInit()
if (sprite != null) sprite!!.update(delta)
@@ -1317,7 +1321,7 @@ open class ActorWithPhysics(renderOrder: RenderOrder, val immobileBody: Boolean
private inline fun forEachOccupyingTileNum(consumer: (Int?) -> Unit) {
private fun forEachOccupyingTileNum(consumer: (Int?) -> Unit) {
val tiles = ArrayList<Int?>()
for (y in tilewiseHitbox.startY.toInt()..tilewiseHitbox.endY.toInt()) {
for (x in tilewiseHitbox.startX.toInt()..tilewiseHitbox.endX.toInt()) {
@@ -1328,7 +1332,7 @@ open class ActorWithPhysics(renderOrder: RenderOrder, val immobileBody: Boolean
return tiles.forEach(consumer)
}
private inline fun forEachOccupyingTile(consumer: (BlockProp?) -> Unit) {
private fun forEachOccupyingTile(consumer: (BlockProp?) -> Unit) {
val tileProps = ArrayList<BlockProp?>()
for (y in tilewiseHitbox.startY.toInt()..tilewiseHitbox.endY.toInt()) {
for (x in tilewiseHitbox.startX.toInt()..tilewiseHitbox.endX.toInt()) {
@@ -1339,7 +1343,7 @@ open class ActorWithPhysics(renderOrder: RenderOrder, val immobileBody: Boolean
return tileProps.forEach(consumer)
}
private inline fun forEachOccupyingTilePos(hitbox: Hitbox, consumer: (BlockAddress) -> Unit) {
private fun forEachOccupyingTilePos(hitbox: Hitbox, consumer: (BlockAddress) -> Unit) {
val newTilewiseHitbox = Hitbox.fromTwoPoints(
hitbox.startX.div(TILE_SIZE).floor(),
hitbox.startY.div(TILE_SIZE).floor(),
@@ -1357,7 +1361,7 @@ open class ActorWithPhysics(renderOrder: RenderOrder, val immobileBody: Boolean
return tilePosList.forEach(consumer)
}
private inline fun forEachFeetTileNum(consumer: (Int?) -> Unit) {
private fun forEachFeetTileNum(consumer: (Int?) -> Unit) {
val tiles = ArrayList<Int?>()
// offset 1 pixel to the down so that friction would work
@@ -1370,7 +1374,7 @@ open class ActorWithPhysics(renderOrder: RenderOrder, val immobileBody: Boolean
return tiles.forEach(consumer)
}
private inline fun forEachFeetTile(consumer: (BlockProp?) -> Unit) {
private fun forEachFeetTile(consumer: (BlockProp?) -> Unit) {
val tileProps = ArrayList<BlockProp?>()
// offset 1 pixel to the down so that friction would work

View File

@@ -125,7 +125,7 @@ object DecodeTapestry {
if (colourModel != FORMAT_16 && colourModel != FORMAT_64)
throw RuntimeException("Invalid colour model: $colourModel")
val width = file[6].toUint().shl(8) + file[7].toUint()
val width = file[7].toUint().shl(8) + file[6].toUint()
val artNameBytes = ArrayList<Byte>()
val authorNameBytes = ArrayList<Byte>()

View File

@@ -32,7 +32,6 @@ object ItemCodex {
val ITEM_DYNAMIC = 32768..0x0FFF_FFFF
val ACTORID_MIN = ITEM_DYNAMIC.endInclusive + 1
private val itemImagePlaceholder = TextureRegion(Texture("./assets/item_kari_24.tga"))

View File

@@ -289,11 +289,11 @@ import java.util.*
}
fun drawRectBack(x: Int, y: Int, w: Int, h: Int, c: Int = color) {
(0..w - 1).forEach {
for (it in 0..w - 1) {
vram.setBackgroundPixel(x + it, y, c)
vram.setBackgroundPixel(x + it, y + h - 1, c)
}
(1..h - 2).forEach {
for (it in 1..h - 2) {
vram.setBackgroundPixel(x, y + it, c)
vram.setBackgroundPixel(x + w - 1, y + it, c)
}
@@ -306,11 +306,11 @@ import java.util.*
}
fun drawRectFore(x: Int, y: Int, w: Int, h: Int, c: Int = color) {
(0..w - 1).forEach {
for (it in 0..w - 1) {
vram.setForegroundPixel(x + it, y, c)
vram.setForegroundPixel(x + it, y + h - 1, c)
}
(1..h - 2).forEach {
for (it in 1..h - 2) {
vram.setForegroundPixel(x, y + it, c)
vram.setForegroundPixel(x + w - 1, y + it, c)
}

View File

@@ -203,7 +203,7 @@ import java.util.*
rgba, 0,
rgba.size - displacement
)
(rgba.size - 1 downTo rgba.size - displacement + 1).forEach { rgba[it] = 0.toByte() }
for (it in rgba.size - 1 downTo rgba.size - displacement + 1) { rgba[it] = 0.toByte() }
}
else {
System.arraycopy(
@@ -211,7 +211,7 @@ import java.util.*
rgba, displacement,
rgba.size - displacement
)
(0..displacement - 1).forEach { rgba[it] = 0.toByte() }
for (it in 0..displacement - 1) { rgba[it] = 0.toByte() }
}
cursorY += -amount

View File

@@ -101,7 +101,7 @@ object BlocksDrawer {
val tileItemImgPixMap = Pixmap(TILE_SIZE * 16, TILE_SIZE * GameWorld.TILES_SUPPORTED / 16, Pixmap.Format.RGBA8888)
tileItemImgPixMap.pixels.rewind()
(ITEM_TILES).forEach { tileID ->
for (tileID in ITEM_TILES) {
val tile = tilesTerrain.get((tileID % 16) * 16, (tileID / 16))

View File

@@ -16,6 +16,10 @@ object WorldCamera {
private set
var y: Int = 0
private set
var gdxCamX: Float = 0f
private set
var gdxCamY: Float = 0f
private set
var width: Int = 0
private set
var height: Int = 0
@@ -42,6 +46,14 @@ object WorldCamera {
world!!.height * TILE_SIZE - height - TILE_SIZE.toFloat()
))
gdxCamX = Math.round(// X only: ROUNDWORLD implementation
(player?.hitbox?.centeredX?.toFloat() ?: 0f)).toFloat()
gdxCamY = Math.round(FastMath.clamp(
(player?.hitbox?.centeredY?.toFloat() ?: 0f),
TILE_SIZE.toFloat(),
world!!.height * TILE_SIZE - height - TILE_SIZE.toFloat()
)).toFloat()
}
}
}

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<string>numbers-trunk-20080702_1</string>
<string>numbers-trunk-20080731_1</string>
<string>numbers-trunk-20080801_2</string>
<string>numbers-trunk-20080909_1</string>
<string>numbers-trunk-20080911_1</string>
<string>numbers-trunk-20080926_1</string>
<string>numbers-trunk-20081016_1</string>
<string>local build-Oct 16 2012</string>
<string>M3.1-1769-1</string>
</array>
</plist>

View File

@@ -1 +0,0 @@
DDAED13E-5DFB-407C-AAD2-A0A2DEC89519

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

View File

@@ -1,6 +1,6 @@
Terrarum Game Map Format
* Endianness: big
* Endianness: LITTLE
Ord Hex Description
00 54 T

View File

@@ -0,0 +1,51 @@
Paper tape format header
* Endianness: LITTLE
'T '8 'p 't id en ti er // Terrarum 8-Bit punched tape;
<payloads> // identifier: unique 32-bit int used by app
================================================================================
Music tape format
* 8 bytes make one tape row
identifier: 0x41 AB 41 EC // mabl_mek (marble machine)
## Payloads:
sp ed 00 00 00 00 00 00 // speed: ticks per minutes [1..65535]
na me of th e- mu si c0 // name of the music
mu st be th ir ty tw o- // 32 bytes long, padded with null(s)
by te s- lo ng pa dd ed
by nu ll ch ar ac te r0
na me of th e- au th or // name of the author
tw en ty fo ur by te s- // 24 bytes long, padded with null(s)
lo ng pa dd ed by nu ll
## Music data:
bb bb bb bb bb bb bb bb // 64 bits make one tick
^^ Bit 60 Bit 0 ^
|Highest Lowest
|Note Note
|(C6) (C1)
3 bits are program notes, which are:
- 000 : NOP
- 001 : (unused)
- 010 : Halve the speed (applied to next tick)
- 011 : Double the speed (applied to next tick)
- 100 : Quarter the speed (applied to next tick)
- 101 : Quadruple the speed (applied to next tick)
- 110 : (unused)
- 111 : Play current tick and halt
================================================================================
Computer tape format
identifier: 0x7E 12 2A C0
## Payloads: bytes

View File

@@ -1,6 +1,6 @@
Savegame metadata
* Endianness: big
* Endianness: LITTLE
* Filename: 'world'
* Remarks: GZipped

View File

@@ -1,6 +1,6 @@
Terrarum User Art format
* Endianness: big
* Endianness: LITTLE
* Palette colour is encoded as 0b0000RRRR 0bGGGGBBBB (yep, four bits are wasted)
@@ -21,8 +21,8 @@ Ord Hex Description
- 256 colours (using user-defined)
nn - Colour count (1-255)
06 Width of the image (MSB)
07 Width of the image (LSB)
06 Width of the image (LSB)
07 Width of the image (MSB)
08 Name of the art in UTF-8
... 00 String terminator
@@ -30,12 +30,12 @@ Ord Hex Description
... Name of the author in UTF-8
... 00 String terminator
... Palette colour 0, if any (MSB)
... Palette colour 0, if any (LSB)
... Palette colour 1, if any (MSB)
... Palette colour 1, if any (LSB)
... Palette colour 2, if any (MSB)
... Palette colour 2, if any (LSB)
... Palette colour 0, if any (0R)
... Palette colour 0, if any (GB)
... Palette colour 1, if any (0R)
... Palette colour 1, if any (GB)
... Palette colour 2, if any (0R)
... Palette colour 2, if any (GB)
... Colour indices

View File

@@ -0,0 +1,28 @@
## Using items
## Roguelike identity
### Randomised things
#### Potion
Lime-coloured potion
First play: "Potion (???)"
After drank: "Potion (Healing)" is revealed.
Second (new) play: "Potion (???)"
After drank: "Potion (Neurotoxin)" is revealed.
### size variation of tools/weapons/etc.
Race base weapon/tool size <- 10 [kg]
Size tolerance <- (50% * str/1000), or say, 20%
If the size is bigger than tolerable, weapon speed severely slows down, tools become unusable
if use time >* 0.75 second, the weapon/tool cannot be equipped.
Small weapons/tools gains no (dis)advantage
When drawing: scale by (craftedWeaponSize / baseWeaponSize)
Crafted tool/weapon size is dependent to the baseRaceMass.

View File

@@ -1,16 +1,3 @@
## size variation of tools/weapons/etc.
Race base weapon/tool size <- 10 [kg]
Size tolerance <- (50% * str/1000), or say, 20%
If the size is bigger than tolerable, weapon speed severely slows down, tools become unusable
if use time >* 0.75 second, the weapon/tool cannot be equipped.
Small weapons/tools gains no (dis)advantage
When drawing: scale by (craftedWeaponSize / baseWeaponSize)
Crafted tool/weapon size is dependent to the baseRaceMass.
## Colouring ##
@@ -38,18 +25,6 @@ Things are colour-keyed so that players would get the idea by just a glance.
NOTE: cyan is a tricky colour for deuterans; will be inextinguishable between greys!
## Roguelike identity ##
* Randomised things
- E.g. potion
Lime-coloured potion
First play: "Potion (???)"
After drank: "Potion (Healing)" is revealed.
Second (new) play: "Potion (???)"
After drank: "Potion (Neurotoxin)" is revealed.
## Making sprite ##
* Layers

View File

@@ -0,0 +1,35 @@
A chapter of the WORLD series
# Universe
## Shape
The world is cylindrical. (really it is -- the very shape is used to sample noises) It loops at left and right end. One of the in-game tapestry reflects this.
## Multiverse
Multiverse exists. On the main screen, players can only select a persona (user in Terraria), and the game loads the world where player saved the game.
Multiple maps are multiverse in this game; users don't have an access to the multiverse or concerning techs; only after hard play (and several deaths, possible) players can reach the technology and create the new universe (new world) where the player can exploit.
Let's be honest: when you play the Terraria bit heavily, you create multiple world to farm resources; this is cheat and you know it, which is why, in this game, you technically can but after hard working so that it'd be less of a cheat.
### New World (New Universe)
The teleporter also works as "world manager"; players can create new world or delete existing ones. Lore-wise, creation and deletion is regarded as linking and unlinking.
When players create a new world (by new multiverse or new persona), they can choose the size of the new world, and that and the name would be the only thing players can _control_.
### New Game
The only way to make a new game is to create new persona and thus, the game creates a new world for the first time. In single player mode, one persona cannot cross other persona's universes.
# Lore
## Backstory

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.