View Issue Details

IDProjectCategoryView StatusLast Update
0003094FSSCPscriptingpublic2014-09-17 08:24
ReporterParias Assigned Tom_m  
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Product Version3.7.2 RC1 
Target Version3.7.2 
Summary0003094: Request for new scripting function: ts.playCutscene() (.patch included)
DescriptionAnother request as part of a co-op enhancement project I'm working on. This just allows you to force a cutscene to play using the scripting system (all it does is call the internal movie_play() function) - simply pass it the desired filename. Considered "experimental" for now and best used as you're entering a state such as GS_STATE_BRIEFING as otherwise the back-end stuff might not line up correctly (i.e. music and stuff will continue playing while the cutscene is running if you call it mid-mission, I assume because the appropriate state changes aren't covered here).

My own testing shows this works perfect for my needs otherwise - the underlying intent is to be able to trigger cutscenes that play for both host and client in a multiplayer session. However, I've never created a new scripting function before (I barely know how to code) so feedback on any needed changes would be appreciated - this is a pretty simple function though.

A .patch of how I have this working now is attached.
TagsNo tags attached.

Activities

Parias

2014-08-14 16:03

developer  

lua.cpp-playCutscene.patch (1,226 bytes)   
Index: code/parse/lua.cpp
===================================================================
--- code/parse/lua.cpp	(revision 10927)
+++ code/parse/lua.cpp	(working copy)
@@ -3,6 +3,7 @@
 #include "asteroid/asteroid.h"
 #include "camera/camera.h"
 #include "cfile/cfilesystem.h"
+#include "cutscene/movie.h"
 #include "debris/debris.h"
 #include "cmdline/cmdline.h"
 #include "freespace2/freespace.h"
@@ -15567,7 +15568,19 @@
 	return ADE_RETURN_TRUE;
 }
 
+ADE_FUNC(playCutscene, l_Testing, NULL, "Forces a cutscene by the specified filename string to play. Should really only be used in a non-gameplay state (i.e. start of GS_STATE_BRIEFING) otherwise odd side effects may occur. Highly Experimental.", "string", NULL)
+{
+	//This whole thing is a quick hack and can probably be done way better, but is currently functioning fine for my purposes.
+	char *filename;
 
+	if (!ade_get_args(L, "s", &filename))
+		return ADE_RETURN_FALSE;
+
+	movie_play(filename);
+
+	return ADE_RETURN_TRUE;
+}
+
 // *************************Helper functions*********************
 //WMC - This should be used anywhere that an 'object' is set, so
 //that scripters can get access to as much relevant data to that
lua.cpp-playCutscene.patch (1,226 bytes)   

Goober5000

2014-09-17 01:52

administrator   ~0016282

Assigning to m!m to review.

m_m

2014-09-17 08:21

developer   ~0016283

Patch looks good to me.

m_m

2014-09-17 08:24

developer   ~0016284

Fix committed to trunk@11076.

Related Changesets

fs2open: trunk r11076

2014-09-17 04:59

m_m


Ported: N/A

Details Diff
From Parias: Fix for Mantis 3094: Request for new scripting function: ts.playCutscene() Affected Issues
0003094
mod - /trunk/fs2_open/code/parse/lua.cpp Diff File

Issue History

Date Modified Username Field Change
2014-08-14 16:03 Parias New Issue
2014-08-14 16:03 Parias File Added: lua.cpp-playCutscene.patch
2014-08-15 10:36 Echelon9 Status new => code review
2014-09-17 01:52 Goober5000 Note Added: 0016282
2014-09-17 01:52 Goober5000 Assigned To => m_m
2014-09-17 01:55 Goober5000 Target Version => 3.7.2
2014-09-17 08:21 m_m Note Added: 0016283
2014-09-17 08:24 m_m Changeset attached => fs2open trunk r11076
2014-09-17 08:24 m_m Note Added: 0016284
2014-09-17 08:24 m_m Status code review => resolved
2014-09-17 08:24 m_m Resolution open => fixed