1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 17:42:29 +01:00

add peep updating

This commit is contained in:
IntelOrca
2014-04-03 00:22:33 +01:00
parent ffcbb5b26d
commit 0a12f15a25
8 changed files with 232 additions and 1 deletions

View File

@@ -21,7 +21,9 @@
<ClInclude Include="..\src\gfx.h" /> <ClInclude Include="..\src\gfx.h" />
<ClInclude Include="..\src\intro.h" /> <ClInclude Include="..\src\intro.h" />
<ClInclude Include="..\src\osinterface.h" /> <ClInclude Include="..\src\osinterface.h" />
<ClInclude Include="..\src\peep.h" />
<ClInclude Include="..\src\rct2.h" /> <ClInclude Include="..\src\rct2.h" />
<ClInclude Include="..\src\sprite.h" />
<ClInclude Include="..\src\strings.h" /> <ClInclude Include="..\src\strings.h" />
<ClInclude Include="..\src\title.h" /> <ClInclude Include="..\src\title.h" />
<ClInclude Include="..\src\window.h" /> <ClInclude Include="..\src\window.h" />
@@ -33,6 +35,7 @@
<ClCompile Include="..\src\gfx.c" /> <ClCompile Include="..\src\gfx.c" />
<ClCompile Include="..\src\intro.c" /> <ClCompile Include="..\src\intro.c" />
<ClCompile Include="..\src\osinterface.c" /> <ClCompile Include="..\src\osinterface.c" />
<ClCompile Include="..\src\peep.c" />
<ClCompile Include="..\src\rct2.c" /> <ClCompile Include="..\src\rct2.c" />
<ClCompile Include="..\src\title.c" /> <ClCompile Include="..\src\title.c" />
<ClCompile Include="..\src\window.c" /> <ClCompile Include="..\src\window.c" />

View File

@@ -48,6 +48,12 @@
<ClInclude Include="..\src\strings.h"> <ClInclude Include="..\src\strings.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\src\peep.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\sprite.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\src\game.c"> <ClCompile Include="..\src\game.c">
@@ -74,6 +80,9 @@
<ClCompile Include="..\src\gfx.c"> <ClCompile Include="..\src\gfx.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\src\peep.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\openrct2.exe"> <None Include="..\openrct2.exe">

View File

@@ -69,6 +69,13 @@
#define RCT2_ADDRESS_PLACE_OBJECT_MODIFIER 0x009DEA70 #define RCT2_ADDRESS_PLACE_OBJECT_MODIFIER 0x009DEA70
#define RCT2_ADDRESS_ON_TUTORIAL 0x009DEA71 #define RCT2_ADDRESS_ON_TUTORIAL 0x009DEA71
#define RCT2_ADDRESS_SPRITE_LIST 0x010E63BC
#define RCT2_ADDRESS_SPRITES_NEXT_INDEX 0x013573BC
#define RCT2_ADDRESS_SPRITES_START_VEHICLE 0x013573BE
#define RCT2_ADDRESS_SPRITES_START_PEEP 0x013573C0
#define RCT2_ADDRESS_SPRITES_START_TEXTFX 0x013573C2
#define RCT2_ADDRESS_SPRITES_START_LITTER 0x013573C4
#define RCT2_ADDRESS_WINDOW_LIST 0x01420078 #define RCT2_ADDRESS_WINDOW_LIST 0x01420078
#define RCT2_ADDRESS_NEW_WINDOW_PTR 0x014234B8 #define RCT2_ADDRESS_NEW_WINDOW_PTR 0x014234B8
#define RCT2_ADDRESS_VIEWPORT_LIST 0x014234BC #define RCT2_ADDRESS_VIEWPORT_LIST 0x014234BC

View File

@@ -21,6 +21,7 @@
#include "addresses.h" #include "addresses.h"
#include "rct2.h" #include "rct2.h"
#include "game.h" #include "game.h"
#include "peep.h"
#include "window.h" #include "window.h"
void game_update() void game_update()
@@ -112,7 +113,7 @@ void game_logic_update()
RCT2_CALLPROC_EBPSAFE(0x006646E1); RCT2_CALLPROC_EBPSAFE(0x006646E1);
RCT2_CALLPROC_EBPSAFE(0x006A876D); RCT2_CALLPROC_EBPSAFE(0x006A876D);
RCT2_CALLPROC_EBPSAFE(0x0068F0A9); // peep_update_all() peep_update_all();
// update ride // update ride
RCT2_CALLPROC_EBPSAFE(0x006D4204); RCT2_CALLPROC_EBPSAFE(0x006D4204);

