1 | ; ------ priprava pro dalsi objekt |
2 | PosVlak6:add si,3 ; adresa dalsiho objektu |
3 | mov dx,cx ; stará pozice predesleho objektu |
4 | mov al,0 |
5 | cmp ds:[si],al ; je jiz konec vlaku? |
6 | je PosVlak7 |
7 | jmp PosVlak2 ; neni konec - dalsi vagon |
8 | |
9 | ; ------ vymazani posledniho vagonu |
10 | PosVlak7:cmp dl,-1 |
11 | je PosVlak8 |
12 | call DispObr ; vymazani posledniho vagonu |
13 | mov al,20 ; pocet pozic |
14 | mul dh ; prepocet radku na offset |
15 | add al,dl |
16 | adc ah,0 |
17 | add ax,offset Pole |
18 | xchg ax,di ; DI <- adresa v poli |
19 | mov byte ptr ds:[di],0 |
Source code for MS-DOS: link
1 | boolean P_CheckMissileRange (mobj_t* actor){ |
2 | if (!P_CheckSight(actor, actor->target)) |
3 | return false; // can’t see the target |
4 | |
5 | if ( actor->flags & MF_JUSTHIT ) { |
6 | // just hit -> fight back! |
7 | actor->flags &= ~MF_JUSTHIT; |
8 | return true; |
9 | } |
10 | |
11 | if (actor->reactiontime) |
12 | return false; // do not attack yet |
13 | |
14 | if (!actor->info->meleestate) |
15 | dist -= 128*FRACUNIT; // no melee |
16 | |
17 | // check for ARCH-VILE |
18 | if (actor->type == MT_VILE){ |
19 | if (dist > 14*64) |
20 | return false; // too far away |
21 | } |
22 | ... |
Source code: link
Quake source code: link
Unreal Engine 1
Unreal Engine 4
Unreal Engine 5
Unity 2021.1.22 - current version
Ori
Besiege
Cuphead
Fixed time step
Variable time step
Adaptive time step
Object A reads previous state of Object B and Object B reads previous state of Object C
Scene Graph
Scene Manager
Devices
What to consider
Atomic events
Compound events
Special events
Sequence
Action
Context-sensitive input
1 | class InputEvent : public Resource { |
2 | |
3 | public: |
4 | static const int DEVICE_ID_TOUCH_MOUSE; |
5 | void set_device(int p_device); |
6 | int get_device() const; |
7 | |
8 | bool is_action(const StringName &p_action, bool p_exact_match = false) const; |
9 | bool is_action_pressed(const StringName &p_action, bool p_allow_echo = false, bool p_exact_match) const; |
10 | bool is_action_released(const StringName &p_action, bool p_exact_match = false) const; |
11 | float get_action_strength(const StringName &p_action, bool p_exact_match = false) const; |
12 | float get_action_raw_strength(const StringName &p_action, bool p_exact_match = false) const; |
13 | virtual bool is_pressed() const; |
14 | |
15 | virtual bool is_match(const Ref<InputEvent> &p_event, bool p_exact_match = true) const; |
16 | |
17 | virtual bool accumulate(const Ref<InputEvent> &p_event) { return false; } |
18 | }; |
Scripts in games
Hexen (1995) - one of the first scripted games
1 | script 137 (int dir) |
2 | { |
3 | if(!dir) |
4 | { |
5 | Floor_LowerByValue(DoorTag, 16, 64) |
6 | Ceiling_RaiseByValue(DoorTag, 16, 64) |
7 | Delay(120); |
8 | Floor_RaiseByValue(DoorTag, 16, 64) |
9 | Ceiling_LowerByValue(DoorTag, 16, 64) |
10 | } |
11 | } |
1 | // Creates boards and markers around mission Area |
2 | _xPos = position (_this select 0) select 0; |
3 | _yPos = position (_this select 0) select 1; |
4 | |
5 | _howBigA = _this select 1; |
6 | _howBigB = _this select 2; |
7 | _tablesC = _this select 3; |
8 | _angle = _this select 4; |
9 | _i = 0; |
10 | |
11 | while (_i < 360) do { |
12 | _x = (_howBighA * (sin _i)); |
13 | _y = (_howBigB * (cos _i)); |
14 | _x_rot = _xPos + _x*(cos _angle) - _y*(sin _angle); |
15 | _y_rot = _yPos + _x*(sin _angle) + _y*(cos _angle); |
16 | _k = createVehicle ["Danger", [_x_rot, _y_rot, 0], [], 0, "NONE"]; |
17 | _m = createMarker [format ["Marker" + str _i], [_x_rot, _y_rot, 0]]; |
18 | format ["Marker" + str _i] setMarkerType "Dot"; |
19 | _k setDir _i; |
20 | format ["Marker" + str _i] setMarkerDir(_i - _angle); |
21 | _i = _i + 360/_tablesC; |
22 | }; |
1 | func _process(delta): |
2 | # Get ball position and pad rectangles |
3 | var ball_pos = get_node("ball").get_pos() |
4 | var left_rect = Rect2(get_node("left").get_pos() - pad_size*0.5, pad_size) |
5 | var right_rect = Rect2(get_node("right").get_pos() - pad_size*0.5, pad_size) |
6 | |
7 | # Integrate new ball position |
8 | ball_pos += direction*ball_speed*delta |
9 | |
10 | # Flip, change direction and increase speed when touching pads |
11 | if ((left_rect.has_point(ball_pos) and direction.x < 0) |
12 | or (right_rect.has_point(ball_pos) and direction.x > 0)): |
13 | direction.x = -direction.x |
14 | ball_speed *= 1.1 |
15 | direction.y = randf()*2.0 - 1 |
16 | direction = direction.normalized() |
17 | ... |
1 | // Duktape JS mapping |
2 | static void jsb_class_define_FileSystem(JSVM* vm) { |
3 | duk_context* ctx = vm->GetJSContext(); |
4 | js_class_get_constructor(ctx, "Atomic", "FileSystem"); |
5 | js_class_get_prototype(ctx, "Atomic", "FileSystem"); |
6 | duk_pop_2(ctx); |
7 | js_class_get_prototype(ctx, "Atomic", "FileSystem"); |
8 | duk_push_c_function(ctx, jsb_class_FileSystem_SetCurrentDir, 1); |
9 | duk_put_prop_string(ctx, -2, "setCurrentDir"); |
10 | duk_push_c_function(ctx, jsb_class_FileSystem_CreateDir, 1); |
11 | duk_put_prop_string(ctx, -2, "createDir"); |
12 | ... |
13 | } |
14 | |
15 | // CreateDir method |
16 | static int jsb_class_FileSystem_CreateDir(duk_context* ctx) { |
17 | String __arg0 = duk_to_string(ctx, 0); |
18 | duk_push_this(ctx); |
19 | FileSystem* native = js_to_class_instance<FileSystem>(ctx, -1, 0); |
20 | bool retValue = native->CreateDir(__arg0); |
21 | duk_push_boolean(ctx, retValue ? 1 : 0); |
22 | return 1; |
23 | } |
1 | ATOMIC_EXPORT_API bool csb_Atomic_FileSystem_SetCurrentDir_4667(FileSystem* self, const char* pathName) |
2 | { |
3 | return self->SetCurrentDir(pathName ? String(pathName) : String::EMPTY); |
4 | } |
5 | |
6 | |
7 | ATOMIC_EXPORT_API bool csb_Atomic_FileSystem_CreateDir_4668(FileSystem* self, const char* pathName) |
8 | { |
9 | return self->CreateDir(pathName ? String(pathName) : String::EMPTY); |
10 | } |
11 | |
12 | |
13 | ATOMIC_EXPORT_API void csb_Atomic_FileSystem_SetExecuteConsoleCommands_4669(FileSystem* self, bool enable) |
14 | { |
15 | self->SetExecuteConsoleCommands(enable); |
16 | } |
If You Become Light Headed From Thirst, Feel Free To Pass Out!Portal