2020-09-04 13:48:05 -04:00
|
|
|
#include "entry.h"
|
|
|
|
|
|
|
|
#include <fstream>
|
2019-11-03 14:36:27 -05:00
|
|
|
#include <ultra64.h>
|
|
|
|
|
2020-09-04 13:48:05 -04:00
|
|
|
#include "common/scripts/dynamic_level_script_builder.hpp"
|
2019-11-03 14:36:27 -05:00
|
|
|
#include "levels/intro/header.h"
|
2020-09-04 13:48:05 -04:00
|
|
|
#include "util/unused.hpp"
|
2019-11-03 14:36:27 -05:00
|
|
|
|
2020-09-04 13:48:05 -04:00
|
|
|
#include "level_commands.h"
|
2019-11-03 14:36:27 -05:00
|
|
|
#include "make_const_nonconst.h"
|
2020-09-04 13:48:05 -04:00
|
|
|
#include "segment_symbols.h"
|
|
|
|
#include "sm64.h"
|
2019-11-03 14:36:27 -05:00
|
|
|
|
2020-09-04 13:48:05 -04:00
|
|
|
void callback() {
|
|
|
|
std::ofstream myfile;
|
|
|
|
myfile.open("file.txt");
|
|
|
|
myfile << "This is a line.\n";
|
|
|
|
|
|
|
|
myfile.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
class Printer{
|
|
|
|
public:
|
|
|
|
void print() {
|
|
|
|
auto text = "This is a line from a printer.\n";
|
|
|
|
std::ofstream myfile;
|
|
|
|
myfile.open("file.txt");
|
|
|
|
myfile << text;
|
|
|
|
|
|
|
|
myfile.close();
|
|
|
|
}
|
2019-11-03 14:36:27 -05:00
|
|
|
};
|
2020-09-04 13:48:05 -04:00
|
|
|
|
|
|
|
const LevelScript* get_level_script_entry(int& out_count = unused_int) {
|
|
|
|
auto lambda = [] {
|
|
|
|
auto text = "This is a line.\n";
|
|
|
|
std::ofstream myfile;
|
|
|
|
myfile.open("file.txt");
|
|
|
|
myfile << text;
|
|
|
|
|
|
|
|
myfile.close();
|
|
|
|
};
|
|
|
|
|
|
|
|
auto call_printer = [](Printer * printer) {
|
|
|
|
printer->print();
|
|
|
|
};
|
|
|
|
|
|
|
|
return DynamicLevelScriptBuilder()
|
|
|
|
.add_call<Printer>(call_printer, new Printer())
|
|
|
|
.add_scripts({
|
|
|
|
INIT_LEVEL(),
|
|
|
|
SLEEP(/*frames*/ 2),
|
|
|
|
BLACKOUT(/*active*/ FALSE),
|
|
|
|
SET_REG(/*value*/ 0),
|
|
|
|
EXECUTE(
|
|
|
|
/*seg*/ 0x14, /*script*/
|
|
|
|
_introSegmentRomStart, /*scriptEnd*/
|
|
|
|
_introSegmentRomEnd,
|
|
|
|
/*entry*/ level_intro_entry_1),
|
|
|
|
})
|
|
|
|
.add_jump_to_top_of_this_builder()
|
|
|
|
.get_entry_pointer(out_count);
|
|
|
|
}
|