diff --git a/.gitignore b/.gitignore index 59107bb..d1f8a6b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,12 @@ # GameMaker files *.resource_order +# YYP Maker files +___yyp_maker_trash/ + # Stitch files stitch.config.json tmp/ /options +sprites.import.json +sprites.info.json diff --git a/fonts/f_hires/f_hires.yy b/fonts/f_hires/f_hires.yy index 388a401..d389e6f 100644 --- a/fonts/f_hires/f_hires.yy +++ b/fonts/f_hires/f_hires.yy @@ -134,10 +134,7 @@ "sdfSpread":8, "size":34.0, "styleName":"Bold", - "textureGroupId":{ - "name":"Default", - "path":"texturegroups/Default", - }, + "textureGroupId":null, "TTFName":"", "usesSDF":false, } \ No newline at end of file diff --git a/fonts/f_pixel/f_pixel.yy b/fonts/f_pixel/f_pixel.yy index b0bbe14..72d50b8 100644 --- a/fonts/f_pixel/f_pixel.yy +++ b/fonts/f_pixel/f_pixel.yy @@ -134,10 +134,7 @@ "sdfSpread":8, "size":6.0, "styleName":"Regular", - "textureGroupId":{ - "name":"Default", - "path":"texturegroups/Default", - }, + "textureGroupId":null, "TTFName":"", "usesSDF":false, } \ No newline at end of file diff --git a/objects/__obj_stanncam_manager/Create_0.gml b/objects/__obj_stanncam_manager/Create_0.gml index 77487dd..7f55091 100644 --- a/objects/__obj_stanncam_manager/Create_0.gml +++ b/objects/__obj_stanncam_manager/Create_0.gml @@ -3,10 +3,19 @@ resolution_w = 0; resolution_h = 0; number_of_cams = 0; keep_aspect_ratio = true; +gui_keep_aspect_ratio = true; resize_width = 0; resize_height = 0; __display_scale_x = 1; __display_scale_y = 1; + +__switching_window_mode = false; + draw_zones = false; + +__gui_res_w = 1; +__gui_res_h = 1; +__gui_x_scale = 1; +__gui_y_scale = 1; diff --git a/objects/__obj_stanncam_manager/Draw_76.gml b/objects/__obj_stanncam_manager/Draw_76.gml index dd48a3b..80bb766 100644 --- a/objects/__obj_stanncam_manager/Draw_76.gml +++ b/objects/__obj_stanncam_manager/Draw_76.gml @@ -2,4 +2,4 @@ var _len = array_length(global.stanncams); for (var i = 0; i < _len; ++i){ if(global.stanncams[i] == -1) continue; global.stanncams[i].__predraw(); -} +} \ No newline at end of file diff --git a/objects/__obj_stanncam_manager/Draw_77.gml b/objects/__obj_stanncam_manager/Draw_77.gml new file mode 100644 index 0000000..f09f41b --- /dev/null +++ b/objects/__obj_stanncam_manager/Draw_77.gml @@ -0,0 +1,6 @@ +/// @description +var _len = array_length(global.stanncams); +for (var i = 0; i < _len; ++i){ + if(global.stanncams[i] == -1) continue; + global.stanncams[i].__postdraw(); +} \ No newline at end of file diff --git a/objects/__obj_stanncam_manager/Other_4.gml b/objects/__obj_stanncam_manager/Other_4.gml index c343e91..f5af787 100644 --- a/objects/__obj_stanncam_manager/Other_4.gml +++ b/objects/__obj_stanncam_manager/Other_4.gml @@ -1,7 +1,14 @@ view_enabled = true; var _len = array_length(global.stanncams); for (var i = 0; i < _len; ++i){ - if(global.stanncams[i] == -1) continue; - global.stanncams[i].__check_viewports(); + var _cam = global.stanncams[i]; + if(_cam == -1) continue; + _cam.__check_viewports(); + + //if following something, snap the camera to it on room start + if(instance_exists(_cam.follow)){ + _cam.move(_cam.follow.x, _cam.follow.y, 0); + } } + __stanncam_update_resolution(); diff --git a/objects/__obj_stanncam_manager/Step_2.gml b/objects/__obj_stanncam_manager/Step_2.gml index 4811c51..df93ec0 100644 --- a/objects/__obj_stanncam_manager/Step_2.gml +++ b/objects/__obj_stanncam_manager/Step_2.gml @@ -5,7 +5,7 @@ for (var i = 0; i < _len; ++i){ } //constantly checks if the window is being resized and changes the resolution to match -if(global.window_mode == STANNCAM_WINDOW_MODE.WINDOWED && (resize_width != window_get_width() || resize_height != window_get_height())){ +if(global.window_mode == STANNCAM_WINDOW_MODE.WINDOWED && !__switching_window_mode && (resize_width != window_get_width() || resize_height != window_get_height())){ resize_width = window_get_width(); resize_height = window_get_height(); diff --git a/objects/__obj_stanncam_manager/__obj_stanncam_manager.yy b/objects/__obj_stanncam_manager/__obj_stanncam_manager.yy index 6748622..094fbcd 100644 --- a/objects/__obj_stanncam_manager/__obj_stanncam_manager.yy +++ b/objects/__obj_stanncam_manager/__obj_stanncam_manager.yy @@ -6,6 +6,7 @@ {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":2,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":76,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":77,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"__obj_stanncam_manager", diff --git a/objects/obj_camera/Create_0.gml b/objects/obj_camera/Create_0.gml index 6065ac0..0717632 100644 --- a/objects/obj_camera/Create_0.gml +++ b/objects/obj_camera/Create_0.gml @@ -1,8 +1,11 @@ //camera -stanncam_init(320, 180, 1920, 1080); +stanncam_init(320, 180, 1280, 720, 640, 360); cam1 = new stanncam(obj_player.x, obj_player.y, global.game_w, global.game_h, 0, 0); cam1.follow = obj_player; +cam1.bounds_w = 10; +cam1.bounds_h = 10; + cam2 = undefined; split_screen = false; @@ -19,7 +22,8 @@ speed_mode = 1; game_res = 2; gui_hires = false; -gui_res = 0; +gui_res = 1; +gui_hires_scale = 6; //how much bigger the hires font is than the pixel one resolutions = [ {w:400, h:400}, //1:1 @@ -28,5 +32,13 @@ resolutions = [ {w:640, h:360}, {w:1280, h:720}, {w:1920, h:1080}, - {w:2560, h:1440} + {w:2560, h:1440}, ]; + +gui_resolutions = [ + {w:320, h:180}, //16:9 + {w:640, h:360}, + {w:1280, h:720}, +]; + +stanncam_debug_set_draw_zones(true); diff --git a/objects/obj_camera/Draw_0.gml b/objects/obj_camera/Draw_0.gml new file mode 100644 index 0000000..1a62c68 --- /dev/null +++ b/objects/obj_camera/Draw_0.gml @@ -0,0 +1,6 @@ +/// @description +var _x = cam1.get_mouse_x(); +var _y = cam1.get_mouse_y(); +draw_set_color(c_red); +draw_circle(_x, _y, 10, true); +draw_set_color(c_white); diff --git a/objects/obj_camera/Draw_64.gml b/objects/obj_camera/Draw_64.gml index 79d8ff3..4220969 100644 --- a/objects/obj_camera/Draw_64.gml +++ b/objects/obj_camera/Draw_64.gml @@ -30,7 +30,7 @@ draw_text_outline(1, _offset * 9, "[B] smooth_draw: " + (cam1.smooth_draw ? "ON" draw_text_outline(1, _offset * 10, "[1 & 2 & 3] to switch between example rooms", _outline_width, _precision); //draw current resolution text -draw_set_halign(fa_right) +draw_set_halign(fa_right); draw_text_outline(global.gui_w - 1, 0, "Game size: " + string(global.game_w) + " x " + string(global.game_h), _outline_width, _precision); draw_text_outline(global.gui_w - 1, _offset, "Resolution: " + string(global.res_w) + " x " + string(global.res_h) + " [F1]", _outline_width, _precision); draw_text_outline(global.gui_w - 1, _offset * 2, "GUI resolution: " + string(global.gui_w) + " x " + string(global.gui_h) + " [F2]", _outline_width, _precision); @@ -62,8 +62,8 @@ if(cam1.out_of_bounds(obj_player.x, obj_player.y, 8)){ var _gui_scale_x = stanncam_get_gui_scale_x(); var _gui_scale_y = stanncam_get_gui_scale_y(); - _x = clamp(_x, _margin, cam1.width * _gui_scale_x -_margin); - _y = clamp(_y, _margin, cam1.height * _gui_scale_y -_margin); + _x = clamp(_x, _margin, cam1.width * _gui_scale_x - _margin); + _y = clamp(_y, _margin, cam1.height * _gui_scale_y - _margin); var _x2 = cam1.room_to_gui_x(obj_player.x); var _y2 = cam1.room_to_gui_y(obj_player.y); @@ -95,3 +95,9 @@ if(pointer){ draw_sprite_ext(spr_arrow_small, 0, _arrow_x, _arrow_y, 1, 1, 180, -1, 1); } } + +var _x = cam1.get_mouse_x(); +var _y = cam1.get_mouse_y(); +draw_set_color(c_red); +draw_circle(cam1.room_to_gui_x(_x), cam1.room_to_gui_y(_y), 15, true); +draw_set_color(c_white); diff --git a/objects/obj_camera/Draw_73.gml b/objects/obj_camera/Draw_73.gml new file mode 100644 index 0000000..34e52b9 --- /dev/null +++ b/objects/obj_camera/Draw_73.gml @@ -0,0 +1,6 @@ +/// @description +var _x = cam1.get_mouse_x(); +var _y = cam1.get_mouse_y(); +draw_set_color(c_green); +draw_circle(_x, _y, 10, true); +draw_set_color(c_white); diff --git a/objects/obj_camera/Draw_77.gml b/objects/obj_camera/Draw_77.gml index 01c5366..4e4c88c 100644 --- a/objects/obj_camera/Draw_77.gml +++ b/objects/obj_camera/Draw_77.gml @@ -1,4 +1,10 @@ cam1.draw(0, 0); if(split_screen){ - cam2.draw(global.game_w * 0.5, 0); + cam2.draw(global.game_w / 2, 0); } + +var _x = cam1.get_mouse_x(); +var _y = cam1.get_mouse_y(); +draw_set_color(c_green); +draw_circle(cam1.room_to_display_x(_x), cam1.room_to_display_y(_y), 18, false); +draw_set_color(c_white); diff --git a/objects/obj_camera/Mouse_60.gml b/objects/obj_camera/Mouse_60.gml index d9feffe..9785471 100644 --- a/objects/obj_camera/Mouse_60.gml +++ b/objects/obj_camera/Mouse_60.gml @@ -1,4 +1,5 @@ var _zoom_amount = cam1.zoom_amount; -_zoom_amount -= 0.05; -_zoom_amount = clamp(_zoom_amount, 0.1, 2); -cam1.zoom(_zoom_amount, 0); \ No newline at end of file +_zoom_amount -= 0.01; +_zoom_amount = clamp(_zoom_amount, 0.1, 3); +cam1.zoom(_zoom_amount, 0); +obj_tv.tv.zoom(_zoom_amount, 0); \ No newline at end of file diff --git a/objects/obj_camera/Mouse_61.gml b/objects/obj_camera/Mouse_61.gml index f2a7023..817905f 100644 --- a/objects/obj_camera/Mouse_61.gml +++ b/objects/obj_camera/Mouse_61.gml @@ -1,4 +1,5 @@ var _zoom_amount = cam1.zoom_amount; -_zoom_amount += 0.05; -_zoom_amount = clamp(_zoom_amount, 0.1, 2); +_zoom_amount += 0.01; +_zoom_amount = clamp(_zoom_amount, 0.1, 3); cam1.zoom(_zoom_amount, 0); +obj_tv.tv.zoom(_zoom_amount, 0); diff --git a/objects/obj_camera/Step_0.gml b/objects/obj_camera/Step_0.gml index b755e90..b8c137c 100644 --- a/objects/obj_camera/Step_0.gml +++ b/objects/obj_camera/Step_0.gml @@ -12,7 +12,7 @@ if(keyboard_check_pressed(vk_f5)){ split_screen = !split_screen; if(split_screen){ - cam1.set_size(global.game_w * 0.5, global.game_h); + cam1.set_size(global.game_w / 2, global.game_h); cam2 = cam1.clone(); cam2.follow = obj_player2; @@ -22,16 +22,6 @@ if(keyboard_check_pressed(vk_f5)){ } } -//toggle hires gui -if(keyboard_check_pressed(vk_alt)){ - gui_hires = !gui_hires; - if(gui_hires){ - stanncam_set_gui_resolution(1920, 1080); - } else { - stanncam_set_gui_resolution(global.game_w, global.game_h); - } -} - //moves camera to mouse press location if(mouse_check_button_pressed(mb_left)){ var _x = cam1.get_mouse_x(); @@ -40,8 +30,8 @@ if(mouse_check_button_pressed(mb_left)){ cam1.move(_x, _y, GAME_SPEED * 1); alarm[0] = GAME_SPEED * 1.1; pointer = true; - pointer_x = cam1.get_mouse_x(); - pointer_y = cam1.get_mouse_y(); + pointer_x = _x; + pointer_y = _y; } //toggle zoom in @@ -62,8 +52,8 @@ if(mouse_check_button_pressed(mb_right)){ break; case 2: //zoom out - cam1.zoom(2, GAME_SPEED * 1); - obj_tv.tv.zoom(2, GAME_SPEED * 1); + cam1.zoom(3, GAME_SPEED * 1); + obj_tv.tv.zoom(3, GAME_SPEED * 1); break; } } @@ -77,16 +67,16 @@ if(keyboard_check_pressed(vk_tab)){ switch (speed_mode) { case 0: - cam1.set_speed(0.5, 50); + cam1.set_speed(0.05); break; case 1: - cam1.set_speed(1, 50); + cam1.set_speed(0.1); break; case 2: - cam1.set_speed(2, 50); + cam1.set_speed(0.2); break; case 3: - cam1.set_speed(10, 50); + cam1.set_speed(1); break; } } @@ -116,8 +106,7 @@ if(keyboard_check_pressed(ord("P"))){ } //switch resolutions -if(keyboard_check_pressed(vk_f1)) -{ +if(keyboard_check_pressed(vk_f1)){ game_res++; if(game_res > 6) game_res = 0; stanncam_set_resolution(resolutions[game_res].w, resolutions[game_res].h); @@ -125,11 +114,28 @@ if(keyboard_check_pressed(vk_f1)) //switch gui resolutions if(keyboard_check_pressed(vk_f2)){ - gui_res++ - if(gui_res > 6) gui_res = 0; - var _gui_w = resolutions[gui_res].w; - var _gui_h = resolutions[gui_res].h; - stanncam_set_gui_resolution(_gui_w, _gui_h); + gui_res++; + if(gui_res >= array_length(gui_resolutions)) gui_res = 0; + var _gui_w = gui_resolutions[gui_res].w; + var _gui_h = gui_resolutions[gui_res].h; + if(gui_hires){ + stanncam_set_gui_resolution(_gui_w * gui_hires_scale, _gui_h * gui_hires_scale); + } else { + stanncam_set_gui_resolution(_gui_w, _gui_h); + } +} + +//toggle hires gui +if(keyboard_check_pressed(vk_alt)){ + gui_hires = !gui_hires; + + var _gui_w = gui_resolutions[gui_res].w; + var _gui_h = gui_resolutions[gui_res].h; + if(gui_hires){ + stanncam_set_gui_resolution(_gui_w * gui_hires_scale, _gui_h * gui_hires_scale); + } else { + stanncam_set_gui_resolution(_gui_w, _gui_h); + } } //toggle keep aspect ratio diff --git a/objects/obj_camera/obj_camera.yy b/objects/obj_camera/obj_camera.yy index eefd232..e6ee6eb 100644 --- a/objects/obj_camera/obj_camera.yy +++ b/objects/obj_camera/obj_camera.yy @@ -9,6 +9,7 @@ {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":60,"eventType":6,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":61,"eventType":6,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"obj_camera", diff --git a/objects/obj_camera_pixel_grid/Create_0.gml b/objects/obj_camera_pixel_grid/Create_0.gml index 64e8ed1..e609597 100644 --- a/objects/obj_camera_pixel_grid/Create_0.gml +++ b/objects/obj_camera_pixel_grid/Create_0.gml @@ -1,18 +1,18 @@ //camera stanncam_init(100, 100, 1920, 1080, 300, 300); -cam1 = new stanncam(room_width * 0.5, room_height * 0.5, global.game_w, global.game_h, false, false); +cam1 = new stanncam(room_width / 2, room_height / 2, global.game_w, global.game_h, false, false); zoom_mode = 0; -zoom_text = cam1.zoom_amount +zoom_text = cam1.zoom_amount; game_res = 0; + resolutions = [ {w:400, h:400}, //1:1 {w:500, h:250}, //2:1 {w:320, h:180}, //16:9 {w:1000, h:1000}, //1:1 {w:1280, h:720}, - {w:1920, h:1080} ]; @@ -21,4 +21,4 @@ vspd = 0; acceleration_spd = 0.02; deacceleration_spd = 0.1; -max_spd = 3; \ No newline at end of file +max_spd = 3; diff --git a/objects/obj_camera_pixel_grid/Draw_0.gml b/objects/obj_camera_pixel_grid/Draw_0.gml new file mode 100644 index 0000000..7ca8ba9 --- /dev/null +++ b/objects/obj_camera_pixel_grid/Draw_0.gml @@ -0,0 +1,9 @@ +/// @description +var _dx = cam1.get_mouse_x(); +var _dy = cam1.get_mouse_y(); + +draw_set_color(c_red); + +draw_point(_dx, _dy); + +draw_set_color(c_white); diff --git a/objects/obj_camera_pixel_grid/Draw_64.gml b/objects/obj_camera_pixel_grid/Draw_64.gml index e674f67..5ae5ee4 100644 --- a/objects/obj_camera_pixel_grid/Draw_64.gml +++ b/objects/obj_camera_pixel_grid/Draw_64.gml @@ -1,3 +1,21 @@ +//draw circle over cursor pos + +var dx = cam1.get_mouse_x(); +var dy = cam1.get_mouse_y(); +var size = 10; + +dx = cam1.room_to_gui_x(dx); +dy = cam1.room_to_gui_y(dy); + +draw_line(dx - size, dy, dx + size, dy); +draw_line(dx, dy - size, dx, dy + size); + +//draws circle in center of room +var cx = cam1.room_to_gui_x(room_width / 2 - 1); +var cy = cam1.room_to_gui_y(room_height / 2 - 1); + +draw_circle(cx, cy, 20, true); + var _outline_width = 1; var _precision = 8; var _offset = 10; @@ -37,9 +55,5 @@ switch (global.window_mode) { draw_text_outline(global.gui_w - 1, _offset * 3, "window mode: " + _window_mode_text + " [F4]", _outline_width, _precision); -var mx = cam1.room_to_gui_x(cam1.get_mouse_x()); -var my = cam1.room_to_gui_y(cam1.get_mouse_y()); draw_set_halign(fa_left); -draw_text(mx, my, $"{mx} {my}"); - - +draw_text(dx, dy, $"{dx} {dy}"); diff --git a/objects/obj_camera_pixel_grid/Draw_77.gml b/objects/obj_camera_pixel_grid/Draw_77.gml index 226de3a..465c72a 100644 --- a/objects/obj_camera_pixel_grid/Draw_77.gml +++ b/objects/obj_camera_pixel_grid/Draw_77.gml @@ -1 +1,5 @@ -cam1.draw(0, 0); \ No newline at end of file +cam1.draw(0, 0); + +var dx = cam1.room_to_display_x(cam1.get_mouse_x()); +var dy = cam1.room_to_display_y(cam1.get_mouse_y()); +draw_circle(dx, dy, 10, false); diff --git a/objects/obj_camera_pixel_grid/Step_0.gml b/objects/obj_camera_pixel_grid/Step_0.gml index 53f34c4..a839b73 100644 --- a/objects/obj_camera_pixel_grid/Step_0.gml +++ b/objects/obj_camera_pixel_grid/Step_0.gml @@ -66,10 +66,10 @@ if(keyboard_check_pressed(vk_f4)){ var _hinput = keyboard_check(vk_right) - keyboard_check(vk_left); var _vinput = keyboard_check(vk_down) - keyboard_check(vk_up); -if(_hinput != 0) hspd += _hinput*acceleration_spd; +if(_hinput != 0) hspd += _hinput * acceleration_spd; else hspd -= min(abs(hspd), deacceleration_spd) * sign(hspd); -if(_vinput != 0) vspd += _vinput*acceleration_spd; +if(_vinput != 0) vspd += _vinput * acceleration_spd; else vspd -= min(abs(vspd), deacceleration_spd) * sign(vspd); hspd = clamp(hspd, -max_spd, max_spd); diff --git a/objects/obj_camera_pixel_grid/obj_camera_pixel_grid.yy b/objects/obj_camera_pixel_grid/obj_camera_pixel_grid.yy index 235b808..5d0511c 100644 --- a/objects/obj_camera_pixel_grid/obj_camera_pixel_grid.yy +++ b/objects/obj_camera_pixel_grid/obj_camera_pixel_grid.yy @@ -8,6 +8,7 @@ {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":77,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"obj_camera_pixel_grid", diff --git a/objects/obj_camera_sidescroller/Create_0.gml b/objects/obj_camera_sidescroller/Create_0.gml index 51b2494..8d179f9 100644 --- a/objects/obj_camera_sidescroller/Create_0.gml +++ b/objects/obj_camera_sidescroller/Create_0.gml @@ -1,26 +1,34 @@ //camera -game_res = stanncam_get_preset_resolution(STANNCAM_RES_PRESETS.GAME_BOY_ADVANCE_160P); -resolution = stanncam_get_preset_resolution(STANNCAM_RES_PRESETS.DESKTOP_1080P); - -resolution_array = stanncam_get_preset_resolution_range(STANNCAM_RES_PRESETS.DESKTOP_720P, STANNCAM_RES_PRESETS.DESKTOP_4K); -array_insert(resolution_array, 0, //adds custom resolution to the array - { - width: 400, - height: 400 - } -); - -gui_resolution_array = stanncam_get_preset_resolution_range(); //gets all the presets - -stanncam_init(game_res.width, game_res.height, 1920, 1080); +resolutions = [ + {width:400, height:400}, //1:1 + {width:500, height:250}, //2:1 + {width:320, height:180}, //16:9 + {width:640, height:360}, + {width:1280, height:720}, + {width:1920, height:1080}, + {width:2560, height:1440}, +]; + +gui_resolutions = [ + {width:320, height:180}, //16:9 + {width:640, height:360}, + {width:1280, height:720}, +]; + +game_res = 4; +gui_res = 1; + +stanncam_init(resolutions[2].width, resolutions[2].height, resolutions[game_res].width, resolutions[game_res].height, gui_resolutions[gui_res].width, gui_resolutions[gui_res].height); cam1 = new stanncam(obj_player_sidescroller.x, obj_player_sidescroller.y, global.game_w, global.game_h); cam1.follow = obj_player_sidescroller; cam1.room_constrain = true; +cam1.debug_draw = true; + cam2 = cam1.clone(); cam2.follow = obj_player_sidescroller2; -cam2.set_size(global.game_w * 0.5, global.game_h, 0); +cam2.set_size(global.game_w / 2, global.game_h, 0); split_screen = false; @@ -30,9 +38,9 @@ zoom_text = cam1.zoom_amount; speed_mode = 1; zoom_mode = 1; -game_res = 2; gui_hires = false; -gui_res = 0; +gui_hires_scale = 6; //how much bigger the hires font is than the pixel one + lookahead = false; @@ -47,9 +55,9 @@ parallax_bg = function(_cam){ var _scaley = stanncam_get_res_scale_y(); //the offset the camera is from the middle of the room - var _offset_x = (-_cam.get_x() - _cam.x_frac) * _scalex; - var _pos_x = -200 + _cam.x_frac; - var _pos_y = 0 + _cam.y_frac; + var _offset_x = -_cam.get_x(); + var _pos_x = -200; + var _pos_y = 0; draw_sprite_ext_tiled(spr_underwater_layer00, 0, _pos_x + (_offset_x * 0.0), _pos_y, 2, 1, _scalex, _scaley); draw_sprite_ext_tiled(spr_underwater_layer01, 0, _pos_x + (_offset_x * 0.2), _pos_y, 2, 1, _scalex, _scaley); diff --git a/objects/obj_camera_sidescroller/Draw_77.gml b/objects/obj_camera_sidescroller/Draw_77.gml index b8726a4..b8f10ae 100644 --- a/objects/obj_camera_sidescroller/Draw_77.gml +++ b/objects/obj_camera_sidescroller/Draw_77.gml @@ -10,13 +10,13 @@ var _scalex = 1 / stanncam_get_res_scale_x(); var _scaley = 1 / stanncam_get_res_scale_y(); if(!split_screen){ - cam1.draw_special(parallax_bg1, 0, 0, _width, _height, _scalex, _scaley); + cam1.draw_special(parallax_bg1, 0, 0, _scalex, _scaley, _width, _height); cam1.draw(0, 0); } else { - //fancy splitscreen rendering - cam1.draw_special(parallax_bg1, 0, 0, _width * 0.5, _height, _scalex, _scaley); + //horizontal splitscreen + cam1.draw_special(parallax_bg1, 0, 0, _scalex, _scaley, _width / 2, _height); cam1.draw(0, 0); - cam2.draw_special(parallax_bg2, global.game_w * 0.5, 0, _width * 0.5, _height, _scalex, _scaley); - cam2.draw(global.game_w * 0.5, 0); + cam2.draw_special(parallax_bg2, global.game_w / 2, 0, _scalex, _scaley, _width / 2, _height); + cam2.draw(global.game_w / 2, 0); } diff --git a/objects/obj_camera_sidescroller/Step_0.gml b/objects/obj_camera_sidescroller/Step_0.gml index 16ed984..6feb814 100644 --- a/objects/obj_camera_sidescroller/Step_0.gml +++ b/objects/obj_camera_sidescroller/Step_0.gml @@ -1,14 +1,3 @@ - -//toggle hires gui -if(keyboard_check_pressed(vk_alt)){ - gui_hires = !gui_hires; - if(gui_hires){ - stanncam_set_gui_resolution(1920, 1080); - } else { - stanncam_set_gui_resolution(global.game_w, global.game_h); - } -} - //toggle zoom in if(mouse_check_button_pressed(mb_right)){ zoom_mode++; @@ -39,19 +28,19 @@ if(keyboard_check_pressed(vk_tab)){ switch (speed_mode) { case 0: //speed 0.5 - cam1.set_speed(0.5, 50); + cam1.set_speed(0.05); break; case 1: //speed 1 - cam1.set_speed(1, 50); + cam1.set_speed(0.1); break; case 2: //speed 2 - cam1.set_speed(2, 50); + cam1.set_speed(0.2); break; case 3: //speed 10 - cam1.set_speed(10, 50); + cam1.set_speed(1); break; } } @@ -89,19 +78,37 @@ if(keyboard_check_pressed(ord("Z"))){ //switch resolutions if(keyboard_check_pressed(vk_f1)){ game_res++; - if(game_res >= array_length(resolution_array)) game_res = 0; - var _res_w = resolution_array[game_res].width; - var _res_h = resolution_array[game_res].height; + if(game_res >= array_length(resolutions)) game_res = 0; + var _res_w = resolutions[game_res].width; + var _res_h = resolutions[game_res].height; stanncam_set_resolution(_res_w, _res_h); } //switch gui resolutions if(keyboard_check_pressed(vk_f2)){ gui_res++; - if(gui_res >= 6) gui_res = 0; - var _gui_w = gui_resolution_array[gui_res].width; - var _gui_h = gui_resolution_array[gui_res].height; - stanncam_set_gui_resolution(_gui_w, _gui_h); + if(gui_res >= array_length(gui_resolutions)) gui_res = 0; + + var _gui_w = gui_resolutions[gui_res].width; + var _gui_h = gui_resolutions[gui_res].height; + if(gui_hires){ + stanncam_set_gui_resolution(_gui_w * gui_hires_scale, _gui_h * gui_hires_scale); + } else { + stanncam_set_gui_resolution(_gui_w, _gui_h); + } +} + +//toggle hires gui +if(keyboard_check_pressed(vk_alt)){ + gui_hires = !gui_hires; + + var _gui_w = gui_resolutions[gui_res].width; + var _gui_h = gui_resolutions[gui_res].height; + if(gui_hires){ + stanncam_set_gui_resolution(_gui_w * gui_hires_scale, _gui_h * gui_hires_scale); + } else { + stanncam_set_gui_resolution(_gui_w, _gui_h); + } } //toggle keep aspect ratio @@ -125,18 +132,18 @@ if(keyboard_check_pressed(vk_f5)){ split_screen = !split_screen; if(split_screen){ - cam1.set_size(global.game_w * 0.5, global.game_h, GAME_SPEED * 0.5); + cam1.set_size(global.game_w / 2, global.game_h, GAME_SPEED / 2); } else { cam1.follow = obj_player_sidescroller; cam2.follow = obj_player_sidescroller2; - cam1.set_size(global.game_w, global.game_h, GAME_SPEED * 0.5); + cam1.set_size(global.game_w, global.game_h, GAME_SPEED / 2); } } //makes the camera look ahead in the direction the player is going if(cam1.bounds_dist_w != 0){ if(!lookahead){ - cam1.offset(60 * sign(cam1.bounds_dist_w), 0, GAME_SPEED * 0.5); + cam1.offset(60 * sign(cam1.bounds_dist_w), 0, GAME_SPEED / 2); lookahead = true; } } else { diff --git a/objects/obj_camera_sidescroller/Step_2.gml b/objects/obj_camera_sidescroller/Step_2.gml deleted file mode 100644 index 075e8a5..0000000 --- a/objects/obj_camera_sidescroller/Step_2.gml +++ /dev/null @@ -1,16 +0,0 @@ - -//fancy split screen -//x = lerp(obj_player_sidescroller.x, obj_player_sidescroller2.x, 0.5); -//y = lerp(obj_player_sidescroller.y, obj_player_sidescroller2.y, 0.5); -//player_dist = point_distance(obj_player_sidescroller.x, obj_player_sidescroller.y, obj_player_sidescroller2.x, obj_player_sidescroller2.y); - -//when the players are close together the camera follows the middle point between them -//if(split_screen){ -// if(player_dist > 100){ -// cam1.follow = obj_player_sidescroller; -// cam2.follow = obj_player_sidescroller2; -// } else { -// cam1.follow = self; -// cam2.follow = self; -// } -//} diff --git a/objects/obj_camera_sidescroller/obj_camera_sidescroller.yy b/objects/obj_camera_sidescroller/obj_camera_sidescroller.yy index 4a9cb10..2b73bb8 100644 --- a/objects/obj_camera_sidescroller/obj_camera_sidescroller.yy +++ b/objects/obj_camera_sidescroller/obj_camera_sidescroller.yy @@ -8,7 +8,6 @@ {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":60,"eventType":6,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":61,"eventType":6,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":2,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"obj_camera_sidescroller", diff --git a/objects/obj_player_sidescroller2/Create_0.gml b/objects/obj_player_sidescroller2/Create_0.gml index d11f85f..78ca3de 100644 --- a/objects/obj_player_sidescroller2/Create_0.gml +++ b/objects/obj_player_sidescroller2/Create_0.gml @@ -3,10 +3,10 @@ event_inherited(); left = function(){ return keyboard_check_direct(ord("A")); -}; +} right = function(){ return keyboard_check_direct(ord("D")); -}; +} jump = function(){ return keyboard_check_pressed(ord("W")); -}; +} diff --git a/objects/obj_stanncam_zone/Create_0.gml b/objects/obj_stanncam_zone/Create_0.gml index e603108..614979d 100644 --- a/objects/obj_stanncam_zone/Create_0.gml +++ b/objects/obj_stanncam_zone/Create_0.gml @@ -9,3 +9,10 @@ image_angle = (image_angle mod 360 + 360) mod 360; if(image_angle mod 90 != 0){ show_error(object_get_name(object_index) + ".image_angle must be a multiple of 90 degrees, got " + string(image_angle) + ".", true); } + +included_zones = []; + +if(instance_exists(included_zone1)) array_push(included_zones, included_zone1); +if(instance_exists(included_zone2)) array_push(included_zones, included_zone2); +if(instance_exists(included_zone3)) array_push(included_zones, included_zone3); +if(instance_exists(included_zone4)) array_push(included_zones, included_zone4); diff --git a/objects/obj_stanncam_zone/obj_stanncam_zone.yy b/objects/obj_stanncam_zone/obj_stanncam_zone.yy index bab0bb7..4eb2a44 100644 --- a/objects/obj_stanncam_zone/obj_stanncam_zone.yy +++ b/objects/obj_stanncam_zone/obj_stanncam_zone.yy @@ -26,7 +26,12 @@ "physicsShape":1, "physicsShapePoints":[], "physicsStartAwake":true, - "properties":[], + "properties":[ + {"$GMObjectProperty":"v2","%Name":"included_zone1","filters":[],"listItems":[],"multiselect":false,"name":"included_zone1","rangeEnabled":false,"rangeMax":10.0,"rangeMin":0.0,"resourceType":"GMObjectProperty","resourceVersion":"2.0","value":"noone","varType":4,}, + {"$GMObjectProperty":"v2","%Name":"included_zone2","filters":[],"listItems":[],"multiselect":false,"name":"included_zone2","rangeEnabled":false,"rangeMax":10.0,"rangeMin":0.0,"resourceType":"GMObjectProperty","resourceVersion":"2.0","value":"noone","varType":4,}, + {"$GMObjectProperty":"v2","%Name":"included_zone3","filters":[],"listItems":[],"multiselect":false,"name":"included_zone3","rangeEnabled":false,"rangeMax":10.0,"rangeMin":0.0,"resourceType":"GMObjectProperty","resourceVersion":"2.0","value":"noone","varType":4,}, + {"$GMObjectProperty":"v2","%Name":"included_zone4","filters":[],"listItems":[],"multiselect":false,"name":"included_zone4","rangeEnabled":false,"rangeMax":10.0,"rangeMin":0.0,"resourceType":"GMObjectProperty","resourceVersion":"2.0","value":"noone","varType":4,}, + ], "resourceType":"GMObject", "resourceVersion":"2.0", "solid":false, diff --git a/objects/obj_stanncam_zone_blank/Create_0.gml b/objects/obj_stanncam_zone_blank/Create_0.gml new file mode 100644 index 0000000..e1ea380 --- /dev/null +++ b/objects/obj_stanncam_zone_blank/Create_0.gml @@ -0,0 +1,9 @@ +/// @description blank zone is used purely to activate other included zones + +// Inherit the parent event +event_inherited(); + +left = false; +top = false; +right = false; +bottom = false; \ No newline at end of file diff --git a/objects/obj_stanncam_zone_blank/obj_stanncam_zone_blank.yy b/objects/obj_stanncam_zone_blank/obj_stanncam_zone_blank.yy new file mode 100644 index 0000000..c445d27 --- /dev/null +++ b/objects/obj_stanncam_zone_blank/obj_stanncam_zone_blank.yy @@ -0,0 +1,41 @@ +{ + "$GMObject":"", + "%Name":"obj_stanncam_zone_blank", + "eventList":[ + {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + ], + "managed":true, + "name":"obj_stanncam_zone_blank", + "overriddenProperties":[], + "parent":{ + "name":"Zones", + "path":"folders/STANNcam/Zones.yy", + }, + "parentObjectId":{ + "name":"obj_stanncam_zone", + "path":"objects/obj_stanncam_zone/obj_stanncam_zone.yy", + }, + "persistent":false, + "physicsAngularDamping":0.1, + "physicsDensity":0.5, + "physicsFriction":0.2, + "physicsGroup":1, + "physicsKinematic":false, + "physicsLinearDamping":0.1, + "physicsObject":false, + "physicsRestitution":0.1, + "physicsSensor":false, + "physicsShape":1, + "physicsShapePoints":[], + "physicsStartAwake":true, + "properties":[], + "resourceType":"GMObject", + "resourceVersion":"2.0", + "solid":false, + "spriteId":{ + "name":"spr_stanncam_zone_connector", + "path":"sprites/spr_stanncam_zone_connector/spr_stanncam_zone_connector.yy", + }, + "spriteMaskId":null, + "visible":true, +} \ No newline at end of file diff --git a/objects/obj_tv/Create_0.gml b/objects/obj_tv/Create_0.gml index 9945f35..3b0f623 100644 --- a/objects/obj_tv/Create_0.gml +++ b/objects/obj_tv/Create_0.gml @@ -1,4 +1,4 @@ -tv = new stanncam(0, 0, 56, 56, true); +tv = new stanncam(0, 0, 56, 56, true, false); tv.follow = obj_player2; tv.bounds_h = 1; diff --git a/objects/obj_tv/Draw_0.gml b/objects/obj_tv/Draw_0.gml index 9642926..d6ae1fe 100644 --- a/objects/obj_tv/Draw_0.gml +++ b/objects/obj_tv/Draw_0.gml @@ -1,2 +1,4 @@ draw_self(); +shader_set(sh_tv); draw_surface(tv.surface_extra, x + 4, y + 4); +shader_reset(); diff --git a/rooms/rm_test/RoomCreationCode.gml b/rooms/rm_test/RoomCreationCode.gml deleted file mode 100644 index cac8e97..0000000 --- a/rooms/rm_test/RoomCreationCode.gml +++ /dev/null @@ -1 +0,0 @@ -//global.camera_follow = obj_player; diff --git a/rooms/rm_test/rm_test.yy b/rooms/rm_test/rm_test.yy index 18be41d..066e994 100644 --- a/rooms/rm_test/rm_test.yy +++ b/rooms/rm_test/rm_test.yy @@ -1,7 +1,7 @@ { "$GMRoom":"v1", "%Name":"rm_test", - "creationCodeFile":"${project_dir}/rooms/Room1/RoomCreationCode.gml", + "creationCodeFile":"rooms/rm_test/RoomCreationCode.gml", "inheritCode":false, "inheritCreationOrder":false, "inheritLayers":false, @@ -9,19 +9,19 @@ {"name":"inst_28868B2A","path":"rooms/rm_test/rm_test.yy",}, {"name":"inst_4BF294D5","path":"rooms/rm_test/rm_test.yy",}, {"name":"inst_BEB4411","path":"rooms/rm_test/rm_test.yy",}, - {"name":"inst_606FE50A","path":"rooms/rm_test/rm_test.yy",}, - {"name":"inst_15296A95","path":"rooms/rm_test/rm_test.yy",}, - {"name":"inst_2DE44815","path":"rooms/rm_test/rm_test.yy",}, + {"name":"inst_42FFF7AC","path":"rooms/rm_test/rm_test.yy",}, + {"name":"inst_3E1AFC53","path":"rooms/rm_test/rm_test.yy",}, + {"name":"inst_451D11CD","path":"rooms/rm_test/rm_test.yy",}, ], "isDnd":false, "layers":[ {"$GMRInstanceLayer":"","%Name":"Instances","depth":0,"effectEnabled":true,"effectType":null,"gridX":16,"gridY":16,"hierarchyFrozen":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"inheritSubLayers":true,"inheritVisibility":true,"instances":[ {"$GMRInstance":"v4","%Name":"inst_4BF294D5","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_4BF294D5","objectId":{"name":"obj_ball","path":"objects/obj_ball/obj_ball.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":112.0,"y":80.0,}, - {"$GMRInstance":"v4","%Name":"inst_BEB4411","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_BEB4411","objectId":{"name":"obj_player","path":"objects/obj_player/obj_player.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":160.0,"y":160.0,}, - {"$GMRInstance":"v4","%Name":"inst_606FE50A","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_606FE50A","objectId":{"name":"obj_player2","path":"objects/obj_player2/obj_player2.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":272.0,"y":144.0,}, - {"$GMRInstance":"v4","%Name":"inst_15296A95","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_15296A95","objectId":{"name":"obj_tv","path":"objects/obj_tv/obj_tv.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":304.0,"y":48.0,}, {"$GMRInstance":"v4","%Name":"inst_28868B2A","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_28868B2A","objectId":{"name":"obj_camera","path":"objects/obj_camera/obj_camera.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":16.0,"y":16.0,}, - {"$GMRInstance":"v4","%Name":"inst_2DE44815","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_2DE44815","objectId":{"name":"obj_stanncam_zone","path":"objects/obj_stanncam_zone/obj_stanncam_zone.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":10.200001,"scaleY":10.199999,"x":254.0,"y":6.0,}, + {"$GMRInstance":"v4","%Name":"inst_BEB4411","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_BEB4411","objectId":{"name":"obj_player","path":"objects/obj_player/obj_player.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":336.0,"y":32.0,}, + {"$GMRInstance":"v4","%Name":"inst_42FFF7AC","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_42FFF7AC","objectId":{"name":"obj_stanncam_zone","path":"objects/obj_stanncam_zone/obj_stanncam_zone.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":10.0,"scaleY":12.0,"x":48.0,"y":32.0,}, + {"$GMRInstance":"v4","%Name":"inst_3E1AFC53","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_3E1AFC53","objectId":{"name":"obj_player2","path":"objects/obj_player2/obj_player2.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":144.0,"y":128.0,}, + {"$GMRInstance":"v4","%Name":"inst_451D11CD","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_451D11CD","objectId":{"name":"obj_tv","path":"objects/obj_tv/obj_tv.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":320.0,"y":48.0,}, ],"layers":[],"name":"Instances","properties":[],"resourceType":"GMRInstanceLayer","resourceVersion":"2.0","userdefinedDepth":false,"visible":true,}, {"$GMRTileLayer":"","%Name":"Tiles_1","depth":100,"effectEnabled":true,"effectType":null,"gridX":16,"gridY":16,"hierarchyFrozen":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"inheritSubLayers":true,"inheritVisibility":true,"layers":[],"name":"Tiles_1","properties":[],"resourceType":"GMRTileLayer","resourceVersion":"2.0","tiles":{"SerialiseHeight":8,"SerialiseWidth":14,"TileCompressedData":[-112,1,],"TileDataFormat":1,},"tilesetId":{"name":"TileSet1","path":"tilesets/TileSet1/TileSet1.yy",},"userdefinedDepth":false,"visible":true,"x":0,"y":0,}, {"$GMRBackgroundLayer":"","%Name":"Backgrounds_1","animationFPS":1.0,"animationSpeedType":1,"colour":4294967295,"depth":200,"effectEnabled":true,"effectType":null,"gridX":16,"gridY":16,"hierarchyFrozen":false,"hspeed":0.0,"htiled":true,"inheritLayerDepth":false,"inheritLayerSettings":false,"inheritSubLayers":true,"inheritVisibility":true,"layers":[],"name":"Backgrounds_1","properties":[],"resourceType":"GMRBackgroundLayer","resourceVersion":"2.0","spriteId":{"name":"spr_bg","path":"sprites/spr_bg/spr_bg.yy",},"stretch":false,"userdefinedAnimFPS":false,"userdefinedDepth":false,"visible":true,"vspeed":0.0,"vtiled":true,"x":0,"y":0,}, diff --git a/scripts/stanncam/stanncam.gml b/scripts/stanncam/stanncam.gml index e3f37d7..f38d008 100644 --- a/scripts/stanncam/stanncam.gml +++ b/scripts/stanncam/stanncam.gml @@ -7,8 +7,8 @@ /// @param {Real} [_width=global.game_w] /// @param {Real} [_height=global.game_h] /// @param {Bool} [_surface_extra_on=false] - use surface_extra in regular draw events -/// @param {Bool} [_smooth_draw=true] - use fractional camera position when drawing -function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surface_extra_on=false, _smooth_draw=true) constructor{ +/// @param {Bool} [_smooth_draw=false] - use fractional camera position when drawing +function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surface_extra_on=false, _smooth_draw=false) constructor{ #region init //whenever a new cam is created number_of_cams gets incremented cam_id = __obj_stanncam_manager.number_of_cams; @@ -17,16 +17,18 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf if(cam_id == 8){ show_error("There can only be a maximum of 8 cameras.", true); } - + __camera = camera_create(); view_camera[cam_id] = __camera; - ++__obj_stanncam_manager.number_of_cams; - global.stanncams[cam_id] = self; + ++__obj_stanncam_manager.number_of_cams; #endregion #region variables + //the first camera uses the application surface + use_app_surface = cam_id == 0 + x = _x; y = _y; @@ -43,11 +45,7 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf //Like a tv screen, where it can capture itself surface_extra_on = _surface_extra_on; - //the first camera uses the application surface - use_app_surface = cam_id == 0; - - spd = 10; //how fast the camera follows an instance - spd_threshold = 50; //the minimum distance the camera is away, for the speed to be in full effect + spd = 1; //how fast the camera follows an instance from 0-1 room_constrain = false; //if camera should be constrained to the room size @@ -76,17 +74,26 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf __destroyed = false; + //zone constrain - __zone_constrain_amount = 0; - __zone = noone; - __zone_constrain_x = 0; - __zone_constrain_y = 0; - __zone_active = false; - __zone_transition = 1; - zone_constrain_speed = 0.1; - + //last list added to array the active list of zones + __zone_lists_max = 4; + __zone_lists = [noone]; //noone means no list of zones, ie, not constrained + + //how much strength each list of zones have + //previous ones gradually fall to 0 and then get removed + __zone_lists_strength = [1]; + + __constrain_offset_x = 0; + __constrain_offset_y = 0; + + __constrain_frac_x = 0; + __constrain_frac_y = 0; + + __constrain_spd = 0.1; + paused = false; - + #region animation variables //moving @@ -120,8 +127,6 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf zoom_amount = 1; __zooming = false; - zoom_x = 0; - zoom_y = 0; __t_zoom = 0; __zoomStart = 0; __zoomTo = 0; @@ -148,15 +153,14 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @description gets called every step /// @ignore static __step = function(){ - + //camera doesn't update if paused if(get_paused()){ return; } - + #region moving if(instance_exists(follow)){ - //update destination __xTo = follow.x; __yTo = follow.y; @@ -167,60 +171,106 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf bounds_dist_w = (max(bounds_w, abs(_x_dist)) - bounds_w) * sign(_x_dist); bounds_dist_h = (max(bounds_h, abs(_y_dist)) - bounds_h) * sign(_y_dist); - bounds_dist_w = round(bounds_dist_w * 100) / 100; //rounds to 2 decimal places - bounds_dist_h = round(bounds_dist_h * 100) / 100; //more decimal places may cause the position to fluctuate at certain points + bounds_dist_w = floor((bounds_dist_w / 0.01) + 0.99) * 0.01; + bounds_dist_h = floor((bounds_dist_h / 0.01) + 0.99) * 0.01; //update camera position - if(abs(_x_dist) > bounds_w){ - var _spd = (bounds_dist_w / spd_threshold) * spd; - if(smooth_draw) _spd = round(_spd); - - x += _spd; - } - - if(abs(_y_dist) > bounds_h){ - var _spd = (bounds_dist_h / spd_threshold) * spd; - if(smooth_draw) _spd = round(_spd); - - y += _spd; - } + x += bounds_dist_w * spd; + y += bounds_dist_h * spd; } else if(__moving){ - __t++; - //gradually moves camera into position based on duration x = stanncam_animcurve(__t, __xStart, __xTo, __duration, anim_curve); y = stanncam_animcurve(__t, __yStart, __yTo, __duration, anim_curve); + + __t = min(__t + 1, __duration); if(__t >= __duration){ __moving = false; + x = __xTo; + y = __yTo; } } #endregion #region zone constrain if(instance_exists(follow)){ - var new_zone = instance_position(follow.x, follow.y, obj_stanncam_zone); - if(new_zone != noone){ - - //if a zone is already active it will transition from one to the other - if(__zone != new_zone && __zone_active) __zone_transition = 0; - - __zone_active = true; - __zone = new_zone; + + var _zone_list = ds_list_create(); + var _zone_count = instance_position_list(follow.x, follow.y, obj_stanncam_zone, _zone_list, false); + if(_zone_count != 0){ + //adds included zones to list + for (var j = 0; j < _zone_count; j++) { + var _zone = _zone_list[| j]; + var _included_zones_count = array_length(_zone.included_zones); + if(_included_zones_count > 0){ + + for (var i = 0; i < _included_zones_count; i++) { + var _included_zone = _zone.included_zones[i]; + + //included zones are added, unless they're already within the list + if (ds_list_find_index(_zone_list, _included_zone) == -1){ + ds_list_add(_zone_list, _included_zone); + } + } + } + } } else { - __zone_active = false; + ds_list_destroy(_zone_list); + _zone_list = noone; + } + + var _active_list = array_last(__zone_lists); + + var _active_list_compare = noone; + if(ds_exists(_active_list, ds_type_list)){ + _active_list_compare = ds_list_write(_active_list); + } + + var _zone_list_compare = noone; + if(ds_exists(_zone_list, ds_type_list)){ + _zone_list_compare = ds_list_write(_zone_list); + } + + //if entering a new list of zones, it gets added to the zone_lists array. and the previous ones fade out over time + if(_active_list_compare != _zone_list_compare){ + array_push(__zone_lists_strength, 0); + array_push(__zone_lists, _zone_list); + + //ensures that the zone lists array has a max size + if(array_length(__zone_lists) > __zone_lists_max){ + array_shift(__zone_lists_strength); + + //if the index being removed is a DS list, destroy it to prevent leaks + if(ds_exists(__zone_lists[0], ds_type_list)){ + ds_list_destroy(__zone_lists[0]); + } + array_shift(__zone_lists); + } + } + + var _len = array_length(__zone_lists_strength) - 1; + for (var k = 0; k <= _len; k++) { + if(k != _len){ + __zone_lists_strength[k] = lerp(__zone_lists_strength[k], 0, __constrain_spd); + } else { + __zone_lists_strength[k] = lerp(__zone_lists_strength[k], 1, __constrain_spd); + } + + if(__zone_lists_strength[k] == 0){ + array_delete(__zone_lists_strength, k, 1); + + //if the index being removed is a DS list, destroy it to prevent leaks + if(ds_exists(__zone_lists[k], ds_type_list)){ + ds_list_destroy(__zone_lists[k]); + } + array_delete(__zone_lists, k, 1); + + _len = array_length(__zone_lists_strength) - 1; + k--; + } } - } - if(__zone_active){ - __zone_constrain_amount = lerp(__zone_constrain_amount, 1, zone_constrain_speed); - } else { - __zone_constrain_amount = lerp(__zone_constrain_amount, 0, zone_constrain_speed); - } - - if(__zone_transition != 1){ - __zone_transition = lerp(__zone_transition, 1, zone_constrain_speed); } #endregion @@ -230,9 +280,14 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf //gradually offsets camera based on duration offset_x = stanncam_animcurve(__offset_t, __offset_xStart, __offset_xTo, __offset_duration, anim_curve_offset); offset_y = stanncam_animcurve(__offset_t, __offset_yStart, __offset_yTo, __offset_duration, anim_curve_offset); - - __offset_t++; - if(x == __offset_xTo && y == __offset_yTo) __offset = false; + + __offset_t = min(__offset_t + 1, __offset_duration); + + if(__offset_t >= __offset_duration){ + __offset = false; + offset_x = __offset_xTo; + offset_y = __offset_yTo; + } } #endregion @@ -245,29 +300,37 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf #endregion #region zooming - if(__zooming || __size_change){ - if(__size_change){ - //gradually resizes camera - width = stanncam_animcurve(__dimen_t, __wStart, __wTo, __dimen_duration, anim_curve_size); - height = stanncam_animcurve(__dimen_t, __hStart, __hTo, __dimen_duration, anim_curve_size); - - __dimen_t++; - - if(width == __wTo && height == __hTo) __size_change = false; + if(__zooming || __size_change){ + if(__size_change){ + //gradually resizes camera + width = stanncam_animcurve(__dimen_t, __wStart, __wTo, __dimen_duration, anim_curve_size); + height = stanncam_animcurve(__dimen_t, __hStart, __hTo, __dimen_duration, anim_curve_size); + + __dimen_t = min(__dimen_t + 1, __dimen_duration); + + if(__dimen_t >= __dimen_duration){ + __size_change = false; + width = __wTo; + height = __hTo; } + } + + if(__zooming){ + //gradually zooms camera + zoom_amount = stanncam_animcurve(__t_zoom, __zoomStart, __zoomTo, __zoom_duration, anim_curve_zoom); - if(__zooming){ - //gradually zooms camera - zoom_amount = stanncam_animcurve(__t_zoom, __zoomStart, __zoomTo, __zoom_duration, anim_curve_zoom); - __t_zoom++; - - if(zoom_amount == __zoomTo) __zooming = false; + __t_zoom = min(__t_zoom + 1, __zoom_duration); + + if(__t_zoom >= __zoom_duration) { + __zooming = false; + zoom_amount = __zoomTo; } } + } #endregion - __update_view_size(); __update_view_pos(); + __update_view_size(); } #endregion @@ -276,25 +339,56 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @function clone /// @description returns a clone of the stanncam /// @returns {Struct.stanncam} - /// @ignore static clone = function(){ var _clone = new stanncam(x, y, width, height); - _clone.surface_extra_on = surface_extra_on; _clone.offset_x = offset_x; _clone.offset_y = offset_y; + _clone.follow = follow; + _clone.surface_extra_on = surface_extra_on; _clone.spd = spd; - _clone.spd_threshold = spd_threshold; _clone.room_constrain = room_constrain; _clone.bounds_w = bounds_w; _clone.bounds_h = bounds_h; - _clone.follow = follow; _clone.smooth_draw = smooth_draw; _clone.anim_curve = anim_curve; _clone.anim_curve_zoom = anim_curve_zoom; - _clone.anim_curve_offset = anim_curve_offset; _clone.anim_curve_size = anim_curve_size; + _clone.anim_curve_offset = anim_curve_offset; + _clone.debug_draw = debug_draw; _clone.paused = paused; + _clone.__moving = __moving; + _clone.__xStart = __xStart; + _clone.__yStart = __yStart; + _clone.__xTo = __xTo; + _clone.__yTo = __yTo; + _clone.__duration = __duration; + _clone.__t = __t; + + _clone.__size_change = __size_change; + _clone.__wStart = __wStart; + _clone.__hStart = __hStart; + _clone.__wTo = __wTo; + _clone.__hTo = __hTo; + _clone.__dimen_duration = __dimen_duration; + _clone.__dimen_t = __dimen_t; + + _clone.__offset = __offset + _clone.__offset_xStart = __offset_xStart; + _clone.__offset_yStart = __offset_yStart; + _clone.__offset_xTo = __offset_xTo; + _clone.__offset_yTo = __offset_yTo; + _clone.__offset_duration = __offset_duration; + _clone.__offset_t = __offset_t; + + _clone.zoom_amount = zoom_amount; + + _clone.__zooming = __zooming; + _clone.__t_zoom = __t_zoom; + _clone.__zoomStart = __zoomStart; + _clone.__zoomTo = __zoomTo; + _clone.__zoom_duration = __zoom_duration; + return _clone; } @@ -303,12 +397,12 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @param {Real} _x /// @param {Real} _y /// @param {Real} [_duration=0] - /// @ignore static move = function(_x, _y, _duration=0){ - if(_duration == 0 && !instance_exists(follow)){ + if(_duration == 0 && follow == noone){ //view position is updated immediately x = _x; y = _y; + __moving = false; __update_view_pos(); } else { __moving = true; @@ -327,7 +421,6 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @param {Real} _width /// @param {Real} _height /// @param {Real} [_duration=0] - /// @ignore static set_size = function(_width, _height, _duration=0){ if(_duration == 0){ //if duration is 0 the view is updated immediately width = _width; @@ -350,7 +443,6 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @param {Real} _offset_x /// @param {Real} _offset_y /// @param {Real} [_duration=0] - /// @ignore static offset = function(_offset_x, _offset_y, _duration=0){ if(_duration == 0){ //if duration is 0 the view is updated immediately offset_x = _offset_x; @@ -372,17 +464,10 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @description zooms the camera over a duration /// @param {Real} _zoom /// @param {Real} [_duration=0] - /// @ignore static zoom = function(_zoom, _duration=0){ if(_duration == 0){ //if duration is 0 the view is updated immediately zoom_amount = _zoom; - //some rounding issues, so here we round to nearest second decimal place, IE 0.19999999 becomes 0.02, very edge case problem - zoom_amount = round(zoom_amount * 100) / 100; - - zoom_x = ((width * zoom_amount) - width) * 0.5; - zoom_y = ((height * zoom_amount) - height) * 0.5; - if(!get_paused()){ __update_view_size(); } @@ -395,27 +480,10 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf } } - /// @function get_zoom_x - /// @description there's a difference in how zoom works with smooth_draw on/off if you need to use the zoom_amount while smooth_draw is off, you need to use this function - /// @ignore - static get_zoom_x = function(){ - if(smooth_draw) return zoom_amount; - return surface_get_width(surface) / width; - } - - /// @function get_zoom_y - /// @description there's a difference in how zoom works with smooth_draw on/off if you need to use the zoom_amount while smooth_draw is off, you need to use this function - /// @ignore - static get_zoom_y = function(){ - if(smooth_draw) return zoom_amount; - return surface_get_height(surface) / height; - } - /// @function shake_screen /// @description makes the camera shake /// @param {Real} _magnitude /// @param {Real} _duration - duration in frames - /// @ignore static shake_screen = function(_magnitude, _duration){ __shake_magnitude = _magnitude; __shake_length = _duration; @@ -424,95 +492,94 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @function set_speed /// @description changes the speed of the camera - /// @param {Real} _spd - how fast the camera can move - /// @param {Real} _threshold - minimum distance for the speed to have full effect - /// @ignore - static set_speed = function(_spd, _threshold){ + /// @param {Real} _spd - how fast the camera follows from 0-1 + static set_speed = function(_spd){ spd = _spd; - spd_threshold = _threshold; } - + /// @function set_paused /// @description sets camera paused state /// @param {Bool} _paused static set_paused = function(_paused){ paused = _paused; } - + /// @function get_paused /// @description gets camera's paused state /// @returns {Bool} static get_paused = function(){ return paused; } - + /// @function toggle_paused /// @description toggles the camera's paused state static toggle_paused = function(){ set_paused(!get_paused()); } - + /// @function get_x - /// @description get camera corner x position. if need the middle of the camera use x + /// @description get camera corner x position /// @returns {Real} - /// @ignore static get_x = function(){ - return camera_get_view_x(__camera); + var _x = camera_get_view_x(__camera); + return _x + (width / 2) * ceil(zoom_amount - 1); } /// @function get_y - /// @description get camera corner y position. if need the middle of the camera use y + /// @description get camera corner y position /// @returns {Real} - /// @ignore static get_y = function(){ - return camera_get_view_y(__camera); + var _y = camera_get_view_y(__camera); + return _y + (height / 2) * ceil(zoom_amount - 1); } /// @function get_mouse_x /// @description gets the mouse x position within room relative to the camera /// @returns {Real} - /// @ignore static get_mouse_x = function(){ - var _mouse_x = (((window_mouse_get_x() - stanncam_ratio_compensate_x()) / (__obj_stanncam_manager.__display_scale_x * width)) * width * get_zoom_x()) + get_x(); - if(smooth_draw) return _mouse_x; - return _mouse_x - (_mouse_x mod get_zoom_x()); + var _mouse_x = view_to_room_x((window_mouse_get_x() - stanncam_ratio_compensate_x()) / stanncam_get_res_scale_x()); + _mouse_x += __constrain_frac_x + __constrain_offset_x; + return _mouse_x; } /// @function get_mouse_y /// @description gets the mouse y position within room relative to the camera /// @returns {Real} - /// @ignore static get_mouse_y = function(){ - var _mouse_y = (((window_mouse_get_y() - stanncam_ratio_compensate_y()) / (__obj_stanncam_manager.__display_scale_y * height)) * height * get_zoom_y()) + get_y(); - if(smooth_draw) return _mouse_y; - return _mouse_y - (_mouse_y mod get_zoom_y()); + var _mouse_y = view_to_room_y((window_mouse_get_y() - stanncam_ratio_compensate_y()) / stanncam_get_res_scale_y()); + _mouse_y += __constrain_frac_y + __constrain_offset_y; + return _mouse_y; } /// @function room_to_gui_x /// @description returns the room x position as the position on the gui relative to camera /// @param {Real} _x /// @returns {Real} - /// @ignore static room_to_gui_x = function(_x){ - return ((_x - get_x() - x_frac) / get_zoom_x()) * stanncam_get_gui_scale_x(); + var _gui_x = _x - __constrain_offset_x - __constrain_frac_x; + _gui_x = room_to_view_x(_gui_x) * stanncam_get_gui_scale_x() - 1; + return _gui_x; } /// @function room_to_gui_y /// @description returns the room y position as the position on the gui relative to camera /// @param {Real} _y /// @returns {Real} - /// @ignore static room_to_gui_y = function(_y){ - return ((_y - get_y() - y_frac) / get_zoom_y()) * stanncam_get_gui_scale_y(); + var _gui_y = _y - __constrain_offset_y - __constrain_frac_y; + _gui_y = room_to_view_y(_gui_y) * stanncam_get_gui_scale_y() - 1; + return _gui_y; } /// @function get_active_zone - /// @description returns the active zone the followed instance is within, noone if outside, or no instance is followed + /// @description returns list of active zones the followed instance is within, noone if outside, or no instance is followed /// @returns {Id.Instance|Noone} - /// @ignore static get_active_zone = function(){ - if(__zone_active){ - return __zone; + if(follow == noone) return noone; + + var _active_zones = array_last(__zone_lists); + if(_active_zones != noone){ + return _active_zones; } return noone; } @@ -522,7 +589,8 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @param {Real} _x /// @returns {Real} function room_to_display_x(_x){ - return ((_x - get_x() - x_frac) / get_zoom_x()) * stanncam_get_res_scale_x(); + var _display_x = _x - __constrain_offset_x - __constrain_frac_x; + return room_to_view_x(_display_x) * stanncam_get_res_scale_x() + stanncam_ratio_compensate_x() - 1; } /// @function room_to_display_y @@ -530,7 +598,8 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @param {Real} _y /// @returns {Real} function room_to_display_y(_y){ - return ((_y - get_y() - y_frac) / get_zoom_y()) * stanncam_get_res_scale_y(); + var _display_y = _y - __constrain_offset_y - __constrain_frac_y; + return room_to_view_y(_display_y) * stanncam_get_res_scale_y() + stanncam_ratio_compensate_y() - 1; } /// @function out_of_bounds @@ -539,23 +608,22 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @param {Real} _y /// @param {Real} [_margin=0] /// @returns {Bool} - /// @ignore static out_of_bounds = function(_x, _y, _margin=0){ - var _cam_x = get_x(); - var _cam_y = get_y(); + _x = room_to_view_x(_x); + _y = room_to_view_y(_y); + var _col = //uses camera view bounding box - (_x < (_cam_x + _margin)) || - (_y < (_cam_y + _margin)) || - (_x > ((_cam_x + (width * zoom_amount)) - _margin)) || - (_y > ((_cam_y + (height * zoom_amount)) - _margin)) + (_x < (_margin)) || + (_y < (_margin)) || + (_x > (width - _margin)) || + (_y > (height - _margin)) ; - + return _col; } /// @function destroy /// @description marks the stanncam as destroyed - /// @ignore static destroy = function(){ camera_destroy(__camera); global.stanncams[cam_id] = -1; @@ -571,14 +639,73 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @function is_destroyed /// @returns {Bool} - /// @ignore static is_destroyed = function(){ return __destroyed; } + + /// @function room_to_view_x + /// @description room position to camera view + /// @param {Real} [_x] + static room_to_view_x = function(_x){ + var _zoom = __get_zoom(); + var _zoom_offset = (width * (1 - _zoom)) / 2; + + _x -= _zoom_offset + (x - width / 2) - 1; + _x /= _zoom; + + return _x; + } + + /// @function view_to_room_x + /// @description camera view to room position + /// @param {Real} [_x] + static view_to_room_x = function(_x){ + var _zoom = __get_zoom(); + var _zoom_offset = (width * (1 - _zoom)) / 2; + + _x *= _zoom; + _x += _zoom_offset + (x - width / 2) - 1; + + return _x; + } + + /// @function room_to_view_y + /// @description room position to camera view + /// @param {Real} [_y] + static room_to_view_y = function(_y){ + var _zoom = __get_zoom(); + var _zoom_offset = (height * (1 - _zoom)) / 2; + + _y -= _zoom_offset + (y - height / 2) - 1; + _y /= _zoom; + + return _y; + } + + /// @function view_to_room_y + /// @description camera view to room position + /// @param {Real} [_y] + static view_to_room_y = function(_y){ + var _zoom = __get_zoom(); + var _zoom_offset = (height * (1 - _zoom)) / 2; + + _y *= _zoom; + _y += _zoom_offset + (y - height / 2) - 1; + + return _y; + } #endregion #region Internal functions + /// @function __get_zoom + /// @description gets zoom value, snapped if smooth draw is off + /// @ignore + static __get_zoom = function(){ + if(smooth_draw) return zoom_amount; + else return floor((zoom_amount / 0.02) + 0.999) * 0.02; + } + /// @function __check_viewports /// @description enables viewports and sets viewports size /// @ignore @@ -611,37 +738,44 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @ignore static __predraw = function(){ __check_surface(); - if(surface_extra_on){ - surface_copy(surface_extra, 0, 0, surface); - } surface_set_target(surface); draw_clear_alpha(c_black, 0); - surface_reset_target() + surface_reset_target(); view_set_surface_id(cam_id, surface); } + /// @function __postdraw + /// @description postdraw drawing + /// @ignore + static __postdraw = function(){ + if(surface_extra_on){ + var _left = 0; + var _top = 0; + + var _zoom_whole = ceil(zoom_amount - 1); + _left -= (width / 2) * _zoom_whole; + _top -= (height / 2) * _zoom_whole; + + surface_copy(surface_extra, _left, _left, surface); + } + } + /// @function __update_view_size /// @description updates the view size /// @param {Bool} [_force=false] /// @ignore static __update_view_size = function(_force=false){ - //if smooth_draw is off maintains pixel perfection even when zooming in and out - //if on it is handled by the draw events - if(smooth_draw){ - var _ceiled_zoom = ceil(zoom_amount); //ensures the new surface size is a whole number - var _new_width = width * _ceiled_zoom + 1; //smooth drawing needs the surface to be 1 pixel wider and taller to remove edge warping - var _new_height = height * _ceiled_zoom + 1; - } else { - var _new_width = floor(width * zoom_amount); - var _new_height = floor(height * zoom_amount); - - var _width_2px = _new_width mod 2; - var _height_2px = _new_height mod 2; - - _new_width = _new_width - _width_2px; - _new_height = _new_height - _height_2px; + //if zooming out the surface is scaled up + var _zoom = ceil(zoom_amount); + var _new_width = width * _zoom; + var _new_height = height * _zoom; + + if(smooth_draw){ //smooth drawing needs the surface to be 1 pixel wider and taller to remove edge warping + _new_width += 1; + _new_height += 1; } + //only runs if the size has changed (unless forced, used by __check_viewports to initialize) if(_force || surface_get_width(surface) != _new_width || surface_get_height(surface) != _new_height){ __check_surface(); @@ -649,107 +783,190 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf camera_set_view_size(__camera, _new_width, _new_height); } } - + /// @function __update_view_pos /// @description updates the view position /// @ignore static __update_view_pos = function(){ //update camera view - var _new_x = x + offset_x - (width * 0.5) + __shake_x; - var _new_y = y + offset_y - (height * 0.5) + __shake_y; + var _new_x = x + offset_x - (width / 2) + __shake_x; + var _new_y = y + offset_y - (height / 2) + __shake_y; - if(!smooth_draw){// when smooth draw is off, the actual camera position gets rounded to whole numbers - _new_x = round(_new_x); - _new_y = round(_new_y); - } + var _zoom_whole = ceil(zoom_amount - 1); + _new_x -= (width / 2) * _zoom_whole; + _new_y -= (height / 2) * _zoom_whole; - //apply zoom offset - _new_x -= zoom_x; - _new_y -= zoom_y; + //round to nearest 0.01 decimal + _new_x = floor(_new_x / 0.01 + 0.99) * 0.01; + _new_y = floor(_new_y / 0.01 + 0.99) * 0.01; - if(smooth_draw){ //smooth drawing requires one extra pixel on the camera surface to remove edge warping, this is to fix the offset that occurs with that - if(_new_x <= 0) _new_x -= 1; - if(_new_y <= 0) _new_y -= 1; + x_frac = frac(_new_x); + y_frac = frac(_new_y); + if(x_frac < 0) { + x_frac++; } - - //without smooth_draw zooming needs to be snapped a bit - var _width_stepped = (width * zoom_amount); - var _height_stepped = (height * zoom_amount); - if(!smooth_draw){ - _width_stepped -= _width_stepped mod 2; - _height_stepped -= _height_stepped mod 2; + if(y_frac < 0){ + y_frac++; } - + + _new_x = floor(_new_x); + _new_y = floor(_new_y); + + #region constraining + + var _constrain_offset_x = array_create(array_length(__zone_lists), 0); + var _constrain_offset_y = array_create(array_length(__zone_lists), 0); + + var _view_left = view_to_room_x(0) + 1; + var _view_right = view_to_room_x(width) + 1; + var _view_top = view_to_room_y(0) + 1; + var _view_bottom = view_to_room_y(height) + 1; + + _view_left += offset_x; + _view_right += offset_x; + _view_top += offset_y; + _view_bottom += offset_y; + //zone constricting - if(__zone != noone){ - var _zone_constrain_x = 0; - var _zone_constrain_y = 0; - - var _left, _right, _top, _bottom; + for (var l = 0; l < array_length(__zone_lists); l++) { - if(__zone.left){ - _left = max(0, __zone.bbox_left - _new_x); - } - if(__zone.right){ - _right = -max(0, _new_x + _width_stepped - __zone.bbox_right); - } - if(__zone.top){ - _top = max(0, __zone.bbox_top - _new_y); - } - if(__zone.bottom){ - _bottom = -max(0, _new_y + _height_stepped - __zone.bbox_bottom); + if(__zone_lists[l] != noone){ + + var _zone_left = undefined; + var _zone_right = undefined; + var _zone_top = undefined; + var _zone_bottom = undefined; + + //needs to loop through every zone & room bounds, to find narrowest relative to camera position + // eg zone.right zone.left ect + + for (var z = 0; z < ds_list_size(__zone_lists[l]); z++) { + var _zone = __zone_lists[l][| z]; + + if(_zone.left ){ // if dist from the zone edge to the center is shorter than previous it takes over + if(_zone_left == undefined || _zone.bbox_left < _zone_left){ + _zone_left = _zone.bbox_left; + } + } + if(_zone.right){ + if(_zone_right == undefined || _zone.bbox_right > _zone_right){ + _zone_right = _zone.bbox_right; + } + } + if(_zone.top){ + if(_zone_top == undefined || _zone.bbox_top < _zone_top){ + _zone_top = _zone.bbox_top; + } + } + if(_zone.bottom){ + if(_zone_bottom == undefined || _zone.bbox_bottom > _zone_bottom){ + _zone_bottom = _zone.bbox_bottom; + } + } + } + + //Constrains camera to zones/room bounds + + #region horizontal constraint + var _zone_center_h = false; + if(_zone_left != undefined && _zone_right != undefined){ + //if width of zone is narrower than width of camera, constrain to center + var _zone_width = (_zone_right - _zone_left); + if((_view_right - _view_left) > _zone_width){ + var _middle = ((_zone_left + _zone_right) / 2) - 1; + _constrain_offset_x[l] = _middle - x - offset_x; + _zone_center_h = true; + } + } + + if(!_zone_center_h && (_zone_left != undefined || _zone_right != undefined)){ + if(_zone_left != undefined){ //left zone + _constrain_offset_x[l] -= min(_view_left - _zone_left, 0); + } + + if(_zone_right != undefined){ //right zone + _constrain_offset_x[l] -= max(_view_right - _zone_right, 0); + } + } + + #endregion + + #region vertical constraint + var _zone_center_v = false; + if(_zone_top != undefined && _zone_bottom != undefined){ + //if height of zone is narrower than height of camera, constrain to center + var _zone_height = (_zone_bottom - _zone_top); + if((_view_bottom - _view_top) > _zone_height){ + var _middle = ((_zone_top + _zone_bottom) / 2) - 1; + _constrain_offset_y[l] = _middle - y - offset_y; + _zone_center_v = true; + } + } + + if(!_zone_center_v && (_zone_top != undefined || _zone_bottom != undefined)){ + if(_zone_top != undefined){ //top zone + _constrain_offset_y[l] -= min(_view_top - _zone_top, 0); + } + + if(_zone_bottom != undefined){ //bottom zone + _constrain_offset_y[l] -= max(_view_bottom - _zone_bottom , 0); + } + } + #endregion } - - //horizontal check - if(__zone.sprite_width <= (_width_stepped) && __zone.left && __zone.right){ - //if the zones width is smaller than the camera and both left and right are constraining the cam will be pushed to its middle - _zone_constrain_x = (__zone.x+__zone.sprite_width/2) - (_new_x+_width_stepped/2); + } + + __constrain_offset_x = 0; + __constrain_offset_y = 0; + + for (var i = 0; i < array_length(__zone_lists_strength); i++) { + __constrain_offset_x += _constrain_offset_x[i] * __zone_lists_strength[i]; + __constrain_offset_y += _constrain_offset_y[i] * __zone_lists_strength[i]; + } + + if(room_constrain){ + //Horizontal + if((_view_right - _view_left) < room_width) { + __constrain_offset_x = clamp(__constrain_offset_x, -_view_left, room_width - 1 - _view_right); } else { - if(__zone.left) _zone_constrain_x += _left; - if(__zone.right) _zone_constrain_x += _right; + __constrain_offset_x = (room_width - (_view_right + _view_left)) / 2; } - //vertical check - if(__zone.sprite_height <= (_height_stepped) && __zone.top && __zone.bottom){ - _zone_constrain_y = (__zone.y+__zone.sprite_height/2) - (_new_y+_height_stepped/2); + //Vertical + if((_view_bottom - _view_top) < room_height) { + __constrain_offset_y = clamp(__constrain_offset_y, -_view_top, room_height - 1 - _view_bottom); } else { - if(__zone.top) _zone_constrain_y += _top; - if(__zone.bottom) _zone_constrain_y += _bottom; + __constrain_offset_y = (room_height - (_view_bottom + _view_top)) / 2; } - - __zone_constrain_x = lerp(__zone_constrain_x, _zone_constrain_x, __zone_transition); - __zone_constrain_y = lerp(__zone_constrain_y, _zone_constrain_y, __zone_transition); + } - //constrains new camera position using constrain_amount - _new_x += lerp(0, __zone_constrain_x, __zone_constrain_amount); - _new_y += lerp(0, __zone_constrain_y, __zone_constrain_amount); + #region fractional constraint + + __constrain_frac_x = frac(__constrain_offset_x); + if(__constrain_offset_x > 0){ + __constrain_offset_x = floor(__constrain_offset_x); + } else if (__constrain_offset_x < 0) { + __constrain_offset_x = ceil(__constrain_offset_x); } - //Constrains camera to room - if(room_constrain){ - __constrain_offset_x = (clamp(_new_x, 0, room_width - _width_stepped) - _new_x); - __constrain_offset_y = (clamp(_new_y, 0, room_height - _height_stepped) - _new_y); - - _new_x += __constrain_offset_x; - _new_y += __constrain_offset_y; - } else { - __constrain_offset_x = 0; - __constrain_offset_y = 0; + __constrain_frac_y = frac(__constrain_offset_y); + if(__constrain_offset_y > 0){ + __constrain_offset_y = floor(__constrain_offset_y); + } else if (__constrain_offset_y < 0){ + __constrain_offset_y = ceil(__constrain_offset_y); } - if(smooth_draw){ - //seperates position into whole and fractional parts - //when position is negative, fraction is too, and so this is to compensate for that - - if(_new_x > 0) x_frac = frac(_new_x); - else x_frac = 1 + frac(_new_x); - - if(_new_y > 0) y_frac = frac(_new_y); - else y_frac = 1 + frac(_new_y); - - _new_x = floor(abs(_new_x)) * sign(_new_x); - _new_y = floor(abs(_new_y)) * sign(_new_y); - + #endregion + + _new_x += __constrain_offset_x; + _new_y += __constrain_offset_y; + + #endregion + + //when smooth draw is off, the fractions are applied directly on the camera and not in draw step + if(!smooth_draw){ + _new_x+=x_frac + __constrain_frac_x; + _new_y+=y_frac + __constrain_frac_y; } camera_set_view_pos(__camera, _new_x, _new_y); @@ -769,17 +986,20 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf var _pre_color = draw_get_color(); - var x_offset = -offset_x - __constrain_offset_x - (__zone_constrain_x * __zone_constrain_amount) + zoom_x; - var y_offset = -offset_y - __constrain_offset_y - (__zone_constrain_y * __zone_constrain_amount) + zoom_y; + var _x_offset = -offset_x - __constrain_offset_x; + var _y_offset = -offset_y - __constrain_offset_y; + + var _zoom_whole = ceil(zoom_amount - 1); + _x_offset += (width / 2) * _zoom_whole; + _y_offset += (height / 2) * _zoom_whole; - var _x1 = (width * 0.5) - bounds_w + x_offset; - var _x2 = (width * 0.5) + bounds_w + x_offset; - var _y1 = (height * 0.5) - bounds_h + y_offset; - var _y2 = (height * 0.5) + bounds_h + y_offset; + var _x1 = (width / 2) - bounds_w + _x_offset; + var _x2 = (width / 2) + bounds_w + _x_offset; + var _y1 = (height / 2) - bounds_h + _y_offset; + var _y2 = (height / 2) + bounds_h + _y_offset; draw_set_color(c_white); draw_rectangle(_x1, _y1, _x2, _y2, true); - draw_set_color(c_red); //top @@ -814,7 +1034,6 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @param {Real} _y /// @param {Real} [_scale_x=1] /// @param {Real} [_scale_y=1] - /// @ignore static draw = function(_x, _y, _scale_x=1, _scale_y=1){ __check_surface(); __debug_draw(); @@ -827,7 +1046,6 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @param {Real} _y /// @param {Real} [_scale_x=1] /// @param {Real} [_scale_y=1] - /// @ignore static draw_no_compensate = function(_x, _y, _scale_x=1, _scale_y=1){ __check_surface(); __debug_draw(); @@ -844,7 +1062,6 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @param {Real} _height /// @param {Real} [_scale_x=1] /// @param {Real} [_scale_y=1] - /// @ignore static draw_part = function(_x, _y, _left, _top, _width, _height, _scale_x=1, _scale_y=1){ __check_surface(); __debug_draw(); @@ -856,29 +1073,52 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @param {Function} _draw_func /// @param {Real} _x /// @param {Real} _y - /// @param {Real} [_surf_width=width] - /// @param {Real} [_surf_height=height] /// @param {Real} [_scale_x=1] /// @param {Real} [_scale_y=1] - /// @ignore - static draw_special = function(_draw_func, _x, _y, _surf_width=width, _surf_height=height, _scale_x=1, _scale_y=1){ - var _surf_width_scaled = floor(_surf_width * zoom_amount); - var _surf_height_scaled = floor(_surf_height * zoom_amount); + /// @param {Real} [_surf_width=width] + /// @param {Real} [_surf_height=height] + static draw_special = function(_draw_func, _x, _y, _scale_x=1, _scale_y=1, _surf_width=width, _surf_height=height){ + + var _zoom = ceil(zoom_amount); + var _surf_width_scaled = _surf_width * _zoom; + var _surf_height_scaled = _surf_height * _zoom; + if(surface_exists(__surface_special)){ if((surface_get_width(__surface_special) != _surf_width_scaled) || (surface_get_height(__surface_special) != _surf_height_scaled)){ surface_free(__surface_special); } } + if(!surface_exists(__surface_special)){ __surface_special = surface_create(_surf_width_scaled, _surf_height_scaled); } surface_set_target(__surface_special); draw_clear_alpha(c_black, 0); + + var _zoom_whole = ceil(__get_zoom() - 1); + var _draw_offset_x = (_surf_width / 2) * _zoom_whole; + var _draw_offset_y = (_surf_height / 2) * _zoom_whole; + + //offsets drawing + var _prev_matrix = matrix_get(matrix_world); + var _offset_matrix = matrix_build(_draw_offset_x, _draw_offset_y, 0, 0, 0, 0, 1, 1, 1); + matrix_set(matrix_world, matrix_multiply(_prev_matrix, _offset_matrix)); _draw_func(); + //resets world matrix + matrix_set(matrix_world, _prev_matrix); + surface_reset_target(); - draw_surf(__surface_special, _x, _y, _scale_x, _scale_y, 0, 0, _surf_width, _surf_height); + var _x_frac = 0; + var _y_frac = 0; + + if(smooth_draw){ + _x_frac = x_frac + __constrain_frac_x; + _y_frac = y_frac + __constrain_frac_y; + } + + draw_surf(__surface_special, _x, _y, _scale_x, _scale_y, -_x_frac, -_y_frac, _surf_width, _surf_height); } /// @function draw_surf @@ -893,12 +1133,11 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf /// @param {Real} [_width=width] /// @param {Real} [_height=height] /// @param {Bool} [_ratio_compensate=true] - /// @ignore static draw_surf = function(_surface, _x, _y, _scale_x=1, _scale_y=1, _left=0, _top=0, _width=width, _height=height, _ratio_compensate=true){ if(!surface_exists(_surface)){ return; } - + //offsets position to match with display resoultion _x *= stanncam_get_res_scale_x(); _y *= stanncam_get_res_scale_y(); @@ -907,36 +1146,37 @@ function stanncam(_x=0, _y=0, _width=global.game_w, _height=global.game_h, _surf _x += stanncam_ratio_compensate_x(); _y += stanncam_ratio_compensate_y(); } - + var _display_scale_x = __obj_stanncam_manager.__display_scale_x; var _display_scale_y = __obj_stanncam_manager.__display_scale_y; - - if(smooth_draw){ //if smooth draw is off, the zoom amount becomes stepped to 0.02, and frac_x/y are 0 - _width *= zoom_amount; - _height *= zoom_amount; - _scale_x /= zoom_amount; - _scale_y /= zoom_amount; - - draw_surface_part_ext(_surface, x_frac + _left, y_frac + _top, _width, _height, _x, _y, _display_scale_x * _scale_x, _display_scale_y * _scale_y, -1, 1); - } else { - var _width_stepped = _width * zoom_amount; - var _height_stepped = _height * zoom_amount; - - _width_stepped -= _width_stepped mod 2; - _height_stepped -= _height_stepped mod 2; - - _scale_x = _width / _width_stepped; - _scale_y = _height / _height_stepped; - - draw_surface_part_ext(_surface, _left, _top, _width_stepped, _height_stepped, _x, _y, _display_scale_x * _scale_x, _display_scale_y * _scale_y, -1, 1); + + var _x_frac = 0; + var _y_frac = 0; + + if(smooth_draw){ + _x_frac = x_frac + __constrain_frac_x; + _y_frac = y_frac + __constrain_frac_y; } + + var _zoom = __get_zoom(); + _left += (_width * (1 - _zoom)) / 2; + _top += (_height * (1 - _zoom)) / 2; + + var _zoom_whole = ceil(_zoom - 1); + _left += (_width / 2) * _zoom_whole; + _top += (_height / 2) * _zoom_whole; + + _width *= _zoom; + _height *= _zoom; + _scale_x /= _zoom; + _scale_y /= _zoom; + + draw_surface_part_ext(_surface, _left + _x_frac, _top + _y_frac, _width, _height, _x, _y, _display_scale_x * _scale_x, _display_scale_y * _scale_y, -1, 1); } #endregion - /** - * @function toString - * @returns {String} - */ + /// @function toString + /// @returns {String} static toString = function(){ return ""; } diff --git a/scripts/stanncam_macros/stanncam_macros.gml b/scripts/stanncam_macros/stanncam_macros.gml index f62cdd3..00b140e 100644 --- a/scripts/stanncam_macros/stanncam_macros.gml +++ b/scripts/stanncam_macros/stanncam_macros.gml @@ -1,3 +1,3 @@ -#macro STANNCAM_VERSION "2.3.1" +#macro STANNCAM_VERSION "2.4.0" show_debug_message("Using STANNcam version " + STANNCAM_VERSION); diff --git a/scripts/stanncam_manager/stanncam_manager.gml b/scripts/stanncam_manager/stanncam_manager.gml index 86a7785..7633f72 100644 --- a/scripts/stanncam_manager/stanncam_manager.gml +++ b/scripts/stanncam_manager/stanncam_manager.gml @@ -34,6 +34,9 @@ function stanncam_init(_game_w, _game_h, _resolution_w=_game_w, _resolution_h=_g global.res_h = _resolution_h; global.window_mode = _window_mode; + __obj_stanncam_manager.__gui_res_w = global.gui_w; + __obj_stanncam_manager.__gui_res_h = global.gui_h; + var _len = array_length(view_camera); for (var i = 0; i < _len; ++i){ camera_destroy(view_camera[i]); @@ -41,13 +44,9 @@ function stanncam_init(_game_w, _game_h, _resolution_w=_game_w, _resolution_h=_g application_surface_draw_enable(false); - __obj_stanncam_manager.display_res_w = _resolution_w; - __obj_stanncam_manager.display_res_h = _resolution_h; + stanncam_set_resolution(_resolution_w, _resolution_h); stanncam_set_window_mode(_window_mode); - __obj_stanncam_manager.resize_width = window_get_width(); - __obj_stanncam_manager.resize_height = window_get_height(); - //check if stanncam manager has been deactivated and if so throw an error global.stanncam_time_source = time_source_create(time_source_global, 1, time_source_units_frames, function(){ if(!instance_exists(__obj_stanncam_manager)){ @@ -82,7 +81,6 @@ function stanncam_destroy(_application_surface_draw_enable=true){ function stanncam_set_resolution(_resolution_w, _resolution_h){ __obj_stanncam_manager.display_res_w = _resolution_w; __obj_stanncam_manager.display_res_h = _resolution_h; - window_set_size(_resolution_w, _resolution_h); __stanncam_update_resolution(); } @@ -91,14 +89,12 @@ function stanncam_set_resolution(_resolution_w, _resolution_h){ /// @description set game to be windowed/fullscreen/borderless function stanncam_set_window_mode(_window_mode){ global.window_mode = _window_mode; + __obj_stanncam_manager.__switching_window_mode = true; switch (_window_mode) { case STANNCAM_WINDOW_MODE.WINDOWED: window_set_fullscreen(false); window_set_showborder(true); - - window_set_size(__obj_stanncam_manager.display_res_w, __obj_stanncam_manager.display_res_h); __stanncam_center(20, 20); - break; case STANNCAM_WINDOW_MODE.FULLSCREEN: window_set_fullscreen(true); @@ -109,7 +105,8 @@ function stanncam_set_window_mode(_window_mode){ window_set_showborder(false); break; } - call_later(10, time_source_units_frames, function(){ + call_later(11, time_source_units_frames, function(){ + __obj_stanncam_manager.__switching_window_mode = false; __stanncam_update_resolution(); }); } @@ -140,19 +137,34 @@ function stanncam_set_keep_aspect_ratio(_on_off){ __stanncam_update_resolution(); } +/// @function stanncam_set_gui_keep_aspect_ratio +/// @description set gui keep_aspect_ratio +/// @param {Bool} _on_off +function stanncam_set_gui_keep_aspect_ratio(_on_off){ + __obj_stanncam_manager.gui_keep_aspect_ratio = _on_off; + __stanncam_update_resolution(); +} + /// @function stanncam_get_keep_aspect_ratio -/// @description get whether the display is keep_aspect_ratio +/// @description get whether the display has keep_aspect_ratio on /// @returns {Bool} function stanncam_get_keep_aspect_ratio(){ return __obj_stanncam_manager.keep_aspect_ratio; } +/// @function stanncam_get_gui_keep_aspect_ratio +/// @description get whether the display has gui_keep_aspect_ratio on +/// @returns {Bool} +function stanncam_get_gui_keep_aspect_ratio(){ + return __obj_stanncam_manager.gui_keep_aspect_ratio; +} + /// @function stanncam_ratio_compensate_x /// @description if keep_aspect_ratio is on it offsets the x value so the render is in the middle /// @returns {Real} function stanncam_ratio_compensate_x(){ if(stanncam_get_keep_aspect_ratio()){ - return (window_get_width() - (global.game_w * __obj_stanncam_manager.__display_scale_x)) * 0.5; + return (window_get_width() - (global.game_w * __obj_stanncam_manager.__display_scale_x)) / 2; } return 0; } @@ -162,7 +174,7 @@ function stanncam_ratio_compensate_x(){ /// @returns {Real} function stanncam_ratio_compensate_y(){ if(stanncam_get_keep_aspect_ratio()){ - return (window_get_height() - (global.game_h * __obj_stanncam_manager.__display_scale_y)) * 0.5; + return (window_get_height() - (global.game_h * __obj_stanncam_manager.__display_scale_y)) / 2; } return 0; } @@ -172,8 +184,8 @@ function stanncam_ratio_compensate_y(){ /// @param {Real} _gui_w /// @param {Real} _gui_h function stanncam_set_gui_resolution(_gui_w, _gui_h){ - global.gui_w = _gui_w; - global.gui_h = _gui_h; + __obj_stanncam_manager.__gui_res_w = _gui_w; + __obj_stanncam_manager.__gui_res_h = _gui_h; __stanncam_update_resolution(); } @@ -212,17 +224,6 @@ function __stanncam_update_resolution(){ switch (global.window_mode) { //fullscreen case STANNCAM_WINDOW_MODE.FULLSCREEN: - if(__obj_stanncam_manager.keep_aspect_ratio){ - var _ratio = global.game_w / global.game_h; - global.res_w = display_get_height() * _ratio; - global.res_h = display_get_height(); - } else { - global.res_w = display_get_width(); - global.res_h = display_get_height(); - } - window_set_size(display_get_width(), display_get_height()); - __stanncam_center(); - break; //borderless windowed case STANNCAM_WINDOW_MODE.BORDERLESS: if(__obj_stanncam_manager.keep_aspect_ratio){ @@ -253,30 +254,38 @@ function __stanncam_update_resolution(){ global.res_w = __obj_stanncam_manager.display_res_w; global.res_h = __obj_stanncam_manager.display_res_h; } + + window_set_size(__obj_stanncam_manager.display_res_w, __obj_stanncam_manager.display_res_h); break; } with(__obj_stanncam_manager){ + + __gui_x_scale = global.res_w / __gui_res_w; + __gui_y_scale = global.res_h / __gui_res_h; + + global.gui_w = __gui_res_w; + global.gui_h = __gui_res_h; + if(stanncam_get_keep_aspect_ratio()){ var _ratio = (global.res_w / global.res_h) / (global.game_w / global.game_h); if(_ratio > 1){ __display_scale_x = stanncam_get_res_scale_y(); __display_scale_y = __display_scale_x; - var _gui_x_scale = global.res_h / global.gui_h; - var _gui_y_scale = _gui_x_scale; } else { __display_scale_x = stanncam_get_res_scale_x(); __display_scale_y = __display_scale_x; - var _gui_x_scale = global.res_w / global.gui_w; - var _gui_y_scale = _gui_x_scale; } } else { __display_scale_x = stanncam_get_res_scale_x(); __display_scale_y = stanncam_get_res_scale_y(); - var _gui_x_scale = global.res_w / global.gui_w; - var _gui_y_scale = global.res_h / global.gui_h; + + if(stanncam_get_gui_keep_aspect_ratio()){ + global.gui_w *= (__gui_x_scale / __gui_y_scale); + __gui_x_scale = __gui_y_scale; + } } - display_set_gui_maximize(_gui_x_scale, _gui_y_scale, stanncam_ratio_compensate_x(), stanncam_ratio_compensate_y()); + display_set_gui_maximize(__gui_x_scale , __gui_y_scale, stanncam_ratio_compensate_x(), stanncam_ratio_compensate_y()); } } @@ -298,8 +307,8 @@ function __stanncam_center(_x=0, _y=0){ array_delete(_display_data, i * 4, 4); } - var _middle_x = _wx + (_ww * 0.5); - var _middle_y = _wy + (_wh * 0.5); + var _middle_x = _wx + (_ww / 2); + var _middle_y = _wy + (_wh / 2); var _outside_view = true; //checks which monitor the window is within diff --git a/shaders/sh_tv/sh_tv.fsh b/shaders/sh_tv/sh_tv.fsh new file mode 100644 index 0000000..40a96e5 --- /dev/null +++ b/shaders/sh_tv/sh_tv.fsh @@ -0,0 +1,16 @@ +// +// Simple passthrough fragment shader +// +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + float res = 56.; + + vec4 color = vec4(1.); + color.r = texture2D( gm_BaseTexture, v_vTexcoord + vec2(-1./res,0.)).r; + color.gb = texture2D( gm_BaseTexture, v_vTexcoord ).gb; + + gl_FragColor = color; +} diff --git a/shaders/sh_tv/sh_tv.vsh b/shaders/sh_tv/sh_tv.vsh new file mode 100644 index 0000000..3900c20 --- /dev/null +++ b/shaders/sh_tv/sh_tv.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_tv/sh_tv.yy b/shaders/sh_tv/sh_tv.yy new file mode 100644 index 0000000..41c6510 --- /dev/null +++ b/shaders/sh_tv/sh_tv.yy @@ -0,0 +1,12 @@ +{ + "$GMShader":"", + "%Name":"sh_tv", + "name":"sh_tv", + "parent":{ + "name":"shaders", + "path":"folders/shaders.yy", + }, + "resourceType":"GMShader", + "resourceVersion":"2.0", + "type":1, +} \ No newline at end of file diff --git a/sprites/spr_ball/spr_ball.yy b/sprites/spr_ball/spr_ball.yy index 46e845c..97300a8 100644 --- a/sprites/spr_ball/spr_ball.yy +++ b/sprites/spr_ball/spr_ball.yy @@ -63,6 +63,8 @@ "playbackSpeedType":1, "resourceType":"GMSequence", "resourceVersion":"2.0", + "seqHeight":64.0, + "seqWidth":64.0, "showBackdrop":true, "showBackdropImage":false, "timeUnits":1, diff --git a/sprites/spr_player2_idle/spr_player2_idle.yy b/sprites/spr_player2_idle/spr_player2_idle.yy index e4e56a8..a7aa38f 100644 --- a/sprites/spr_player2_idle/spr_player2_idle.yy +++ b/sprites/spr_player2_idle/spr_player2_idle.yy @@ -63,6 +63,8 @@ "playbackSpeedType":1, "resourceType":"GMSequence", "resourceVersion":"2.0", + "seqHeight":11.0, + "seqWidth":12.0, "showBackdrop":true, "showBackdropImage":false, "timeUnits":1, diff --git a/sprites/spr_player_idle/spr_player_idle.yy b/sprites/spr_player_idle/spr_player_idle.yy index 9dde055..66d4033 100644 --- a/sprites/spr_player_idle/spr_player_idle.yy +++ b/sprites/spr_player_idle/spr_player_idle.yy @@ -63,6 +63,8 @@ "playbackSpeedType":1, "resourceType":"GMSequence", "resourceVersion":"2.0", + "seqHeight":11.0, + "seqWidth":12.0, "showBackdrop":true, "showBackdropImage":false, "timeUnits":1, diff --git a/sprites/spr_stanncam_zone/spr_stanncam_zone.yy b/sprites/spr_stanncam_zone/spr_stanncam_zone.yy index ae80b78..e39a0b0 100644 --- a/sprites/spr_stanncam_zone/spr_stanncam_zone.yy +++ b/sprites/spr_stanncam_zone/spr_stanncam_zone.yy @@ -76,6 +76,8 @@ "playbackSpeedType":1, "resourceType":"GMSequence", "resourceVersion":"2.0", + "seqHeight":16.0, + "seqWidth":16.0, "showBackdrop":true, "showBackdropImage":false, "timeUnits":1, diff --git a/sprites/spr_stanncam_zone_1side/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png b/sprites/spr_stanncam_zone_1side/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png index fb83ac7..501b4a7 100644 Binary files a/sprites/spr_stanncam_zone_1side/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png and b/sprites/spr_stanncam_zone_1side/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png differ diff --git a/sprites/spr_stanncam_zone_1side/spr_stanncam_zone_1side.yy b/sprites/spr_stanncam_zone_1side/spr_stanncam_zone_1side.yy index c3d696d..fa0cc06 100644 --- a/sprites/spr_stanncam_zone_1side/spr_stanncam_zone_1side.yy +++ b/sprites/spr_stanncam_zone_1side/spr_stanncam_zone_1side.yy @@ -19,7 +19,7 @@ "height":16, "HTile":false, "layers":[ - {"$GMImageLayer":"","%Name":"76d49faf-df58-47ca-9f03-02785f5fcb2f","blendMode":0,"displayName":"Layer 1","isLocked":false,"name":"76d49faf-df58-47ca-9f03-02785f5fcb2f","opacity":20.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, + {"$GMImageLayer":"","%Name":"76d49faf-df58-47ca-9f03-02785f5fcb2f","blendMode":0,"displayName":"Layer 1","isLocked":false,"name":"76d49faf-df58-47ca-9f03-02785f5fcb2f","opacity":50.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, {"$GMImageLayer":"","%Name":"f6884eec-9d9a-4a19-b539-64ffb7c6c359","blendMode":0,"displayName":"default","isLocked":false,"name":"f6884eec-9d9a-4a19-b539-64ffb7c6c359","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, ], "name":"spr_stanncam_zone_1side", @@ -77,6 +77,8 @@ "playbackSpeedType":1, "resourceType":"GMSequence", "resourceVersion":"2.0", + "seqHeight":16.0, + "seqWidth":16.0, "showBackdrop":true, "showBackdropImage":false, "timeUnits":1, diff --git a/sprites/spr_stanncam_zone_2side/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png b/sprites/spr_stanncam_zone_2side/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png index 71fc271..e63415f 100644 Binary files a/sprites/spr_stanncam_zone_2side/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png and b/sprites/spr_stanncam_zone_2side/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png differ diff --git a/sprites/spr_stanncam_zone_2side/spr_stanncam_zone_2side.yy b/sprites/spr_stanncam_zone_2side/spr_stanncam_zone_2side.yy index 740ec00..0456952 100644 --- a/sprites/spr_stanncam_zone_2side/spr_stanncam_zone_2side.yy +++ b/sprites/spr_stanncam_zone_2side/spr_stanncam_zone_2side.yy @@ -19,7 +19,7 @@ "height":16, "HTile":false, "layers":[ - {"$GMImageLayer":"","%Name":"132f2d99-70f5-4cbb-b3aa-b40016946f9f","blendMode":0,"displayName":"Layer 1","isLocked":false,"name":"132f2d99-70f5-4cbb-b3aa-b40016946f9f","opacity":20.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, + {"$GMImageLayer":"","%Name":"132f2d99-70f5-4cbb-b3aa-b40016946f9f","blendMode":0,"displayName":"Layer 1","isLocked":false,"name":"132f2d99-70f5-4cbb-b3aa-b40016946f9f","opacity":50.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, {"$GMImageLayer":"","%Name":"f6884eec-9d9a-4a19-b539-64ffb7c6c359","blendMode":0,"displayName":"default","isLocked":false,"name":"f6884eec-9d9a-4a19-b539-64ffb7c6c359","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, ], "name":"spr_stanncam_zone_2side", @@ -77,6 +77,8 @@ "playbackSpeedType":1, "resourceType":"GMSequence", "resourceVersion":"2.0", + "seqHeight":16.0, + "seqWidth":16.0, "showBackdrop":true, "showBackdropImage":false, "timeUnits":1, diff --git a/sprites/spr_stanncam_zone_connector/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png b/sprites/spr_stanncam_zone_connector/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png new file mode 100644 index 0000000..5a7fea5 Binary files /dev/null and b/sprites/spr_stanncam_zone_connector/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png differ diff --git a/sprites/spr_stanncam_zone_connector/layers/f0c5359e-863a-4eb0-a39c-8d0c9ea08914/f6884eec-9d9a-4a19-b539-64ffb7c6c359.png b/sprites/spr_stanncam_zone_connector/layers/f0c5359e-863a-4eb0-a39c-8d0c9ea08914/f6884eec-9d9a-4a19-b539-64ffb7c6c359.png new file mode 100644 index 0000000..d86b6f3 Binary files /dev/null and b/sprites/spr_stanncam_zone_connector/layers/f0c5359e-863a-4eb0-a39c-8d0c9ea08914/f6884eec-9d9a-4a19-b539-64ffb7c6c359.png differ diff --git a/sprites/spr_stanncam_zone_connector/spr_stanncam_zone_connector.yy b/sprites/spr_stanncam_zone_connector/spr_stanncam_zone_connector.yy new file mode 100644 index 0000000..69439dd --- /dev/null +++ b/sprites/spr_stanncam_zone_connector/spr_stanncam_zone_connector.yy @@ -0,0 +1,103 @@ +{ + "$GMSprite":"v2", + "%Name":"spr_stanncam_zone_connector", + "bboxMode":0, + "bbox_bottom":15, + "bbox_left":0, + "bbox_right":15, + "bbox_top":0, + "collisionKind":1, + "collisionTolerance":0, + "DynamicTexturePage":false, + "edgeFiltering":false, + "For3D":false, + "frames":[ + {"$GMSpriteFrame":"v1","%Name":"f0c5359e-863a-4eb0-a39c-8d0c9ea08914","name":"f0c5359e-863a-4eb0-a39c-8d0c9ea08914","resourceType":"GMSpriteFrame","resourceVersion":"2.0",}, + ], + "gridX":0, + "gridY":0, + "height":16, + "HTile":false, + "layers":[ + {"$GMImageLayer":"","%Name":"f6884eec-9d9a-4a19-b539-64ffb7c6c359","blendMode":0,"displayName":"default","isLocked":false,"name":"f6884eec-9d9a-4a19-b539-64ffb7c6c359","opacity":50.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, + ], + "name":"spr_stanncam_zone_connector", + "nineSlice":{ + "$GMNineSliceData":"", + "bottom":3, + "enabled":true, + "guideColour":[4294902015,4294902015,4294902015,4294902015,], + "highlightColour":1728023040, + "highlightStyle":0, + "left":3, + "resourceType":"GMNineSliceData", + "resourceVersion":"2.0", + "right":3, + "tileMode":[0,0,0,0,0,], + "top":3, + }, + "origin":0, + "parent":{ + "name":"Sprites", + "path":"folders/STANNcam/Miscellaneous/Sprites.yy", + }, + "preMultiplyAlpha":false, + "resourceType":"GMSprite", + "resourceVersion":"2.0", + "sequence":{ + "$GMSequence":"v1", + "%Name":"spr_stanncam_zone_connector", + "autoRecord":true, + "backdropHeight":768, + "backdropImageOpacity":0.5, + "backdropImagePath":"", + "backdropWidth":1366, + "backdropXOffset":0.0, + "backdropYOffset":0.0, + "events":{ + "$KeyframeStore":"", + "Keyframes":[], + "resourceType":"KeyframeStore", + "resourceVersion":"2.0", + }, + "eventStubScript":null, + "eventToFunction":{}, + "length":1.0, + "lockOrigin":false, + "moments":{ + "$KeyframeStore":"", + "Keyframes":[], + "resourceType":"KeyframeStore", + "resourceVersion":"2.0", + }, + "name":"spr_stanncam_zone_connector", + "playback":1, + "playbackSpeed":1.0, + "playbackSpeedType":1, + "resourceType":"GMSequence", + "resourceVersion":"2.0", + "seqHeight":16.0, + "seqWidth":16.0, + "showBackdrop":true, + "showBackdropImage":false, + "timeUnits":1, + "tracks":[ + {"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore":"","Keyframes":[ + {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"f0c5359e-863a-4eb0-a39c-8d0c9ea08914","path":"sprites/spr_stanncam_zone_connector/spr_stanncam_zone_connector.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"5646b359-c75f-4280-b443-339f4019b230","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + ],"resourceType":"KeyframeStore","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, + ], + "visibleRange":null, + "volume":1.0, + "xorigin":0, + "yorigin":0, + }, + "swatchColours":null, + "swfPrecision":2.525, + "textureGroupId":{ + "name":"Default", + "path":"texturegroups/Default", + }, + "type":0, + "VTile":false, + "width":16, +} \ No newline at end of file diff --git a/sprites/spr_stanncam_zone_corner/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png b/sprites/spr_stanncam_zone_corner/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png index 2f3f4e1..8760f1b 100644 Binary files a/sprites/spr_stanncam_zone_corner/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png and b/sprites/spr_stanncam_zone_corner/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png differ diff --git a/sprites/spr_stanncam_zone_corner/spr_stanncam_zone_corner.yy b/sprites/spr_stanncam_zone_corner/spr_stanncam_zone_corner.yy index 97bff56..925f6af 100644 --- a/sprites/spr_stanncam_zone_corner/spr_stanncam_zone_corner.yy +++ b/sprites/spr_stanncam_zone_corner/spr_stanncam_zone_corner.yy @@ -19,7 +19,7 @@ "height":16, "HTile":false, "layers":[ - {"$GMImageLayer":"","%Name":"76d49faf-df58-47ca-9f03-02785f5fcb2f","blendMode":0,"displayName":"Layer 1","isLocked":false,"name":"76d49faf-df58-47ca-9f03-02785f5fcb2f","opacity":20.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, + {"$GMImageLayer":"","%Name":"76d49faf-df58-47ca-9f03-02785f5fcb2f","blendMode":0,"displayName":"Layer 1","isLocked":false,"name":"76d49faf-df58-47ca-9f03-02785f5fcb2f","opacity":50.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, {"$GMImageLayer":"","%Name":"f6884eec-9d9a-4a19-b539-64ffb7c6c359","blendMode":0,"displayName":"default","isLocked":false,"name":"f6884eec-9d9a-4a19-b539-64ffb7c6c359","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, ], "name":"spr_stanncam_zone_corner", @@ -77,6 +77,8 @@ "playbackSpeedType":1, "resourceType":"GMSequence", "resourceVersion":"2.0", + "seqHeight":16.0, + "seqWidth":16.0, "showBackdrop":true, "showBackdropImage":false, "timeUnits":1, diff --git a/sprites/spr_stanncam_zone_u/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png b/sprites/spr_stanncam_zone_u/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png index d82fd58..ac4a316 100644 Binary files a/sprites/spr_stanncam_zone_u/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png and b/sprites/spr_stanncam_zone_u/f0c5359e-863a-4eb0-a39c-8d0c9ea08914.png differ diff --git a/sprites/spr_stanncam_zone_u/spr_stanncam_zone_u.yy b/sprites/spr_stanncam_zone_u/spr_stanncam_zone_u.yy index b156ac5..ec34d14 100644 --- a/sprites/spr_stanncam_zone_u/spr_stanncam_zone_u.yy +++ b/sprites/spr_stanncam_zone_u/spr_stanncam_zone_u.yy @@ -19,7 +19,7 @@ "height":16, "HTile":false, "layers":[ - {"$GMImageLayer":"","%Name":"76d49faf-df58-47ca-9f03-02785f5fcb2f","blendMode":0,"displayName":"Layer 1","isLocked":false,"name":"76d49faf-df58-47ca-9f03-02785f5fcb2f","opacity":20.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, + {"$GMImageLayer":"","%Name":"76d49faf-df58-47ca-9f03-02785f5fcb2f","blendMode":0,"displayName":"Layer 1","isLocked":false,"name":"76d49faf-df58-47ca-9f03-02785f5fcb2f","opacity":50.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, {"$GMImageLayer":"","%Name":"f6884eec-9d9a-4a19-b539-64ffb7c6c359","blendMode":0,"displayName":"default","isLocked":false,"name":"f6884eec-9d9a-4a19-b539-64ffb7c6c359","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, ], "name":"spr_stanncam_zone_u", @@ -77,6 +77,8 @@ "playbackSpeedType":1, "resourceType":"GMSequence", "resourceVersion":"2.0", + "seqHeight":16.0, + "seqWidth":16.0, "showBackdrop":true, "showBackdropImage":false, "timeUnits":1, diff --git a/sprites/spr_tv/spr_tv.yy b/sprites/spr_tv/spr_tv.yy index 1339182..5b92581 100644 --- a/sprites/spr_tv/spr_tv.yy +++ b/sprites/spr_tv/spr_tv.yy @@ -63,6 +63,8 @@ "playbackSpeedType":1, "resourceType":"GMSequence", "resourceVersion":"2.0", + "seqHeight":64.0, + "seqWidth":64.0, "showBackdrop":true, "showBackdropImage":false, "timeUnits":1, diff --git a/stanncam.resource_order b/stanncam.resource_order index fb5fe56..52b703b 100644 --- a/stanncam.resource_order +++ b/stanncam.resource_order @@ -1,15 +1,18 @@ { "FolderOrderSettings":[ + {"name":"shaders","order":2,"path":"folders/shaders.yy",}, {"name":"Sprites","order":3,"path":"folders/STANNcam/Miscellaneous/Sprites.yy",}, {"name":"Zones","order":5,"path":"folders/STANNcam/Zones.yy",}, ], "ResourceOrderSettings":[ {"name":"obj_stanncam_zone_1side","order":1,"path":"objects/obj_stanncam_zone_1side/obj_stanncam_zone_1side.yy",}, {"name":"obj_stanncam_zone_2side","order":2,"path":"objects/obj_stanncam_zone_2side/obj_stanncam_zone_2side.yy",}, + {"name":"obj_stanncam_zone_blank","order":5,"path":"objects/obj_stanncam_zone_blank/obj_stanncam_zone_blank.yy",}, {"name":"obj_stanncam_zone_corner","order":3,"path":"objects/obj_stanncam_zone_corner/obj_stanncam_zone_corner.yy",}, {"name":"obj_stanncam_zone_u","order":4,"path":"objects/obj_stanncam_zone_u/obj_stanncam_zone_u.yy",}, {"name":"spr_stanncam_zone_1side","order":1,"path":"sprites/spr_stanncam_zone_1side/spr_stanncam_zone_1side.yy",}, {"name":"spr_stanncam_zone_2side","order":2,"path":"sprites/spr_stanncam_zone_2side/spr_stanncam_zone_2side.yy",}, + {"name":"spr_stanncam_zone_connector","order":5,"path":"sprites/spr_stanncam_zone_connector/spr_stanncam_zone_connector.yy",}, {"name":"spr_stanncam_zone_corner","order":3,"path":"sprites/spr_stanncam_zone_corner/spr_stanncam_zone_corner.yy",}, {"name":"spr_stanncam_zone_u","order":4,"path":"sprites/spr_stanncam_zone_u/spr_stanncam_zone_u.yy",}, ], diff --git a/stanncam.yyp b/stanncam.yyp index 1e91d69..623c79c 100644 --- a/stanncam.yyp +++ b/stanncam.yyp @@ -16,6 +16,7 @@ {"$GMFolder":"","%Name":"topdown","folderPath":"folders/Objects/topdown.yy","name":"topdown","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"Rooms","folderPath":"folders/Rooms.yy","name":"Rooms","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"Scripts","folderPath":"folders/Scripts.yy","name":"Scripts","resourceType":"GMFolder","resourceVersion":"2.0",}, + {"$GMFolder":"","%Name":"shaders","folderPath":"folders/shaders.yy","name":"shaders","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"Sprites","folderPath":"folders/Sprites.yy","name":"Sprites","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"BG","folderPath":"folders/Sprites/BG.yy","name":"BG","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"Layers","folderPath":"folders/Sprites/BG/Layers.yy","name":"Layers","resourceType":"GMFolder","resourceVersion":"2.0",}, @@ -34,7 +35,7 @@ "isEcma":false, "LibraryEmitters":[], "MetaData":{ - "IDEVersion":"2024.14.1.210", + "IDEVersion":"2024.14.3.217", }, "name":"stanncam", "resources":[ @@ -56,6 +57,7 @@ {"id":{"name":"obj_player2","path":"objects/obj_player2/obj_player2.yy",},}, {"id":{"name":"obj_stanncam_zone_1side","path":"objects/obj_stanncam_zone_1side/obj_stanncam_zone_1side.yy",},}, {"id":{"name":"obj_stanncam_zone_2side","path":"objects/obj_stanncam_zone_2side/obj_stanncam_zone_2side.yy",},}, + {"id":{"name":"obj_stanncam_zone_blank","path":"objects/obj_stanncam_zone_blank/obj_stanncam_zone_blank.yy",},}, {"id":{"name":"obj_stanncam_zone_corner","path":"objects/obj_stanncam_zone_corner/obj_stanncam_zone_corner.yy",},}, {"id":{"name":"obj_stanncam_zone_u","path":"objects/obj_stanncam_zone_u/obj_stanncam_zone_u.yy",},}, {"id":{"name":"obj_stanncam_zone","path":"objects/obj_stanncam_zone/obj_stanncam_zone.yy",},}, @@ -73,6 +75,7 @@ {"id":{"name":"stanncam_resolution_presets","path":"scripts/stanncam_resolution_presets/stanncam_resolution_presets.yy",},}, {"id":{"name":"stanncam_shake","path":"scripts/stanncam_shake/stanncam_shake.yy",},}, {"id":{"name":"stanncam","path":"scripts/stanncam/stanncam.yy",},}, + {"id":{"name":"sh_tv","path":"shaders/sh_tv/sh_tv.yy",},}, {"id":{"name":"spr_arrow_small","path":"sprites/spr_arrow_small/spr_arrow_small.yy",},}, {"id":{"name":"spr_arrow","path":"sprites/spr_arrow/spr_arrow.yy",},}, {"id":{"name":"spr_ball","path":"sprites/spr_ball/spr_ball.yy",},}, @@ -89,6 +92,7 @@ {"id":{"name":"spr_player2_moving","path":"sprites/spr_player2_moving/spr_player2_moving.yy",},}, {"id":{"name":"spr_stanncam_zone_1side","path":"sprites/spr_stanncam_zone_1side/spr_stanncam_zone_1side.yy",},}, {"id":{"name":"spr_stanncam_zone_2side","path":"sprites/spr_stanncam_zone_2side/spr_stanncam_zone_2side.yy",},}, + {"id":{"name":"spr_stanncam_zone_connector","path":"sprites/spr_stanncam_zone_connector/spr_stanncam_zone_connector.yy",},}, {"id":{"name":"spr_stanncam_zone_corner","path":"sprites/spr_stanncam_zone_corner/spr_stanncam_zone_corner.yy",},}, {"id":{"name":"spr_stanncam_zone_u","path":"sprites/spr_stanncam_zone_u/spr_stanncam_zone_u.yy",},}, {"id":{"name":"spr_stanncam_zone","path":"sprites/spr_stanncam_zone/spr_stanncam_zone.yy",},}, @@ -108,9 +112,9 @@ "resourceVersion":"2.0", "RoomOrderNodes":[ {"roomId":{"name":"rm_init","path":"rooms/rm_init/rm_init.yy",},}, + {"roomId":{"name":"rm_sidescroller","path":"rooms/rm_sidescroller/rm_sidescroller.yy",},}, {"roomId":{"name":"rm_pixel_grid","path":"rooms/rm_pixel_grid/rm_pixel_grid.yy",},}, {"roomId":{"name":"rm_test","path":"rooms/rm_test/rm_test.yy",},}, - {"roomId":{"name":"rm_sidescroller","path":"rooms/rm_sidescroller/rm_sidescroller.yy",},}, ], "templateType":null, "TextureGroups":[