mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-10 10:20:44 -07:00
Begin basic playground code, eventually will become a model viewer
This commit is contained in:
parent
153d8569b5
commit
8fb5b3fc75
10 changed files with 121 additions and 34 deletions
|
|
@ -514,7 +514,7 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
|
|||
}
|
||||
getMaxMemory();
|
||||
this.addCanvas();
|
||||
client.frameBuffer = Static131.create(canvasHeight, canvasWidth, canvas);
|
||||
SoftwareRaster.frameBuffer = Static131.create(canvasHeight, canvasWidth, canvas);
|
||||
this.mainInit();
|
||||
timer = Timer.create();
|
||||
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ public class MiniMap {
|
|||
if (GlRenderer.enabled) {
|
||||
SoftwareRaster.pixels = null;
|
||||
} else {
|
||||
client.frameBuffer.makeTarget();
|
||||
SoftwareRaster.frameBuffer.makeTarget();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -177,7 +177,7 @@ public class MiniMap {
|
|||
if (GlRenderer.enabled) {
|
||||
SoftwareRaster.pixels = null;
|
||||
} else {
|
||||
client.frameBuffer.makeTarget();
|
||||
SoftwareRaster.frameBuffer.makeTarget();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -198,7 +198,7 @@ public class MiniMap {
|
|||
if (GlRenderer.enabled) {
|
||||
SoftwareRaster.pixels = null;
|
||||
} else {
|
||||
client.frameBuffer.makeTarget();
|
||||
SoftwareRaster.frameBuffer.makeTarget();
|
||||
}
|
||||
softwareSprite = null;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -33,18 +33,21 @@ public final class SoftwareRaster {
|
|||
@OriginalMember(owner = "client!kb", name = "h", descriptor = "I")
|
||||
public static int clipBottom = 0;
|
||||
|
||||
@OriginalMember(owner = "client!kb", name = "a", descriptor = "()V")
|
||||
@OriginalMember(owner = "client!vd", name = "w", descriptor = "Lclient!vk;")
|
||||
public static FrameBuffer frameBuffer;
|
||||
|
||||
@OriginalMember(owner = "client!kb", name = "a", descriptor = "()V")
|
||||
public static void method2482() {
|
||||
anIntArray295 = null;
|
||||
anIntArray296 = null;
|
||||
}
|
||||
|
||||
@OriginalMember(owner = "client!kb", name = "a", descriptor = "(IIIII)V")
|
||||
public static void drawRect(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3, @OriginalArg(4) int arg4) {
|
||||
drawHorizontalLine(arg0, arg1, arg2, arg4);
|
||||
drawHorizontalLine(arg0, arg1 + arg3 - 1, arg2, arg4);
|
||||
drawVerticalLine(arg0, arg1, arg3, arg4);
|
||||
drawVerticalLine(arg0 + arg2 - 1, arg1, arg3, arg4);
|
||||
public static void drawRect(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3, @OriginalArg(4) int color) {
|
||||
drawHorizontalLine(arg0, arg1, arg2, color);
|
||||
drawHorizontalLine(arg0, arg1 + arg3 - 1, arg2, color);
|
||||
drawVerticalLine(arg0, arg1, arg3, color);
|
||||
drawVerticalLine(arg0 + arg2 - 1, arg1, arg3, color);
|
||||
}
|
||||
|
||||
@OriginalMember(owner = "client!kb", name = "a", descriptor = "(IIIIII)V")
|
||||
|
|
@ -113,20 +116,20 @@ public final class SoftwareRaster {
|
|||
}
|
||||
|
||||
@OriginalMember(owner = "client!kb", name = "a", descriptor = "(IIII)V")
|
||||
public static void drawHorizontalLine(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3) {
|
||||
if (arg1 < clipTop || arg1 >= clipBottom) {
|
||||
public static void drawHorizontalLine(@OriginalArg(0) int x, @OriginalArg(1) int y, @OriginalArg(2) int length, @OriginalArg(3) int color) {
|
||||
if (y < clipTop || y >= clipBottom) {
|
||||
return;
|
||||
}
|
||||
if (arg0 < clipLeft) {
|
||||
arg2 -= clipLeft - arg0;
|
||||
arg0 = clipLeft;
|
||||
if (x < clipLeft) {
|
||||
length -= clipLeft - x;
|
||||
x = clipLeft;
|
||||
}
|
||||
if (arg0 + arg2 > clipRight) {
|
||||
arg2 = clipRight - arg0;
|
||||
if (x + length > clipRight) {
|
||||
length = clipRight - x;
|
||||
}
|
||||
@Pc(32) int local32 = arg0 + arg1 * width;
|
||||
for (@Pc(34) int local34 = 0; local34 < arg2; local34++) {
|
||||
pixels[local32 + local34] = arg3;
|
||||
@Pc(32) int local32 = x + y * width;
|
||||
for (@Pc(34) int local34 = 0; local34 < length; local34++) {
|
||||
pixels[local32 + local34] = color;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -554,7 +554,7 @@ public final class Static1 {
|
|||
if (GlRenderer.enabled) {
|
||||
SoftwareRaster.pixels = null;
|
||||
} else {
|
||||
client.frameBuffer.makeTarget();
|
||||
SoftwareRaster.frameBuffer.makeTarget();
|
||||
}
|
||||
}
|
||||
WorldMap.aClass3_Sub2_Sub1_2.method1415(arg0, arg3);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public final class Static114 {
|
|||
} else {
|
||||
try {
|
||||
@Pc(159) Graphics local159 = GameShell.canvas.getGraphics();
|
||||
client.frameBuffer.draw(local159);
|
||||
SoftwareRaster.frameBuffer.draw(local159);
|
||||
} catch (@Pc(167) Exception local167) {
|
||||
GameShell.canvas.repaint();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,8 +125,8 @@ public final class Static197 {
|
|||
GameShell.canvas.setIgnoreRepaint(true);
|
||||
if (!Static211.aBoolean73) {
|
||||
SceneGraph.clear();
|
||||
client.frameBuffer = null;
|
||||
client.frameBuffer = Static131.create(GameShell.canvasHeight, GameShell.canvasWidth, GameShell.canvas);
|
||||
SoftwareRaster.frameBuffer = null;
|
||||
SoftwareRaster.frameBuffer = Static131.create(GameShell.canvasHeight, GameShell.canvasWidth, GameShell.canvas);
|
||||
SoftwareRaster.clear();
|
||||
if (client.gameState == 5) {
|
||||
LoadingBar.render(true, Fonts.b12Full);
|
||||
|
|
@ -135,14 +135,14 @@ public final class Static197 {
|
|||
}
|
||||
try {
|
||||
@Pc(269) Graphics local269 = GameShell.canvas.getGraphics();
|
||||
client.frameBuffer.draw(local269);
|
||||
SoftwareRaster.frameBuffer.draw(local269);
|
||||
} catch (@Pc(277) Exception local277) {
|
||||
}
|
||||
Static139.method2704();
|
||||
if (arg3 == 0) {
|
||||
client.frameBuffer = Static131.create(503, 765, GameShell.canvas);
|
||||
SoftwareRaster.frameBuffer = Static131.create(503, 765, GameShell.canvas);
|
||||
} else {
|
||||
client.frameBuffer = null;
|
||||
SoftwareRaster.frameBuffer = null;
|
||||
}
|
||||
@Pc(300) PrivilegedRequest local300 = GameShell.signLink.loadGlNatives(client.instance.getClass());
|
||||
while (local300.status == 0) {
|
||||
|
|
@ -162,7 +162,7 @@ public final class Static197 {
|
|||
}
|
||||
if (arg1 > 0 && arg3 == 0) {
|
||||
GameShell.thread.setPriority(5);
|
||||
client.frameBuffer = null;
|
||||
SoftwareRaster.frameBuffer = null;
|
||||
Static268.method4580();
|
||||
((Js5GlTextureProvider) Rasteriser.textureProvider).method3248(200);
|
||||
if (Preferences.highDetailLighting) {
|
||||
|
|
@ -171,7 +171,7 @@ public final class Static197 {
|
|||
Static114.method4637();
|
||||
} else if (arg1 == 0 && arg3 > 0) {
|
||||
GameShell.thread.setPriority(1);
|
||||
client.frameBuffer = Static131.create(503, 765, GameShell.canvas);
|
||||
SoftwareRaster.frameBuffer = Static131.create(503, 765, GameShell.canvas);
|
||||
Static268.method4583();
|
||||
Static76.method1643();
|
||||
((Js5GlTextureProvider) Rasteriser.textureProvider).method3248(20);
|
||||
|
|
|
|||
|
|
@ -73,8 +73,6 @@ public final class client extends GameShell {
|
|||
public static BufferedFile uid;
|
||||
@OriginalMember(owner = "client!tl", name = "d", descriptor = "I")
|
||||
public static int gameState = 0;
|
||||
@OriginalMember(owner = "client!vd", name = "w", descriptor = "Lclient!vk;")
|
||||
public static FrameBuffer frameBuffer;
|
||||
@OriginalMember(owner = "client!id", name = "f", descriptor = "Z")
|
||||
public static boolean clean = false;
|
||||
@OriginalMember(owner = "client!bl", name = "P", descriptor = "I")
|
||||
|
|
@ -710,7 +708,7 @@ public final class client extends GameShell {
|
|||
local388 = GameShell.canvas.getGraphics();
|
||||
for (local84 = 0; local84 < InterfaceList.anInt766; local84++) {
|
||||
if (InterfaceList.rectangleRedraw[local84]) {
|
||||
frameBuffer.drawAt(Static224.anIntArray443[local84], Static264.anIntArray410[local84], Static67.anIntArray320[local84], local388, Static50.anIntArray133[local84]);
|
||||
SoftwareRaster.frameBuffer.drawAt(Static224.anIntArray443[local84], Static264.anIntArray410[local84], Static67.anIntArray320[local84], local388, Static50.anIntArray133[local84]);
|
||||
InterfaceList.rectangleRedraw[local84] = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -720,7 +718,7 @@ public final class client extends GameShell {
|
|||
} else if (gameState != 0) {
|
||||
try {
|
||||
local388 = GameShell.canvas.getGraphics();
|
||||
frameBuffer.draw(local388);
|
||||
SoftwareRaster.frameBuffer.draw(local388);
|
||||
for (local84 = 0; local84 < InterfaceList.anInt766; local84++) {
|
||||
InterfaceList.rectangleRedraw[local84] = false;
|
||||
}
|
||||
|
|
|
|||
29
playground/build.gradle
Normal file
29
playground/build.gradle
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'application'
|
||||
}
|
||||
|
||||
mainClassName = 'com.itspazaz.rt4.Playground'
|
||||
version = '1.0.0'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
compileJava.options.encoding = 'UTF-8'
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly project(':deob-annotations')
|
||||
implementation project(':signlink')
|
||||
implementation project(':client') // TODO: abstract client/engine code
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Main-Class': "$mainClassName"
|
||||
}
|
||||
from { configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
}
|
||||
56
playground/src/main/java/com/itspazaz/rt4/Playground.java
Normal file
56
playground/src/main/java/com/itspazaz/rt4/Playground.java
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
package com.itspazaz.rt4;
|
||||
|
||||
import rt4.*;
|
||||
|
||||
public class Playground extends GameShell {
|
||||
public static Playground instance;
|
||||
|
||||
public static void main(String[] args) {
|
||||
instance = new Playground();
|
||||
instance.startApplication(32, "runescape");
|
||||
GameShell.frame.setLocation(40, 40);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
instance = this;
|
||||
this.startApplet(32);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mainInit() {
|
||||
Keyboard.init();
|
||||
Keyboard.start(GameShell.canvas);
|
||||
Mouse.start(GameShell.canvas);
|
||||
SoftwareRaster.frameBuffer.makeTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mainLoop() {
|
||||
Keyboard.loop();
|
||||
Mouse.loop();
|
||||
|
||||
GameShell.frame.setTitle(Keyboard.pressedKeys[Keyboard.KEY_CTRL] ? "pressed" : "not pressed");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mainRedraw() {
|
||||
SoftwareRaster.clear();
|
||||
|
||||
SoftwareRaster.drawRect(50, 50, 100, 100, 0xFF00FF);
|
||||
|
||||
SoftwareRaster.frameBuffer.draw(GameShell.canvas.getGraphics());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mainQuit() {
|
||||
Keyboard.stop(GameShell.canvas);
|
||||
Mouse.stop(GameShell.canvas);
|
||||
Keyboard.quit();
|
||||
Mouse.quit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void reset() {
|
||||
}
|
||||
}
|
||||
|
|
@ -12,5 +12,6 @@ dependencyResolutionManagement {
|
|||
include(
|
||||
"deob-annotations",
|
||||
"signlink",
|
||||
"client"
|
||||
"client",
|
||||
"playground"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue