Skip to content

Commit

Permalink
Some small fixes
Browse files Browse the repository at this point in the history
Shitty method to fix the camera for Psych Characters(I hope)
  • Loading branch information
superpowers04 committed Jun 2, 2024
1 parent 7b7cd4c commit 491edca
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 33 deletions.
13 changes: 9 additions & 4 deletions example_mods/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,15 @@ CONTENT CREATION MODE:
If you press F10, you can open a console. This allows you to view the game's output, run some commands and code while the game's running.

Pressing Shift+F8 will partially pause the game and enable the debug overlay. You can use this to move around objects
Pressing shift while clicking will prevent the game from looping groups
Pressing Ctrl while clicking will reverse the grab order, you can use this to grab objects behind other objects
If you move the scroll wheel, you can rotate an object
If you hold ALT, you can get the position of an object you're hovering over
Left Click will grab an object
- Pressing Shift while clicking will prevent the game from looping groups
- Pressing Ctrl while clicking will reverse the grab order, you can use this to grab objects behind other objects
- Scrolling will rotate the held object
- Holding ALT will give you the position of the object you're hovering over
Right Click will move the camera
- Scrolling will zoom in and out
Pressing 3 will trace the position of the last clicked object to the console



ADDING EXISTING CHARTS:
Expand Down
9 changes: 9 additions & 0 deletions source/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ class CharAnimController extends FlxAnimationController{
public var camY:Float = 0;
public var useMisses:Bool = false;
public var useVoices:Bool = false;
public var useMidpoint:Bool = true;
public var singDuration:Float = 4; // Singduration?
public var dadVar(get,set):Float; // Singduration?
@:keep inline public function get_dadVar() return singDuration;
Expand Down Expand Up @@ -696,10 +697,18 @@ class CharAnimController extends FlxAnimationController{
charProperties.cam_pos= charProperties.camera_position;
charProperties.cam_pos[0]*=-1;
charProperties.cam_pos[1]*=-1;
switch(charType) {
case 0:charProperties.cam_pos[1]+=200;
case 1:charProperties.cam_pos[1]-=300;
// case 2:charProperties.cam_pos[0]+=100;
}
useMidpoint = false;

charProperties.offset_flip=3;
charProperties.char_pos = charProperties.position;
charProperties.char_pos[0]*=-1;
charProperties.char_pos[1]*=-1;

}
if(amPreview){
charProperties.camera_position = charProperties.position = null;
Expand Down
8 changes: 4 additions & 4 deletions source/HSBrTools.hx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class HSBrTools {
public var bitmapArray:Map<String,BitmapData> = [];
public var xmlArray:Map<String,String> = [];
public var textArray:Map<String,String> = [];
public var soundArray:Map<String,FlxSound> = [];
public var soundArray:Map<String,Sound> = [];
// public var dumpGraphics:Bool = false; // If true, All FlxGraphics will be dumped upon creation, trades off bitmap editability for less memory usage


Expand Down Expand Up @@ -179,9 +179,9 @@ class HSBrTools {


public function loadSound(soundPath:String):FlxSound{
if(soundArray[soundPath] == null) soundArray[soundPath] = SELoader.loadFlxSound('${path}${soundPath}');
if(soundArray[soundPath] == null) soundArray[soundPath] = SELoader.loadSound('${path}${soundPath}');
@:privateAccess{
return new FlxSound().loadEmbedded(soundArray[soundPath]._sound);
return new FlxSound().loadEmbedded(soundArray[soundPath]);
}
}
public function loadFlxSound(soundPath:String) return loadSound(soundPath);
Expand Down Expand Up @@ -216,7 +216,7 @@ class HSBrTools {
trace('${id} : CacheSound: "${path}${soundPath}" doesn\'t exist!');
return;
}
soundArray[soundPath] = SELoader.loadFlxSound('${path}${soundPath}');
soundArray[soundPath] = SELoader.loadSound('${path}${soundPath}');
}
}
public function cacheGraphic(pngPath:String,?dumpGraphic:Bool = false){ // DOES NOT CHECK IF FILE IS VALID!
Expand Down
4 changes: 4 additions & 0 deletions source/MusicBeatState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ class DebugOverlay extends FlxTypedGroup<FlxSprite>{
songPos = FlxG.sound.music.time;
songLooped = FlxG.sound.music.looped;
FlxG.sound.music.looped = true;
FlxG.sound.music.onComplete=null;
songFinishCallback = FlxG.sound.music.onComplete;
}
}
Expand Down Expand Up @@ -601,6 +602,9 @@ class DebugOverlay extends FlxTypedGroup<FlxSprite>{
updateObjText('CamScrollPos:${Std.int(FlxG.camera.scroll.x * 100) * 0.01},${Std.int(FlxG.camera.scroll.y * 100) * 0.01} Zoom:${Std.int(FlxG.camera.zoom * 100) * 0.01}');
}
}
if(FlxG.justPressed.THREE){
trace(objectPosText.text);
}
}
@:keep inline function updateObjPosText(){
objectPosBack.visible = objectPosText.visible = true;
Expand Down
4 changes: 4 additions & 0 deletions source/PauseSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,10 @@ class PauseSubState extends MusicBeatSubstate {
}
var _tween:FlxTween;
public function countdown(){try{
if(FlxG.keys.pressed.SHIFT){
backToPlaystate();
return;
}
ready = false;
var swagCounter:Int = 1;
try{
Expand Down
10 changes: 10 additions & 0 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2361,6 +2361,7 @@ class PlayState extends ScriptMusicBeatState
public var additionCamPos:Array<Float> = [0,0];
public var focusedCharacter:Int = 0;
@:keep inline public function updateCharacterCamPos(){ // Resets all camera positions

cameraPositions = [
[boyfriend.getMidpoint().x - 100 + boyfriend.camX,boyfriend.getMidpoint().y - 100 + boyfriend.camY],
[dad.getMidpoint().x + 150 + dad.camX,dad.getMidpoint().y - 100 + dad.camY],
Expand All @@ -2369,14 +2370,23 @@ class PlayState extends ScriptMusicBeatState
if(boyfriend.lonely || boyfriend.curCharacter == "" || boyfriend.curCharacter == "lonely"){
cameraPositions[0][0] = defLockedCamPos[0];
cameraPositions[0][1] = defLockedCamPos[1];
}else if(!boyfriend.useMidpoint){
cameraPositions[0][0] = boyfriend.x + boyfriend.camX;
cameraPositions[0][1] = boyfriend.y + boyfriend.camY;
}
if(dad.lonely || dad.curCharacter == "" || dad.curCharacter == "lonely"){
cameraPositions[1][0] = defLockedCamPos[0];
cameraPositions[1][1] = defLockedCamPos[1];
}else if(!dad.useMidpoint){
cameraPositions[0][0] = dad.x + dad.camX;
cameraPositions[0][1] = dad.y + dad.camY;
}
if(gf.lonely || gf.curCharacter == "" || gf.curCharacter == "lonely"){
cameraPositions[2][0] = defLockedCamPos[0];
cameraPositions[2][1] = defLockedCamPos[1];
}else if(!gf.useMidpoint){
cameraPositions[0][0] = gf.x + gf.camX;
cameraPositions[0][1] = gf.y + gf.camY;
}
if(swappedChars){
cameraPositions[0][0] -= 50;
Expand Down
27 changes: 17 additions & 10 deletions source/SearchMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -330,17 +330,24 @@ class SearchMenuState extends ScriptMusicBeatState {
}
if(blackBorder == null || !FlxG.mouse.overlaps(blackBorder) ){
var curSel= grpSongs.members[curSelected];
for (i in -2 ... 2) {
var member = grpSongs.members[curSelected + i];
if(member != null && FlxG.mouse.overlaps(member)){
if(member == curSel){
select(curSelected);
if(retAfter) ret();
}else{
changeSelection(i);
}
}

if(FlxG.mouse.y < curSel.y-20){
changeSelection(-1);
}else if(FlxG.mouse.y > curSel.y+60){
changeSelection(1);
}else if((FlxG.mouse.y > curSel.y-10 && FlxG.mouse.y < curSel.y+50) || FlxG.mouse.overlaps(curSel)){
select(curSelected);
if(retAfter) ret();
}
// for (i in -2 ... 2) {
// var member = grpSongs.members[curSelected + i];
// if(member != null && FlxG.mouse.overlaps(member)){
// if(member == curSel){
// }else{
// changeSelection(i);
// }
// }
// }
}
}
#if android
Expand Down
30 changes: 17 additions & 13 deletions source/multi/MultiMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -615,17 +615,14 @@ class MultiMenuState extends onlinemod.OfflineMenuState {
changeDiff(if(FlxG.mouse.screenX > 640) 1 else -1);
}
else if(!FlxG.mouse.overlaps(blackBorder)){
var curSel = grpSongs.members[curSelected];
for (i in -2 ... 2) {
var member = grpSongs.members[curSelected + i];
if(member != null && FlxG.mouse.overlaps(member)){
if(curSel == member){
selSong(curSelected,FlxG.mouse.justPressedRight);
return;
}
changeSelection(i);
break;
}
var curSel= grpSongs.members[curSelected];
if(FlxG.mouse.y < curSel.y-20){
changeSelection(-1);
}else if(FlxG.mouse.y > curSel.y+60){
changeSelection(1);
}else if((FlxG.mouse.y > curSel.y-10 && FlxG.mouse.y < curSel.y+50) || FlxG.mouse.overlaps(curSel)){
selSong(curSelected,FlxG.mouse.justPressedRight);
if(retAfter) ret();
}
}
}
Expand Down Expand Up @@ -832,12 +829,19 @@ class MultiMenuState extends onlinemod.OfflineMenuState {
override function changeSelection(change:Int = 0){
var looped = 0;
super.changeSelection(change);
var songInfo = grpSongs.members[curSelected]?.menuValue;
var songInfo:SongInfo = grpSongs.members[curSelected]?.menuValue;
if(songInfo == null || !songInfo.charts.contains('${songInfo.name}.json')){
changeDiff(0,0);
return;
}
changeDiff(0,songInfo.charts.indexOf('${songInfo.name}.json'));
var pos = 0;
var json = '${songInfo.name}.json';
for(i => chart in songInfo.charts){
var s = '${songInfo.path}-${chart}${(QuickOptionsSubState.getSetting("Inverted chart") ? "-inverted" : "")}';
if(Highscore.songScores.exists(s)) {pos = i;break;}
if(chart == json ) pos = i;
}
changeDiff(0,pos);
// if (modes[curSelected].indexOf('${songNames[curSelected]}.json') != -1) changeDiff(0,modes[curSelected].indexOf('${songNames[curSelected]}.json')); else changeDiff(0,0);
}
@:keep inline public static function findFileFromAssets(path:String,name:String,file:String):String{
Expand Down
5 changes: 3 additions & 2 deletions version.downloadMe
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
24.06.01.0224;
24.06.02.0048;
* Better Psych character support(Still kinda experimental but should be more stable)
* Fix some small errors
* Fix characters not loading due to using ID instead of folderName
* Fix characters not loading due to using ID instead of folderName
* Adjust mouse input on menus so clicking above alphabet will scroll up, and below will scroll down

0 comments on commit 491edca

Please sign in to comment.