From 472e9b764d74748a6b2e86b40fa59c459f126181 Mon Sep 17 00:00:00 2001 From: Chinsky Date: Tue, 19 Aug 2014 21:19:23 +0400 Subject: [PATCH] Added ability to pick photo size. --- code/modules/paperwork/photography.dm | 42 +++++++++++++++++---------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index fe2326c21b0..5fff5a7f311 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -30,6 +30,7 @@ var/icon/img //Big photo image var/scribble //Scribble on the back. var/icon/tiny + var/photo_size = 3 /obj/item/weapon/photo/attack_self(mob/user as mob) examine() @@ -54,9 +55,9 @@ user << browse_rsc(img, "tmp_photo.png") user << browse("[name]" \ + "" \ - + "" \ + + "" \ + "[scribble ? "
Written on the back:
[scribble]" : ""]"\ - + "", "window=book;size=192x[scribble ? 400 : 192]") + + "", "window=book;size=[64*photo_size]x[scribble ? 400 : 64*photo_size]") onclose(user, "[name]") return @@ -125,7 +126,15 @@ var/on = 1 var/icon_on = "camera" var/icon_off = "camera_off" + var/size = 3 +/obj/item/device/camera/verb/change_size() + set name = "Set Photo Focus" + set category = "Object" + var/nsize = input("Photo Size","Pick a size of resulting photo.") as null|anything in list(1,3,5,7) + if(nsize) + size = nsize + usr << "Camera will now take [size]x[size] photos." /obj/item/device/camera/attack(mob/living/carbon/human/M as mob, mob/user as mob) return @@ -157,6 +166,7 @@ //Bigger icon base to capture those icons that were shifted to the next tile //i.e. pretty much all wall-mounted machinery var/icon/res = icon('icons/effects/96x96.dmi', "") + res.Scale(size*32, size*32) // Initialize the photograph to black. res.Blend("#000", ICON_OVERLAY) @@ -171,7 +181,7 @@ // Sort the atoms into their layers var/list/sorted = sort_atoms_by_layer(atoms) - + var/center_offset = (size-1)/2 * 32 + 1 for(var/i; i <= sorted.len; i++) var/atom/A = sorted[i] if(A) @@ -184,19 +194,19 @@ // If they are, apply that effect to their picture. img.BecomeLying() // Calculate where we are relative to the center of the photo - var/xoff = (A.x - center.x) * 32 - var/yoff = (A.y - center.y) * 32 + var/xoff = (A.x - center.x) * 32 + center_offset + var/yoff = (A.y - center.y) * 32 + center_offset if (istype(A,/atom/movable)) xoff+=A:step_x yoff+=A:step_y - res.Blend(img, blendMode2iconMode(A.blend_mode), 33 + A.pixel_x + xoff, 33 + A.pixel_y + yoff) + res.Blend(img, blendMode2iconMode(A.blend_mode), A.pixel_x + xoff, A.pixel_y + yoff) // Lastly, render any contained effects on top. for(var/turf/the_turf in turfs) // Calculate where we are relative to the center of the photo - var/xoff = (the_turf.x - center.x) * 32 - var/yoff = (the_turf.y - center.y) * 32 - res.Blend(getFlatIcon(the_turf.loc), blendMode2iconMode(the_turf.blend_mode),33 + xoff,33 + yoff) + var/xoff = (the_turf.x - center.x) * 32 + center_offset + var/yoff = (the_turf.y - center.y) * 32 + center_offset + res.Blend(getFlatIcon(the_turf.loc), blendMode2iconMode(the_turf.blend_mode),xoff,yoff) return res @@ -246,22 +256,20 @@ return can_see /obj/item/device/camera/proc/captureimage(atom/target, mob/user, flag) - var/x_c = target.x - 1 - var/y_c = target.y + 1 + var/x_c = target.x - (size-1)/2 + var/y_c = target.y + (size-1)/2 var/z_c = target.z - - var/list/turfs = list() var/mobs = "" - for(var/i = 1; i <= 3; i++) - for(var/j = 1; j <= 3; j++) + for(var/i = 1; i <= size; i++) + for(var/j = 1; j <= size; j++) var/turf/T = locate(x_c, y_c, z_c) if(can_capture_turf(T, user)) turfs.Add(T) mobs += get_mobs(T) x_c++ y_c-- - x_c = x_c - 3 + x_c = x_c - size var/datum/picture/P = createpicture(target, user, turfs, mobs, flag) printpicture(user, P) @@ -286,6 +294,7 @@ P.fields["desc"] = mobs P.fields["pixel_x"] = rand(-10, 10) P.fields["pixel_y"] = rand(-10, 10) + P.fields["size"] = size return P @@ -303,3 +312,4 @@ desc = P.fields["desc"] pixel_x = P.fields["pixel_x"] pixel_y = P.fields["pixel_y"] + photo_size = P.fields["size"] \ No newline at end of file