]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add "create_scrshot_ent" command which saves info_autoscreenshot entities
authorSamual Lenks <samual@xonotic.org>
Tue, 28 Aug 2012 17:49:10 +0000 (13:49 -0400)
committerSamual Lenks <samual@xonotic.org>
Tue, 28 Aug 2012 17:49:10 +0000 (13:49 -0400)
easily

commands.cfg
qcsrc/client/command/cl_cmd.qc

index 35d9e39b91947d5d17210434c6c047a6f8512131..881c0359aca39c8a9626f43d67b1b1b7bcae182f 100644 (file)
@@ -109,6 +109,7 @@ alias menu_loadmap_prepare "disconnect; wait; g_campaign 0; menu_cmd rpn /_menu_
 // ==========================================================
 // commented out commands are really only intended for internal use
 alias blurtest             "qc_cmd_cl     blurtest             ${* ?}" // Feature for testing blur postprocessing
+alias create_scrshot_ent   "qc_cmd_cl     create_scrshot_ent   ${* ?}" // Create an entity at this location for automatic screenshots
 alias debugmodel           "qc_cmd_cl     debugmodel           ${* ?}" // Spawn a debug model manually
 //alias handlevote         "qc_cmd_cl     handlevote           ${* ?}" // System to handle selecting a vote or option
 alias hud                  "qc_cmd_cl     hud                  ${* ?}" // Commands regarding/controlling the HUD system
index 638b7f996ce042c578b8dabaa6ff370a0ae4afeb..7ec847e0db98c10632ef6f4cdb8b49750c29fd14 100644 (file)
@@ -57,6 +57,45 @@ void LocalCommand_blurtest(float request)
        #endif
 }
 
+void LocalCommand_create_scrshot_ent(float request)
+{
+       switch(request)
+       {
+               case CMD_REQUEST_COMMAND:
+               {
+                       float fh;
+                       string filename = strcat(MapInfo_Map_bspname, "_scrshot_ent.txt");
+                       fh = fopen(filename, FILE_WRITE);
+                       
+                       if(fh >= 0)
+                       {
+                               fputs(fh, "{\n");
+                               fputs(fh, strcat("\"classname\" \"info_autoscreenshot\"\n"));
+                               fputs(fh, strcat("\"origin\" \"", vtos(view_origin), "\"\n"));
+                               fputs(fh, strcat("\"angles\" \"", vtos(view_angles), "\"\n"));
+                               fputs(fh, "}\n");
+                               
+                               print("Completed screenshot entity dump in ^2data/data/", MapInfo_Map_bspname, "_scrshot_ent.txt^7.\n");
+                               
+                               fclose(fh);
+                       }
+                       else
+                       {
+                               print("^1Error: ^7Could not dump to file!\n");
+                       }
+                       return;
+               }
+                       
+               default:
+               case CMD_REQUEST_USAGE:
+               {
+                       print("\nUsage:^3 cl_cmd create_scrshot_ent\n");
+                       print("  No arguments required.\n");
+                       return;
+               }
+       }
+}
+
 void LocalCommand_debugmodel(float request, float argc)
 {
        switch(request)
@@ -310,6 +349,7 @@ void LocalCommand_(float request)
 // but for 0.5 compat, we need vyes and vno here as they were replaced... REMOVE THEM AFTER 0.6 RELEASE!!!!
 #define CLIENT_COMMANDS(request,arguments) \
        CLIENT_COMMAND("blurtest", LocalCommand_blurtest(request), "Feature for testing blur postprocessing") \
+       CLIENT_COMMAND("create_scrshot_ent", LocalCommand_create_scrshot_ent(request), "Create an entity at this location for automatic screenshots") \
        CLIENT_COMMAND("debugmodel", LocalCommand_debugmodel(request, arguments), "Spawn a debug model manually") \
        CLIENT_COMMAND("handlevote", LocalCommand_handlevote(request, arguments), "System to handle selecting a vote or option") \
        CLIENT_COMMAND("hud", LocalCommand_hud(request, arguments), "Commands regarding/controlling the HUD system") \