55
src/peep.c Normal file
View File

@@ -0,0 +1,55 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include "addresses.h"
#include "peep.h"
#include "rct2.h"
#include "sprite.h"
/**
*
* rct2: 0x0068F0A9
*/
void peep_update_all()
{
int i;
uint16 sprite_index;
rct_peep* peep;
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)
return;
sprite_index = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16);
i = 0;
while (sprite_index != 0xFFFF) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_index].peep);
sprite_index = peep->next;
if ((i & 0x7F) != (RCT2_GLOBAL(0x013628F4, uint32) & 0x7F)) {
RCT2_CALLPROC_X(0x0068FC1E, 0, 0, 0, 0, peep, 0, 0);
} else {
RCT2_CALLPROC_X(0x0068F41A, 0, 0, 0, i, peep, 0, 0);
if (peep->var_08 == 4)
RCT2_CALLPROC_X(0x0068FC1E, 0, 0, 0, 0, peep, 0, 0);
}
i++;
}
}

89
src/peep.h Normal file
View File

@@ -0,0 +1,89 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#ifndef _PEEP_H_
#define _PEEP_H_
#include "rct2.h"
#define PEEP_MAX_THOUGHTS 5
enum PEEP_TYPE {
PEEP_TYPE_GUEST,
PEEP_TYPE_STAFF
};
enum {
PEEP_FLAGS_TRACKING = 8
};
enum PEEP_THOUGHT_TYPE {
PEEP_THOUGHT_TYPE_NONE = 255
};
typedef struct {
uint8 type;
uint8 item;
uint8 pad_3;
uint8 pad_4;
} rct_peep_thought;
typedef struct {
uint8 sprite_identifier; // 0x00
uint8 pad_01;
uint16 pad_02;
uint16 next; // 0x04
uint16 pad_06;
uint8 var_08;
uint8 pad_09;
sint16 var_0A;
uint16 var_0C;
uint8 var_0E[0x14];
uint16 name_string_idx; // 0x22
uint16 next_x; // 0x24
uint16 next_y; // 0x26
uint16 next_z; // 0x28
uint8 var_2A;
uint8 state; // 0x2B
uint8 pad_2C;
uint8 sprite_type; // 0x2D
uint8 type; // 0x2E
uint8 var_2F;
uint8 var_30;
uint8 var_31;
uint8 pad_32[0x08];
uint8 happiness; // 0x3A
uint8 pad_3B[0x61];
uint32 id; // 0x9C
uint8 pad_A0[0x10];
rct_peep_thought thoughts[PEEP_MAX_THOUGHTS]; // 0xB0
uint16 pad_C4;
uint8 var_C6;
uint8 pad_C7;
uint32 var_C8;
uint8 pad_CC[0x2A];
uint8 balloon_colour; // 0xF6
uint8 umbrella_colour; // 0xF7
uint8 hat_colour; // 0xF8
} rct_peep;
void peep_update_all();
#endif

View File

@@ -32,4 +32,12 @@ typedef unsigned long long uint64;
void rct2_finish(); void rct2_finish();
enum {
SCREEN_FLAGS_PLAYING = 0,
SCREEN_FLAGS_TITLE_DEMO = 1,
SCREEN_FLAGS_SCENARIO_EDITOR = 2,
SCREEN_FLAGS_TRACK_DESIGNER = 4,
SCREEN_FLAGS_TRACK_MANAGER = 8,
};
#endif #endif

59
src/sprite.h Normal file
View File

@@ -0,0 +1,59 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#ifndef _SPRITE_H_
#define _SPRITE_H_
#include "rct2.h"
#define SPRITE_INDEX_NULL 0xFFFF
#include "peep.h"
typedef struct {
uint8 sprite_identifier; // 0x00
uint8 pad_01;
uint16 pad_02;
uint16 next; // 0x04
uint8 pad_06[0x08];
sint16 var_0E;
sint16 var_10;
sint16 var_12;
} rct_unk_sprite;
typedef struct {
uint32 pad_00;
uint16 next; // 0x04
uint8 pad_06[0x1E];
sint32 var_24;
} rct_litter;
/**
* Sprite structure.
* size: 0x0100
*/
typedef union {
uint8 pad_00[0x100];
rct_unk_sprite unknown;
rct_peep peep;
rct_litter litter;
} rct_sprite;
#endif