Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions manual/content/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ <h3 id="1.0.0-making">Content-making changes</h3>
<li><span class="cl-a">Added</span> a <code>global</code> block to <a href="script.html">scripts</a>. Events in this block will have their actions run regardless of the current state.</li>
<li><span class="cl-a">Added</span> an argument to the <code>play_sound</code> <a href="script.html">object script action</a> for the sound ID.</li>
<li><span class="cl-a">Added</span> an argument to the <code>set_animation</code> <a href="script.html">script action</a> that makes the animation speed depend on the object's speed.</li>
<li><span class="cl-a">Added</span> the <code>camera_min_x</code>, <code>camera_max_x</code>, <code>camera_min_y</code>, and <code>camera_max_y</code> data types to the <code>get_area_info</code> action. (Thanks Helodity)</li>
</ul>
</li>
<li>
Expand Down
4 changes: 4 additions & 0 deletions manual/content/events_and_actions.html
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,10 @@ <h3 id="actions-obtain-info">Obtaining information</h3>
<dd>
Sets the variable &lt;destination_variable_name&gt; to some special information about the area. The possible data are:
<ul>
<li><code><b>camera_max_x</b></code>: The max x bound of player 1's camera.</li>
<li><code><b>camera_mix_x</b></code>: The min x bound of player 1's camera.</li>
<li><code><b>camera_max_y</b></code>: The max y bound of player 1's camera.</li>
<li><code><b>camera_mix_y</b></code>: The min y bound of player 1's camera.</li>
<li><code><b>day_minutes</b></code>: What time of the in-game day it is, in minutes.</li>
<li><code><b>field_pikmin</b></code>: How many Pikmin are currently on the field.</li>
</ul>
Expand Down
40 changes: 38 additions & 2 deletions source/source/content/other/mob_script_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,15 @@ bool MobActionLoaders::focus(MobActionCall& call) {
* @return Whether it succeeded.
*/
bool MobActionLoaders::getAreaInfo(MobActionCall& call) {
if(call.args[1] == "day_minutes") {
if(call.args[1] == "camera_max_x") {
call.args[1] = i2s(MOB_ACTION_GET_AREA_INFO_TYPE_CAMERA_MAX_X);
} else if(call.args[1] == "camera_min_x") {
call.args[1] = i2s(MOB_ACTION_GET_AREA_INFO_TYPE_CAMERA_MIN_X);
} else if(call.args[1] == "camera_max_y") {
call.args[1] = i2s(MOB_ACTION_GET_AREA_INFO_TYPE_CAMERA_MAX_Y);
} else if(call.args[1] == "camera_min_y") {
call.args[1] = i2s(MOB_ACTION_GET_AREA_INFO_TYPE_CAMERA_MIN_Y);
} else if(call.args[1] == "day_minutes") {
call.args[1] = i2s(MOB_ACTION_GET_AREA_INFO_TYPE_DAY_MINUTES);
} else if(call.args[1] == "field_pikmin") {
call.args[1] = i2s(MOB_ACTION_GET_AREA_INFO_TYPE_FIELD_PIKMIN);
Expand Down Expand Up @@ -1028,7 +1036,35 @@ void MobActionRunners::getAreaInfo(MobActionRunData& data) {
(MOB_ACTION_GET_AREA_INFO_TYPE) s2i(data.args[1]);

switch (t) {
case MOB_ACTION_GET_AREA_INFO_TYPE_DAY_MINUTES: {
case MOB_ACTION_GET_AREA_INFO_TYPE_CAMERA_MAX_X: {
*var = i2s(
game.states.gameplay->players[0].view.box[1].x
- game.states.gameplay->players[0].view.boxMargin.x
);
break;

} case MOB_ACTION_GET_AREA_INFO_TYPE_CAMERA_MIN_X: {
*var = i2s(
game.states.gameplay->players[0].view.box[0].x
+ game.states.gameplay->players[0].view.boxMargin.x
);
break;

} case MOB_ACTION_GET_AREA_INFO_TYPE_CAMERA_MAX_Y: {
*var = i2s(
game.states.gameplay->players[0].view.box[1].y
- game.states.gameplay->players[0].view.boxMargin.y
);
break;

} case MOB_ACTION_GET_AREA_INFO_TYPE_CAMERA_MIN_Y: {
*var = i2s(
game.states.gameplay->players[0].view.box[0].y
+ game.states.gameplay->players[0].view.boxMargin.y
);
break;

} case MOB_ACTION_GET_AREA_INFO_TYPE_DAY_MINUTES: {
*var = i2s(game.states.gameplay->dayMinutes);
break;

Expand Down
12 changes: 12 additions & 0 deletions source/source/content/other/mob_script_action.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,18 @@ enum MOB_ACTION_MOB_TARGET_TYPE {
//Get area info action info types.
enum MOB_ACTION_GET_AREA_INFO_TYPE {

//Get current max x bound on the camera.
MOB_ACTION_GET_AREA_INFO_TYPE_CAMERA_MAX_X,

//Get current min x bound on the camera.
MOB_ACTION_GET_AREA_INFO_TYPE_CAMERA_MIN_X,

//Get current max y bound on the camera.
MOB_ACTION_GET_AREA_INFO_TYPE_CAMERA_MAX_Y,

//Get current min y bound on the camera.
MOB_ACTION_GET_AREA_INFO_TYPE_CAMERA_MIN_Y,

//Get time of day, in minutes.
MOB_ACTION_GET_AREA_INFO_TYPE_DAY_MINUTES,

Expand Down